[U-Boot-Users] [PATCH] FIT: Fix handling of images without ramdisks

boot_get_ramdisk() should not treat the case when a FIT image does not contain a ramdisk as an error.
Signed-off-by: Peter Tyser ptyser@xes-inc.com --- The original code would not allow booting of a FIT image which didn't contain a ramdisk. The bug was observed and fixed on a powerpc 85xx system.
common/image.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/common/image.c b/common/image.c index 535c302..c3545a7 100644 --- a/common/image.c +++ b/common/image.c @@ -833,7 +833,7 @@ int boot_get_ramdisk (int argc, char *argv[], bootm_headers_t *images, rd_noffset = fit_conf_get_ramdisk_node (fit_hdr, cfg_noffset); if (rd_noffset < 0) { debug ("* ramdisk: no ramdisk in config\n"); - return 1; + return 0; } } #endif

Hi Peter,
I tested current head on my boards and I have no problem with it. Can you post your config part where you have problem? And I look at 85xx repo and I haven't found this fix there. The last patch on master branch in mine.
Regards, Michal Simek
boot_get_ramdisk() should not treat the case when a FIT image does not contain a ramdisk as an error.
Signed-off-by: Peter Tyser ptyser@xes-inc.com
The original code would not allow booting of a FIT image which didn't contain a ramdisk. The bug was observed and fixed on a powerpc 85xx system.
common/image.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/common/image.c b/common/image.c index 535c302..c3545a7 100644 --- a/common/image.c +++ b/common/image.c @@ -833,7 +833,7 @@ int boot_get_ramdisk (int argc, char *argv[], bootm_headers_t *images, rd_noffset = fit_conf_get_ramdisk_node (fit_hdr, cfg_noffset); if (rd_noffset < 0) { debug ("* ramdisk: no ramdisk in config\n");
return 1;
}return 0; }
#endif

On Wed, 2008-08-06 at 22:26 +0200, Michal Simek wrote:
I tested current head on my boards and I have no problem with it. Can you post your config part where you have problem? And I look at 85xx repo and I haven't found this fix there. The last patch on master branch in mine.
Hi Michal, I've included my kernel_fdt.its below as well as 2 boot attempts with some debug enabled - the 1st on without the patch, the 2nd with the patch. I'm using the mainline master (based on 1953d128fd07f07d1c3810a28c0863ea64dae1b6), not the 85xx repo, but I believe the problem exists in both repos.
Conceptually, I believe the patch makes sense. I'm calling bootm with no arguments (as seen in the FIT howto.txt), so boot_get_ramdisk() is unconditionally called by do_bootm_linux(). With no command arguments and a FIT image this section of code in boot_get_ramdisk() gets called:
rd_noffset = fit_conf_get_ramdisk_node (fit_hdr, cfg_noffset); if (rd_noffset < 0) { debug ("* ramdisk: no ramdisk in config\n"); return 1; }
which returns 1 causing the calling code from do_bootm_linux() to error out:
/* find ramdisk */ ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_PPC, &rd_data_start, &rd_data_end); if (ret) goto error;
Did you by chance try testing a PPC board? I noticed the boot_get_ramdisk() call is not used for microblaze.
Thanks! Peter
Contents of kernel_fdt.its
/ { description = "Basic image with single Linux kernel and FDT blob"; #address-cells = <1>;
images { kernel@1 { description = "X-ES MPC8572 Kernel v2.6.23"; data = /incbin/("./vmlinux.bin.gz"); type = "kernel"; arch = "ppc"; os = "linux"; compression = "gzip"; load = <00000000>; entry = <00000000>; hash@1 { algo = "crc32"; }; }; fdt@1 { description = "Flattened Device Tree blob"; data = /incbin/("./xpedite5370.dtb"); type = "flat_dt"; arch = "ppc"; load = <00c00000>; compression = "none"; hash@1 { algo = "crc32"; }; }; };
configurations { default = "conf@1"; conf@1 { description = "Boot Linux kernel with FDT blob"; kernel = "kernel@1"; fdt = "fdt@1"; }; }; };
Without the patch applied
=> imi
## Checking Image at 01000000 ... FIT image found FIT description: Basic image with single Linux kernel and FDT blob Created: 2008-08-06 20:47:47 UTC Image 0 (kernel@1) Description: X-ES MPC8572 Kernel v2.6.23 Type: Kernel Image Compression: gzip compressed Data Start: 0x010000f0 Data Size: 3947406 Bytes = 3.8 MB Architecture: PowerPC OS: Linux Load Address: 0x00000000 Entry Point: 0x00000000 Hash node: 'hash@1' Hash algo: crc32 Hash value: 10a29645 Hash len: 4 Image 1 (fdt@1) Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x013c3d64 Data Size: 9628 Bytes = 9.4 kB Architecture: PowerPC Hash node: 'hash@1' Hash algo: crc32 Hash value: b351fc1d Hash len: 4 Default Configuration: 'conf@1' Configuration 0 (conf@1) Description: Boot Linux kernel with FDT blob Kernel: kernel@1 FDT: fdt@1 => bootm * kernel: default image load address = 0x01000000 ## Booting kernel from FIT Image at 01000000 ... No configuration specified, trying default... Found default configuration: 'conf@1' Using 'conf@1' configuration Trying 'kernel@1' kernel subimage Description: X-ES MPC8572 Kernel v2.6.23 Type: Kernel Image Compression: gzip compressed Data Start: 0x010000f0 Data Size: 3947406 Bytes = 3.8 MB Architecture: PowerPC OS: Linux Load Address: 0x00000000 Entry Point: 0x00000000 Hash node: 'hash@1' Hash algo: crc32 Hash value: 10a29645 Hash len: 4 Verifying Hash Integrity ... crc32+ OK kernel data at 0x010000f0, len = 0x003c3b8e (3947406) Uncompressing Kernel Image ... OK kernel loaded at 0x00000000, end = 0x0060d55c WARNING: bootm_low + bootm_size exceed eff. memory WARNING: adjusting available memory to 10000000 ## Current stack ends at 0x0fe97bf8 * fdt: using config 'conf@1' from image at 0x01000000 ## Checking for 'FDT'/'FDT Image' at 01000000 ## Flattened Device Tree from FIT Image at 01000000 Using 'conf@1' configuration Trying 'fdt@1' FDT blob subimage Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x013c3d64 Data Size: 9628 Bytes = 9.4 kB Architecture: PowerPC Hash node: 'hash@1' Hash algo: crc32 Hash value: b351fc1d Hash len: 4 Verifying Hash Integrity ... crc32+ OK Loading FDT from 0x013c3d64 to 0x00c00000 Booting using the fdt blob at 0xc00000 of_flat_tree at 0x00c00000 size 0x0000259c * ramdisk: using config 'conf@1' from image at 0x01000000 * ramdisk: no ramdisk in config
<<<< board resets here >>>>
U-Boot 1.3.4-xes_r1-dirty (Aug 6 2008 - 15:42:12)
After applying the patch
=> bootm * kernel: default image load address = 0x01000000 ## Booting kernel from FIT Image at 01000000 ... No configuration specified, trying default... Found default configuration: 'conf@1' Using 'conf@1' configuration Trying 'kernel@1' kernel subimage Description: X-ES MPC8572 Kernel v2.6.23 Type: Kernel Image Compression: gzip compressed Data Start: 0x010000f0 Data Size: 3947406 Bytes = 3.8 MB Architecture: PowerPC OS: Linux Load Address: 0x00000000 Entry Point: 0x00000000 Hash node: 'hash@1' Hash algo: crc32 Hash value: 10a29645 Hash len: 4 Verifying Hash Integrity ... crc32+ OK kernel data at 0x010000f0, len = 0x003c3b8e (3947406) Uncompressing Kernel Image ... OK kernel loaded at 0x00000000, end = 0x0060d55c WARNING: bootm_low + bootm_size exceed eff. memory WARNING: adjusting available memory to 10000000 ## Current stack ends at 0x0fe97bf8 * fdt: using config 'conf@1' from image at 0x01000000 ## Checking for 'FDT'/'FDT Image' at 01000000 ## Flattened Device Tree from FIT Image at 01000000 Using 'conf@1' configuration Trying 'fdt@1' FDT blob subimage Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x013c3d64 Data Size: 9628 Bytes = 9.4 kB Architecture: PowerPC Hash node: 'hash@1' Hash algo: crc32 Hash value: b351fc1d Hash len: 4 Verifying Hash Integrity ... crc32+ OK Loading FDT from 0x013c3d64 to 0x00c00000 Booting using the fdt blob at 0xc00000 of_flat_tree at 0x00c00000 size 0x0000259c * ramdisk: using config 'conf@1' from image at 0x01000000 * ramdisk: no ramdisk in config calling ft_cpu_setup() ## initrd_high = 0xffffffff, copy_to_ram = 1 ramdisk load start = 0x00000000, ramdisk load end = 0x00000000 ## Transferring control to Linux (at address 00000000) ... Booting using OF flat tree... Using X-ES MPC85xx machine description
<<<< Linux boots normally >>>>

Hi Peter,
I've included my kernel_fdt.its below as well as 2 boot attempts with some debug enabled - the 1st on without the patch, the 2nd with the patch. I'm using the mainline master (based on 1953d128fd07f07d1c3810a28c0863ea64dae1b6), not the 85xx repo, but I believe the problem exists in both repos.
OK. I will test it today and send you my result.
Conceptually, I believe the patch makes sense. I'm calling bootm with no arguments (as seen in the FIT howto.txt), so boot_get_ramdisk() is unconditionally called by do_bootm_linux(). With no command arguments and a FIT image this section of code in boot_get_ramdisk() gets called:
rd_noffset = fit_conf_get_ramdisk_node (fit_hdr, cfg_noffset); if (rd_noffset < 0) { debug ("* ramdisk: no ramdisk in config\n"); return 1; }
which returns 1 causing the calling code from do_bootm_linux() to error out:
/* find ramdisk */ ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_PPC, &rd_data_start, &rd_data_end); if (ret) goto error;
I'll look at it in detail. Please wait some hours.
Did you by chance try testing a PPC board? I noticed the boot_get_ramdisk() call is not used for microblaze.
Sorry but I don't have any ppc board. Yes, it is but this code is not in master or microblaze branch but I sent first patch to mailing list some week ago.
Regards, Michal
Thanks! Peter
Contents of kernel_fdt.its
/ { description = "Basic image with single Linux kernel and FDT blob"; #address-cells = <1>;
images { kernel@1 { description = "X-ES MPC8572 Kernel v2.6.23"; data = /incbin/("./vmlinux.bin.gz"); type = "kernel"; arch = "ppc"; os = "linux"; compression = "gzip"; load = <00000000>; entry = <00000000>; hash@1 { algo = "crc32"; }; }; fdt@1 { description = "Flattened Device Tree blob"; data = /incbin/("./xpedite5370.dtb"); type = "flat_dt"; arch = "ppc"; load = <00c00000>; compression = "none"; hash@1 { algo = "crc32"; }; }; };
configurations { default = "conf@1"; conf@1 { description = "Boot Linux kernel with FDT blob"; kernel = "kernel@1"; fdt = "fdt@1"; }; }; };
Without the patch applied
=> imi
## Checking Image at 01000000 ... FIT image found FIT description: Basic image with single Linux kernel and FDT blob Created: 2008-08-06 20:47:47 UTC Image 0 (kernel@1) Description: X-ES MPC8572 Kernel v2.6.23 Type: Kernel Image Compression: gzip compressed Data Start: 0x010000f0 Data Size: 3947406 Bytes = 3.8 MB Architecture: PowerPC OS: Linux Load Address: 0x00000000 Entry Point: 0x00000000 Hash node: 'hash@1' Hash algo: crc32 Hash value: 10a29645 Hash len: 4 Image 1 (fdt@1) Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x013c3d64 Data Size: 9628 Bytes = 9.4 kB Architecture: PowerPC Hash node: 'hash@1' Hash algo: crc32 Hash value: b351fc1d Hash len: 4 Default Configuration: 'conf@1' Configuration 0 (conf@1) Description: Boot Linux kernel with FDT blob Kernel: kernel@1 FDT: fdt@1 => bootm
- kernel: default image load address = 0x01000000
## Booting kernel from FIT Image at 01000000 ... No configuration specified, trying default... Found default configuration: 'conf@1' Using 'conf@1' configuration Trying 'kernel@1' kernel subimage Description: X-ES MPC8572 Kernel v2.6.23 Type: Kernel Image Compression: gzip compressed Data Start: 0x010000f0 Data Size: 3947406 Bytes = 3.8 MB Architecture: PowerPC OS: Linux Load Address: 0x00000000 Entry Point: 0x00000000 Hash node: 'hash@1' Hash algo: crc32 Hash value: 10a29645 Hash len: 4 Verifying Hash Integrity ... crc32+ OK kernel data at 0x010000f0, len = 0x003c3b8e (3947406) Uncompressing Kernel Image ... OK kernel loaded at 0x00000000, end = 0x0060d55c WARNING: bootm_low + bootm_size exceed eff. memory WARNING: adjusting available memory to 10000000 ## Current stack ends at 0x0fe97bf8
- fdt: using config 'conf@1' from image at 0x01000000
## Checking for 'FDT'/'FDT Image' at 01000000 ## Flattened Device Tree from FIT Image at 01000000 Using 'conf@1' configuration Trying 'fdt@1' FDT blob subimage Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x013c3d64 Data Size: 9628 Bytes = 9.4 kB Architecture: PowerPC Hash node: 'hash@1' Hash algo: crc32 Hash value: b351fc1d Hash len: 4 Verifying Hash Integrity ... crc32+ OK Loading FDT from 0x013c3d64 to 0x00c00000 Booting using the fdt blob at 0xc00000 of_flat_tree at 0x00c00000 size 0x0000259c
- ramdisk: using config 'conf@1' from image at 0x01000000
- ramdisk: no ramdisk in config
<<<< board resets here >>>>
U-Boot 1.3.4-xes_r1-dirty (Aug 6 2008 - 15:42:12)
After applying the patch
=> bootm
- kernel: default image load address = 0x01000000
## Booting kernel from FIT Image at 01000000 ... No configuration specified, trying default... Found default configuration: 'conf@1' Using 'conf@1' configuration Trying 'kernel@1' kernel subimage Description: X-ES MPC8572 Kernel v2.6.23 Type: Kernel Image Compression: gzip compressed Data Start: 0x010000f0 Data Size: 3947406 Bytes = 3.8 MB Architecture: PowerPC OS: Linux Load Address: 0x00000000 Entry Point: 0x00000000 Hash node: 'hash@1' Hash algo: crc32 Hash value: 10a29645 Hash len: 4 Verifying Hash Integrity ... crc32+ OK kernel data at 0x010000f0, len = 0x003c3b8e (3947406) Uncompressing Kernel Image ... OK kernel loaded at 0x00000000, end = 0x0060d55c WARNING: bootm_low + bootm_size exceed eff. memory WARNING: adjusting available memory to 10000000 ## Current stack ends at 0x0fe97bf8
- fdt: using config 'conf@1' from image at 0x01000000
## Checking for 'FDT'/'FDT Image' at 01000000 ## Flattened Device Tree from FIT Image at 01000000 Using 'conf@1' configuration Trying 'fdt@1' FDT blob subimage Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x013c3d64 Data Size: 9628 Bytes = 9.4 kB Architecture: PowerPC Hash node: 'hash@1' Hash algo: crc32 Hash value: b351fc1d Hash len: 4 Verifying Hash Integrity ... crc32+ OK Loading FDT from 0x013c3d64 to 0x00c00000 Booting using the fdt blob at 0xc00000 of_flat_tree at 0x00c00000 size 0x0000259c
- ramdisk: using config 'conf@1' from image at 0x01000000
- ramdisk: no ramdisk in config
calling ft_cpu_setup() ## initrd_high = 0xffffffff, copy_to_ram = 1 ramdisk load start = 0x00000000, ramdisk load end = 0x00000000 ## Transferring control to Linux (at address 00000000) ... Booting using OF flat tree... Using X-ES MPC85xx machine description
<<<< Linux boots normally >>>>
No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.138 / Virus Database: 270.5.12/1589 - Release Date: 3.8.2008 01:00

Yes, you are right. I tested it and works.
Ack-by: Michal Simek monstr@monstr.eu
WD: This is bug fix - can you please handle this bug directly to your tree.
Thanks, Michal
boot_get_ramdisk() should not treat the case when a FIT image does not contain a ramdisk as an error.
Signed-off-by: Peter Tyser ptyser@xes-inc.com
The original code would not allow booting of a FIT image which didn't contain a ramdisk. The bug was observed and fixed on a powerpc 85xx system.
common/image.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/common/image.c b/common/image.c index 535c302..c3545a7 100644 --- a/common/image.c +++ b/common/image.c @@ -833,7 +833,7 @@ int boot_get_ramdisk (int argc, char *argv[], bootm_headers_t *images, rd_noffset = fit_conf_get_ramdisk_node (fit_hdr, cfg_noffset); if (rd_noffset < 0) { debug ("* ramdisk: no ramdisk in config\n");
return 1;
}return 0; }
#endif
1.5.4.3

Dear Peter Tyser,
In message 1217951517-823-1-git-send-email-ptyser@xes-inc.com you wrote:
boot_get_ramdisk() should not treat the case when a FIT image does not contain a ramdisk as an error.
Signed-off-by: Peter Tyser ptyser@xes-inc.com
The original code would not allow booting of a FIT image which didn't contain a ramdisk. The bug was observed and fixed on a powerpc 85xx system.
Applied, thanks.
But prelase remeber the maximum line length of some 70+ characters. Thanks.
Best regards,
Wolfgang Denk
participants (4)
-
Michal Simek
-
Michal Simek
-
Peter Tyser
-
Wolfgang Denk