[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

initramfs padding for constant redboot exec -r/-s args


 I have an issue with passing the exact size of the initrd to RedBoot.

 RedBoot allows passing an initrd to a linux kernel with the exec
 command; you just load the initrd and kernel in RAM and then pass the
 proper args to exec; for instance this works on my iMX51 dev system:
    fis load initrd
    fis load kernel
    exec -s 0x2a8ee7 -r 0x1000000 -c "console=ttymxc0,115200 root=/dev/mmcblk0p2 rootdelay=2"

 (the FIS directory has the addresses where initrd and kernel need to be

 However I need to pass the exact initrd size in "-s" above.  I suspect
 there's a way to pass a constant size or no size at all to the exec
 command, but it probably requires kernel args; I didn't manange to find
 the proper args though.

 I tried to pad the initrd with zeroes (as done on Thecus N2100) or with
 0xff's (as 0xf seems to be the EOB in the gzip compression), I tried
 passing initrd=0x91000000,6M mem=200M@0x90000000 on the kernel cmdline
 (with CONFIG_BLK_DEV_RAM_SIZE=8192) with -s 0x00600000, in all cases I
 overflow the ramdisk fd:
[42949379.640000] RAMDISK: Compressed image found at block 0
[42949380.210000] RAMDISK: incomplete write (-28 != 32768) 8388608

 My understanding is that RedBoot is responsible for creating the ATAG
 headers and will only do so if both -r and -s are used, and that can be
 overriden with the initrd arg; I tried with and without -r / -s and
 with/without the kernel args; in all cases the result was the overflow

 The only thing I can think of is patching RedBoot to set ramdisk_size
 (-s) from the length of the image loaded from fis, but it's a bit ugly
 as it needs matching of the -r address with any previously loaded data
 or careful ordering, and users will have older RedBoots for a while
 still, so it's fragile.

 Any idea on how I can handle that properly on the kernel args side?  Or
 perhaps I'm doing something wrong?

 I'd hate to have to update the -s arg in RedBoot's config
 (bootscript_data fconfig) each time the initramfs is updated.   :-/
 Also Thecus N2100 seems to handle that just fine (it doesn't use -r or
 -s but just exec -c "console=ttyS0,115200 root=/dev/ram0
 initrd=0xa0800000,42M mem=128M@0xa0000000")

Loïc Minier

Reply to: