Skip to main content.

Refactor bootm and Image Commands

Problems:

Sequence

  1. fdt boardsetup
    • Do board-specific FDT setup
  2. fdt chosen
    • Create the FDT /chosen node
  3. interrupts off
    • Disable interrupts (need CONFIG_CMD_IRQ)
  4. usb stop
    • USB stop (only if USB is supported)
  5. dcache off ; icache off
    • Disable cache (only needed for the Amiga One 3SE
  6. bootm start <os> <initrd> <fdtaddr>
    • bootm start $loadaddr $ramdiskaddr $fdtaddr
    • Sets the addresses...
  7. bootm ramdisk
    • Copies the ramdisk to high memory, honoring the env variable initrd_high and leaving room for the logbuffer
  8. bootm fdt
    • Copies the fdt to a "good" location
  9. bootm bdt
    • Sets up the bd_t struct values (legacy)
  10. bootm cmdline
    • Sets up the (linux) command line
  11. bootm prepos
    • OS-specific preparations before relocation or go
  12. bootm loados
    • Copies (with decompressing, if necessary) the OS to its execution address
  13. bootm go

Original Sequence

  1. Initialize / fill out the images structure
  2. lmb
    • env specified region: =getenv_bootm_low(); / getenv_bootm_size();
    • board reserved region (optional): board_lmb_reserve(&lmb);
  3. os_hdr = boot_get_kernel (cmdtp, flag, argc, argv, &images, &os_data, &os_len);
  4. /* get image parameters */ (different methods of filling out these variables based on IMAGE_FORMAT_LEGACY or IMAGE_FORMAT_FIT)
    • type
    • comp
    • os
    • image_end
    • load_start
    • image_start
    • load_end (set to zero, filled in after decompressing)
    • type_name
  5. Disable interrupts
  6. USB stop (if CONFIG_CMD_USB)
  7. Disable caches (if CONFIG_AMIGAONEG3SE)
  8. Decompress the image (based on compression type)
    • Sets load_end to the proper value
  9. Some sanity checking (load vs. image start and end, header validity)
  10. Add image load region to lmb
  11. OS-specific start function - should not return

=> bootm $loadaddr $ramdiskaddr $fdtaddr
## Booting kernel from Legacy Image at 00408000 ...
   Image Name:   Linux-2.6.26-06077-gc010b2f
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:    1391935 Bytes =  1.3 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 01000000 ...
   Image Name:   Simple Embedded Linux Framework
   Image Type:   PowerPC Linux RAMDisk Image (gzip compressed)
   Data Size:    1731902 Bytes =  1.7 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 00400000
   Booting using the fdt blob at 0x400000
   Uncompressing Kernel Image ... OK
   Loading Ramdisk to 0fdf7000, end 0ff9dd3e ... OK

Refactoring cmd_bootm.c

Refactoring image.c

New Commands Thoughts...

This section is some thoughts about if we made an imload command with subcommands rather than shoehorning the image manipulation into the bootm command.

  1. Copy fdt into destination address
  2. Copy initrd into destination address
  3. Decompress/copy OFP into destination address (requires interrupts disabled)