Loading a variable number of "modules"

Loïc Minier loic.minier at linaro.org
Thu Jun 23 16:33:08 UTC 2011


        Hey

 (followup to today's call0

 This is an attempt to write down an use case which expresses the
 concept of "modules" that the boot architecture would cover.  I don't
 really like the name modules, if you have better names please propose!

 So here's the writeup; this is completely fictional, and is just meant
 to illustrate modules.

 Here are the steps that could be taken to load a plain linux kernel:
 a) your SoC starts up in a SoC-specific way
 b) the boot architecture mandates how vmlinuz is loaded and started
 c) control is passed to linux
 d) profit!1!

 in a very dumbed down version of our boot architecture, we could say
 for b):
    a file named "bootme" is loaded from the first FAT partition of the
    SD card; its type is detected and if it's a linux kernel, it's
    started with a device tree blob provided by the firmware to the
    kernel

Good:
 * easy to install or update a kernel by replacing the vmlinuz file

Bad:
 * miss way to pass kernel cmdline
 * miss way to pass (optional) initrd
 * miss way to load/replace the DT

 all of the above bad points could be alleviated by pushing this data in
 the vmlinuz file, but it's not as practical as the modern linux systems
 we know.
   Another approach would be to put U-Boot or Barebox in the "bootme"
 file, but then U-Boot or Barebox would have to decide how to load the
 kernel and implement drivers for the SD card and this wouldn't be a
 SoC-agnostic boot image anymore.
   So the only possible approach I see in this case is to put a general
 purpose ARM bootloader in the "bootme" file which will talk to firmware
 to load additional files from the SD card (thanks to non-resident
 support from the firmware); this would then go away once linux runs.


 Now to "modules": instead of defining b) as just loading a single
 "bootme" file, we'd define a config file which lists what to load (e.g.
 something like grub.cfg/menu.lst) so that we could pass combinations
 such as:
 - vmlinuz + initrd + DT
 - vmlinuz + DT
 - Xen + DT + the OS modules it should load (linux and initrd)
 it would also allow setting things like kernel cmdline or other OS
 specific things.

 Maybe I misunderstood Grant's idea, but it felt like he was mandating a
 single payload from being loaded and just deferring to that payload.  I
 feel that if we go that route, we've specified too little to be able to
 construct useful images and have deffered to an implementation specific
 architecture (even if it could support multiple SoCs).



 So my conclusion is that we should specify:
 * either a single payload to start which would be something like a
   generic ARM bootloader talking to the firmware to load the other bits
   (e.g. via UEFI), but then also how it loads the next things
 * or a config file which points at "modules" (by lack of a better name)
   to load; these will get loaded by SoC specific code (likely an UEFI
   implementation)
 the main difference is whether we specify how a generic ARM bootloader
 is loaded and then defer to it to decide how to load the OS, or whether
 we specify OS-ish bits to load, and leave the loading to the
 implementation.


 Does that make any sense?

    Cheers,
-- 
Loïc Minier



More information about the boot-architecture mailing list