| OLD | NEW |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 * | 4 * |
| 5 * Verified boot kernel utility | 5 * Verified boot kernel utility |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <getopt.h> | 9 #include <getopt.h> |
| 10 #include <inttypes.h> /* For PRIu64 */ | 10 #include <inttypes.h> /* For PRIu64 */ |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 * tweak a few fields. */ | 328 * tweak a few fields. */ |
| 329 Debug("params goes at blob+=0x%" PRIx64 "\n", now); | 329 Debug("params goes at blob+=0x%" PRIx64 "\n", now); |
| 330 params = (struct linux_kernel_params *)(blob + now); | 330 params = (struct linux_kernel_params *)(blob + now); |
| 331 Memcpy(&(params->setup_sects), &(lh->setup_sects), | 331 Memcpy(&(params->setup_sects), &(lh->setup_sects), |
| 332 sizeof(*lh) - offsetof(struct linux_kernel_header, setup_sects)); | 332 sizeof(*lh) - offsetof(struct linux_kernel_header, setup_sects)); |
| 333 params->boot_flag = 0; | 333 params->boot_flag = 0; |
| 334 params->ramdisk_image = 0; /* we don't support initrd */ | 334 params->ramdisk_image = 0; /* we don't support initrd */ |
| 335 params->ramdisk_size = 0; | 335 params->ramdisk_size = 0; |
| 336 params->type_of_loader = 0xff; | 336 params->type_of_loader = 0xff; |
| 337 params->cmd_line_ptr = cmdline_addr; | 337 params->cmd_line_ptr = cmdline_addr; |
| 338 /* A fake e820 memory map with 2 entries */ |
| 339 params->n_e820_entry = 2; |
| 340 params->e820_entries[0].start_addr = 0x00000000; |
| 341 params->e820_entries[0].segment_size = 0x00001000; |
| 342 params->e820_entries[0].segment_type = E820_TYPE_RAM; |
| 343 params->e820_entries[1].start_addr = 0xfffff000; |
| 344 params->e820_entries[1].segment_size = 0x00001000; |
| 345 params->e820_entries[1].segment_type = E820_TYPE_RESERVED; |
| 338 now += CROS_PARAMS_SIZE; | 346 now += CROS_PARAMS_SIZE; |
| 339 | 347 |
| 340 /* Finally, append the bootloader. Remember where it will load in | 348 /* Finally, append the bootloader. Remember where it will load in |
| 341 * memory, too. */ | 349 * memory, too. */ |
| 342 Debug("bootloader goes at blob+=0x%" PRIx64 "\n", now); | 350 Debug("bootloader goes at blob+=0x%" PRIx64 "\n", now); |
| 343 bp->bootloader_address = CROS_32BIT_ENTRY_ADDR + now; | 351 bp->bootloader_address = CROS_32BIT_ENTRY_ADDR + now; |
| 344 bp->bootloader_size = roundup(bootloader_size, CROS_ALIGN); | 352 bp->bootloader_size = roundup(bootloader_size, CROS_ALIGN); |
| 345 Debug(" bootloader_address=0x%" PRIx64 "\n", bp->bootloader_address); | 353 Debug(" bootloader_address=0x%" PRIx64 "\n", bp->bootloader_address); |
| 346 Debug(" bootloader_size=0x%" PRIx64 "\n", bp->bootloader_size); | 354 Debug(" bootloader_size=0x%" PRIx64 "\n", bp->bootloader_size); |
| 347 if (bootloader_size) | 355 if (bootloader_size) |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 | 851 |
| 844 case OPT_MODE_VERIFY: | 852 case OPT_MODE_VERIFY: |
| 845 return Verify(filename, signpubkey, verbose); | 853 return Verify(filename, signpubkey, verbose); |
| 846 | 854 |
| 847 default: | 855 default: |
| 848 fprintf(stderr, | 856 fprintf(stderr, |
| 849 "You must specify a mode: --pack, --repack or --verify\n"); | 857 "You must specify a mode: --pack, --repack or --verify\n"); |
| 850 return PrintHelp(progname); | 858 return PrintHelp(progname); |
| 851 } | 859 } |
| 852 } | 860 } |
| OLD | NEW |