Skip to contentSkip to conversation

FIT: Fix handling of images without ramdisks

PATCH New Peter Tyser 3 participants 6 messages Aug 5, 2008 – Aug 9, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
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(-)
common/image.c +1 -1
index 535c302..c3545a7 100644
@@ -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
Signature · 1 line
1.5.4.3
#1 lore raw

PATCH 1/1 FIT: Fix handling of images without ramdisks

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

Quoted 22 lines

boot_get_ramdisk() should not treat the case when a FIT image does not contain a ramdisk as an error.

---
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(-)
common/image.c +1 -1
index 535c302..c3545a7 100644
@@ -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
#2 lore raw

PATCH 1/1 FIT: Fix handling of images without ramdisks

Quoted 5 lines · Michal Simek

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

Quoted 3 lines
Quoted 3 lines

Contents of kernel_fdt.its

/ {
	description = "Basic image with single Linux kernel and FDT blob";
	#address-cells = <1>;

	images {
		kernel at 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 at 1 {
				algo = "crc32";
			};
		};
		fdt at 1 {
			description = "Flattened Device Tree blob";
			data = /incbin/("./xpedite5370.dtb");
			type = "flat_dt";
			arch = "ppc";
			load = <00c00000>;
			compression = "none";
			hash at 1 {
				algo = "crc32";
			};
		};
	};

	configurations {
		default = "conf at 1";
		conf at 1 {
			description = "Boot Linux kernel with FDT blob";
			kernel = "kernel at 1";
			fdt = "fdt at 1";
		};
	};
};
Quoted 3 lines
Quoted 3 lines

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 at 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 at 1'
Hash algo: crc32
Hash value: 10a29645
Hash len: 4
Image 1 (fdt at 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 at 1'
Hash algo: crc32
Hash value: b351fc1d
Hash len: 4
Default Configuration: 'conf at 1'
Configuration 0 (conf at 1)
Description: Boot Linux kernel with FDT blob
Kernel: kernel at 1
FDT: fdt at 1
=> bootm
* kernel: default image load address = 0x01000000
## Booting kernel from FIT Image at 01000000 ...
No configuration specified, trying default...
Found default configuration: 'conf at 1'
Using 'conf at 1' configuration
Trying 'kernel at 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 at 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 at 1' from image at 0x01000000 ## Checking for 'FDT'/'FDT Image' at 01000000
## Flattened Device Tree from FIT Image at 01000000
Using 'conf at 1' configuration
Trying 'fdt at 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 at 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 at 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)

Quoted 3 lines
Quoted 3 lines

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 at 1' Using 'conf at 1' configuration
Trying 'kernel at 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 at 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 at 1' from image at 0x01000000 ## Checking for 'FDT'/'FDT Image' at 01000000
## Flattened Device Tree from FIT Image at 01000000
Using 'conf at 1' configuration
Trying 'fdt at 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 at 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 at 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 >>>>

#3 lore raw

PATCH 1/1 FIT: Fix handling of images without ramdisks

Hi Peter,

Quoted 5 lines

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.

Quoted 11 lines

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;
}
Quoted 8 lines

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.

Quoted 2 lines

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

Quoted 210 lines

Thanks!
Peter

Quoted 2 lines
Quoted 2 lines

Contents of kernel_fdt.its

/ {
	description = "Basic image with single Linux kernel and FDT blob";
	#address-cells = <1>;

	images {
		kernel at 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 at 1 {
				algo = "crc32";
			};
		};
		fdt at 1 {
			description = "Flattened Device Tree blob";
			data = /incbin/("./xpedite5370.dtb");
			type = "flat_dt";
			arch = "ppc";
			load = <00c00000>;
			compression = "none";
			hash at 1 {
				algo = "crc32";
			};
		};
	};

	configurations {
		default = "conf at 1";
		conf at 1 {
			description = "Boot Linux kernel with FDT blob";
			kernel = "kernel at 1";
			fdt = "fdt at 1";
		};
	};
};
Quoted 2 lines
Quoted 2 lines

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 at 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 at 1'
Hash algo: crc32
Hash value: 10a29645
Hash len: 4
Image 1 (fdt at 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 at 1'
Hash algo: crc32
Hash value: b351fc1d
Hash len: 4
Default Configuration: 'conf at 1'
Configuration 0 (conf at 1)
Description: Boot Linux kernel with FDT blob
Kernel: kernel at 1
FDT: fdt at 1
=> bootm
* kernel: default image load address = 0x01000000
## Booting kernel from FIT Image at 01000000 ...
No configuration specified, trying default...
Found default configuration: 'conf at 1'
Using 'conf at 1' configuration
Trying 'kernel at 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 at 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 at 1' from image at 0x01000000 ## Checking for 'FDT'/'FDT Image' at 01000000
## Flattened Device Tree from FIT Image at 01000000
Using 'conf at 1' configuration
Trying 'fdt at 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 at 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 at 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)

Quoted 2 lines
Quoted 2 lines

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 at 1' Using 'conf at 1' configuration
Trying 'kernel at 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 at 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 at 1' from image at 0x01000000 ## Checking for 'FDT'/'FDT Image' at 01000000
## Flattened Device Tree from FIT Image at 01000000
Using 'conf at 1' configuration
Trying 'fdt at 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 at 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 at 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

#4 lore raw

PATCH 1/1 FIT: Fix handling of images without ramdisks

In reply to Peter Tyser

Yes, you are right. I tested it and works.

WD: This is bug fix - can you please handle this bug directly to your tree.

Thanks,
Michal

Quoted 29 lines

boot_get_ramdisk() should not treat the case when a FIT image does not contain a ramdisk as an error.

---
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(-)
common/image.c +1 -1
index 535c302..c3545a7 100644
@@ -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

Signature · 1 line
1.5.4.3
#5 lore raw

PATCH 1/1 FIT: Fix handling of images without ramdisks

In reply to Peter Tyser

Dear Peter Tyser,

Quoted 5 lines · In message <[email protected]> you wrote:

boot_get_ramdisk() should not treat the case when a FIT image does not contain a ramdisk as an error.

---
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

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The greatest threat towards future is indifference.