spl: add linux initrd ramdisk properties to dtb
PATCH 1/1 spl: add linux initrd ramdisk properties to dtb
Currently when SPL is booting FIT images with ramdisk the kernel fails to find the ramdisk and panics.
This is due to missing "linux,initrd-start/end" properties in the device tree. Add fixup to insert these properties if a ramdisk is detected in the FIT image.
--- common/spl/spl_fit.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
common/spl/spl_fit.c +23 -0
@@ -567,6 +567,17 @@ static int spl_fit_image_get_os(const void *fit, int noffset, uint8_t *os)return 0 ; } +static int spl_fit_image_is_ramdisk (const void *fit,int node) +{ +const char *type; + + type =fdt_getprop (fit, node,FIT_TYPE_PROP ,NULL ); +if (!type) +return 0 ; + +return !strcmp (type,FIT_RAMDISK_PROP ); +} +/* * The purpose of the FIT load buffer is to provide a memory location that is * independent of the load address of any FIT component.
@@ -890,6 +901,18 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, spl_image->fdt_addr = image_info.fdt_addr; } +if (spl_fit_image_is_ramdisk (ctx.fit, node)) { +/* +* Insert initrd properties into dtb for +* ramdisk detection in kernel +*/ +if (spl_image->fdt_addr) { +fdt_initrd (spl_image->fdt_addr, + image_info.load_addr, + image_info.load_addr + image_info.size); + } + } +/* * If the "firmware" image did not provide an entry point, * use the first valid entry point from the loadables.
Signature · 1 line
2.25.1
Quoted 8 lines · Anatolij Gustschin
Currently when SPL is booting FIT images with ramdisk the kernel fails to find the ramdisk and panics.
This is due to missing "linux,initrd-start/end" properties in the device tree. Add fixup to insert these properties if a ramdisk is detected in the FIT image.
Quoted 4 lines
Signed-off-by Anatolij Gustschin <[email protected]>--- common/spl/spl_fit.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
Since this doesn't test with SPL_OS_BOOT it leads to ~400 byte SPL growth and failure to link due to excess site in a lot of platforms. Please rework this and put it through CI, thanks.
Signature · 1 line
Tom