All of lore.kernel.org
 help / color / mirror / Atom feed
* please help, "Ram disk image is corrupt or invalid" (qemu virt machine, arm64)
@ 2021-10-13  5:44 Chan Kim
  2021-10-19  7:32 ` François Ozog
  0 siblings, 1 reply; 7+ messages in thread
From: Chan Kim @ 2021-10-13  5:44 UTC (permalink / raw)
  To: u-boot

 

Hello all,

 

I can boot linux kernel using this command line.

${QEMU_DIR}/qemu-system-aarch64 -M ${QMACHINE} -cpu cortex-a72 -kernel
${LINUX_DIR}/arch/arm64/boot/Image -initrd ${BUSYBOX_DIR}/initramfs.cpio.gz
--append "root=/dev/ram init=/init nokaslr earlycon ip=dhcp" -m 2048M
-nographic -netdev user,id=n1 -device e1000,netdev=n1

 

After reading some docs and getting helps, I tried u-boot. 

After loading Image (for arm64) and dtb.dtb, I could see the kernel booting
to the final stage of deploying initramfs but it failed because I didn't
give the initramfs.cpio.gz address. (I used "booti 0x40200000 - 0x40000000)

 

So I added initramfs.cpio.gz under /opt/tftp, and loaded kernel, initramfs,
and dbt on memory and gave "booti 0x40200000 0x42000000 0x40000000",
addresses are kernel, initramfs and dtb).

Below is the log. (please see the final error message below)

 

++ /home/ckim/QEMU/qemu/build/aarch64-softmmu/qemu-system-aarch64 -M virt
-bios u-boot.bin -cpu cortex-a57 -bios u-boot.bin -nographic -drive
if=pflash,format=raw,index=1,file=envstore.img -netdev
user,id=net0,tftp=/opt/tftp -device e1000,netdev=net0

 

 

U-Boot 2021.10-00455-g50c84208ad (Oct 13 2021 - 12:58:40 +0900)

 

DRAM:  128 MiB

Flash: 64 MiB

MMC:   

Loading Environment from Flash... *** Warning - bad CRC, using default
environment

 

In:    pl011@9000000

Out:   pl011@9000000

Err:   pl011@9000000

Net:   e1000: 52:54:00:12:34:56

       eth0: e1000#0

Hit any key to stop autoboot:  0 

starting USB...

No working controllers found

USB is stopped. Please issue 'usb start' first.

scanning bus for devices...

 

Device 0: unknown device

 

Device 0: unknown device

starting USB...

No working controllers found

BOOTP broadcast 1

BOOTP broadcast 2

BOOTP broadcast 3

DHCP client bound to address 10.0.2.15 (1004 ms)

Using e1000#0 device

TFTP from server 10.0.2.2; our IP address is 10.0.2.15

Filename 'boot.scr.uimg'.

Load address: 0x40200000

Loading: *

TFTP error: 'File not found' (1)

Not retrying...

BOOTP broadcast 1

BOOTP broadcast 2

BOOTP broadcast 3

DHCP client bound to address 10.0.2.15 (1001 ms)

Using e1000#0 device

TFTP from server 10.0.2.2; our IP address is 10.0.2.15

Filename 'boot.scr.uimg'.

Load address: 0x40400000

Loading: *

TFTP error: 'File not found' (1)

Not retrying...

=> tftp 0x40000000 dtb.dtb

Using e1000#0 device

TFTP from server 10.0.2.2; our IP address is 10.0.2.15

Filename 'dtb.dtb'.

Load address: 0x40000000

Loading: #################################################################

#########

963.9 KiB/s

done

Bytes transferred = 1048576 (100000 hex)

=> tftp 0x40200000 Image

Using e1000#0 device

TFTP from server 10.0.2.2; our IP address is 10.0.2.15

Filename 'Image'.

Load address: 0x40200000

Loading: #################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

###################################

10 MiB/s

done

Bytes transferred = 26489344 (1943200 hex)

=> tftp 0x42000000 initramfs.cpio.gz

Using e1000#0 device

TFTP from server 10.0.2.2; our IP address is 10.0.2.15

Filename 'initramfs.cpio.gz'.

Load address: 0x42000000

Loading: #################################################################

#################

1 MiB/s

done

Bytes transferred = 1169894 (11d9e6 hex)

=> booti 0x40200000 0x42000000 0x40000000

Moving Image from 0x40200000 to 0x40280000, end=41c44000

Wrong Ramdisk Image Format

Ramdisk image is corrupt or invalid

 

At the end, it says "Ram disk image is corrupt or invalid". What am I doing
wrong?

I tried with un-gzipped file of initramfs, the same. Should I use real
initrd format(dd image)?

Any help will be very much appreciated.

 

Thank you!

Chan Kim

 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: please help, "Ram disk image is corrupt or invalid" (qemu virt machine, arm64)
  2021-10-13  5:44 please help, "Ram disk image is corrupt or invalid" (qemu virt machine, arm64) Chan Kim
@ 2021-10-19  7:32 ` François Ozog
  2021-10-19  9:59   ` Chan Kim
  0 siblings, 1 reply; 7+ messages in thread
From: François Ozog @ 2021-10-19  7:32 UTC (permalink / raw)
  To: Chan Kim; +Cc: u-boot

Hi

If you use the second argument to indicate the location of the initrd then
Linux will use device tree information to get the size of the initrd. That
information is probably absent or incorrect.

The initrd= in your command line is thus useless as you task U-boot to load
it.

You may want to consider the Arm defined SystemReady boot flow to avoid
issues and  benefit from secure boot flow and future extensions. In the
SystemReady boot flow , the Linux efi stub asks uboot to load the initrd
and do not need devicectree metadata to get any location or size (this is
to reinforce the use of device tree for hardware description as opposed to
hacking all information sharing between boot stages).

Cheers

FF




Le mer. 13 oct. 2021 à 07:44, Chan Kim <ckim@etri.re.kr> a écrit :

>
>
> Hello all,
>
>
>
> I can boot linux kernel using this command line.
>
> ${QEMU_DIR}/qemu-system-aarch64 -M ${QMACHINE} -cpu cortex-a72 -kernel
> ${LINUX_DIR}/arch/arm64/boot/Image -initrd ${BUSYBOX_DIR}/initramfs.cpio.gz
> --append "root=/dev/ram init=/init nokaslr earlycon ip=dhcp" -m 2048M
> -nographic -netdev user,id=n1 -device e1000,netdev=n1
>
>
>
> After reading some docs and getting helps, I tried u-boot.
>
> After loading Image (for arm64) and dtb.dtb, I could see the kernel booting
> to the final stage of deploying initramfs but it failed because I didn't
> give the initramfs.cpio.gz address. (I used "booti 0x40200000 - 0x40000000)
>
>
>
> So I added initramfs.cpio.gz under /opt/tftp, and loaded kernel, initramfs,
> and dbt on memory and gave "booti 0x40200000 0x42000000 0x40000000",
> addresses are kernel, initramfs and dtb).
>
> Below is the log. (please see the final error message below)
>
>
>
> ++ /home/ckim/QEMU/qemu/build/aarch64-softmmu/qemu-system-aarch64 -M virt
> -bios u-boot.bin -cpu cortex-a57 -bios u-boot.bin -nographic -drive
> if=pflash,format=raw,index=1,file=envstore.img -netdev
> user,id=net0,tftp=/opt/tftp -device e1000,netdev=net0
>
>
>
>
>
> U-Boot 2021.10-00455-g50c84208ad (Oct 13 2021 - 12:58:40 +0900)
>
>
>
> DRAM:  128 MiB
>
> Flash: 64 MiB
>
> MMC:
>
> Loading Environment from Flash... *** Warning - bad CRC, using default
> environment
>
>
>
> In:    pl011@9000000
>
> Out:   pl011@9000000
>
> Err:   pl011@9000000
>
> Net:   e1000: 52:54:00:12:34:56
>
>        eth0: e1000#0
>
> Hit any key to stop autoboot:  0
>
> starting USB...
>
> No working controllers found
>
> USB is stopped. Please issue 'usb start' first.
>
> scanning bus for devices...
>
>
>
> Device 0: unknown device
>
>
>
> Device 0: unknown device
>
> starting USB...
>
> No working controllers found
>
> BOOTP broadcast 1
>
> BOOTP broadcast 2
>
> BOOTP broadcast 3
>
> DHCP client bound to address 10.0.2.15 (1004 ms)
>
> Using e1000#0 device
>
> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
>
> Filename 'boot.scr.uimg'.
>
> Load address: 0x40200000
>
> Loading: *
>
> TFTP error: 'File not found' (1)
>
> Not retrying...
>
> BOOTP broadcast 1
>
> BOOTP broadcast 2
>
> BOOTP broadcast 3
>
> DHCP client bound to address 10.0.2.15 (1001 ms)
>
> Using e1000#0 device
>
> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
>
> Filename 'boot.scr.uimg'.
>
> Load address: 0x40400000
>
> Loading: *
>
> TFTP error: 'File not found' (1)
>
> Not retrying...
>
> => tftp 0x40000000 dtb.dtb
>
> Using e1000#0 device
>
> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
>
> Filename 'dtb.dtb'.
>
> Load address: 0x40000000
>
> Loading: #################################################################
>
> #########
>
> 963.9 KiB/s
>
> done
>
> Bytes transferred = 1048576 (100000 hex)
>
> => tftp 0x40200000 Image
>
> Using e1000#0 device
>
> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
>
> Filename 'Image'.
>
> Load address: 0x40200000
>
> Loading: #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> #################################################################
>
> ###################################
>
> 10 MiB/s
>
> done
>
> Bytes transferred = 26489344 (1943200 hex)
>
> => tftp 0x42000000 initramfs.cpio.gz
>
> Using e1000#0 device
>
> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
>
> Filename 'initramfs.cpio.gz'.
>
> Load address: 0x42000000
>
> Loading: #################################################################
>
> #################
>
> 1 MiB/s
>
> done
>
> Bytes transferred = 1169894 (11d9e6 hex)
>
> => booti 0x40200000 0x42000000 0x40000000
>
> Moving Image from 0x40200000 to 0x40280000, end=41c44000
>
> Wrong Ramdisk Image Format
>
> Ramdisk image is corrupt or invalid
>
>
>
> At the end, it says "Ram disk image is corrupt or invalid". What am I doing
> wrong?
>
> I tried with un-gzipped file of initramfs, the same. Should I use real
> initrd format(dd image)?
>
> Any help will be very much appreciated.
>
>
>
> Thank you!
>
> Chan Kim
>
>
>
> --
François-Frédéric Ozog | *Director Business Development*
T: +33.67221.6485
francois.ozog@linaro.org | Skype: ffozog

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: please help, "Ram disk image is corrupt or invalid" (qemu virt machine, arm64)
  2021-10-19  7:32 ` François Ozog
@ 2021-10-19  9:59   ` Chan Kim
  2021-10-19 10:43     ` Jaehoon Chung
  0 siblings, 1 reply; 7+ messages in thread
From: Chan Kim @ 2021-10-19  9:59 UTC (permalink / raw)
  To: 'François Ozog'; +Cc: u-boot

Hi, François

 

Thank you for the response.

I’m now studying u-boot so it’ll take some time to learn about SystemReady boot.

BTW, inspired by your email, I tried this one. (after tftp of all three files)

 

=> fdt addr 0x40000000

=> fdt chosen 0x42000000 0x4211e2a1       // the length of initramfs.cpio.gz is 1172129 = 0x11e2a1)

=> fdt print /chosen

chosen {

           linux,initrd-end = <0x00000000 0x4211e2a1>;

           linux,initrd-start = <0x00000000 0x42000000>;

           stdout-path = "/pl011@9000000";

};

=>  booti 0x40200000 0x42000000 0x40000000

Moving Image from 0x40200000 to 0x40280000, end=41c44000

Wrong Ramdisk Image Format

Ramdisk image is corrupt or invalid

 

I hoped now I set the device tree to have the initrd location, the kernel could find it, but not.

Isn’t there a correct method using this approach?

Thank you! Best regards,

 

Chan Kim

 

From: François Ozog <francois.ozog@linaro.org> 
Sent: Tuesday, October 19, 2021 4:32 PM
To: Chan Kim <ckim@etri.re.kr>
Cc: u-boot@lists.denx.de
Subject: Re: please help, "Ram disk image is corrupt or invalid" (qemu virt machine, arm64)

 

Hi

 

If you use the second argument to indicate the location of the initrd then Linux will use device tree information to get the size of the initrd. That information is probably absent or incorrect.

 

The initrd= in your command line is thus useless as you task U-boot to load it.

 

You may want to consider the Arm defined SystemReady boot flow to avoid issues and  benefit from secure boot flow and future extensions. In the SystemReady boot flow , the Linux efi stub asks uboot to load the initrd and do not need devicectree metadata to get any location or size (this is to reinforce the use of device tree for hardware description as opposed to hacking all information sharing between boot stages).

 

Cheers

 

FF

 

 

 

 

Le mer. 13 oct. 2021 à 07:44, Chan Kim <ckim@etri.re.kr <mailto:ckim@etri.re.kr> > a écrit :

 

Hello all,



I can boot linux kernel using this command line.

${QEMU_DIR}/qemu-system-aarch64 -M ${QMACHINE} -cpu cortex-a72 -kernel
${LINUX_DIR}/arch/arm64/boot/Image -initrd ${BUSYBOX_DIR}/initramfs.cpio.gz
--append "root=/dev/ram init=/init nokaslr earlycon ip=dhcp" -m 2048M
-nographic -netdev user,id=n1 -device e1000,netdev=n1



After reading some docs and getting helps, I tried u-boot. 

After loading Image (for arm64) and dtb.dtb, I could see the kernel booting
to the final stage of deploying initramfs but it failed because I didn't
give the initramfs.cpio.gz address. (I used "booti 0x40200000 - 0x40000000)



So I added initramfs.cpio.gz under /opt/tftp, and loaded kernel, initramfs,
and dbt on memory and gave "booti 0x40200000 0x42000000 0x40000000",
addresses are kernel, initramfs and dtb).

Below is the log. (please see the final error message below)



++ /home/ckim/QEMU/qemu/build/aarch64-softmmu/qemu-system-aarch64 -M virt
-bios u-boot.bin -cpu cortex-a57 -bios u-boot.bin -nographic -drive
if=pflash,format=raw,index=1,file=envstore.img -netdev
user,id=net0,tftp=/opt/tftp -device e1000,netdev=net0





U-Boot 2021.10-00455-g50c84208ad (Oct 13 2021 - 12:58:40 +0900)



DRAM:  128 MiB

Flash: 64 MiB

MMC:   

Loading Environment from Flash... *** Warning - bad CRC, using default
environment



In:    pl011@9000000

Out:   pl011@9000000

Err:   pl011@9000000

Net:   e1000: 52:54:00:12:34:56

       eth0: e1000#0

Hit any key to stop autoboot:  0 

starting USB...

No working controllers found

USB is stopped. Please issue 'usb start' first.

scanning bus for devices...



Device 0: unknown device



Device 0: unknown device

starting USB...

No working controllers found

BOOTP broadcast 1

BOOTP broadcast 2

BOOTP broadcast 3

DHCP client bound to address 10.0.2.15 (1004 ms)

Using e1000#0 device

TFTP from server 10.0.2.2; our IP address is 10.0.2.15

Filename 'boot.scr.uimg'.

Load address: 0x40200000

Loading: *

TFTP error: 'File not found' (1)

Not retrying...

BOOTP broadcast 1

BOOTP broadcast 2

BOOTP broadcast 3

DHCP client bound to address 10.0.2.15 (1001 ms)

Using e1000#0 device

TFTP from server 10.0.2.2; our IP address is 10.0.2.15

Filename 'boot.scr.uimg'.

Load address: 0x40400000

Loading: *

TFTP error: 'File not found' (1)

Not retrying...

=> tftp 0x40000000 dtb.dtb

Using e1000#0 device

TFTP from server 10.0.2.2; our IP address is 10.0.2.15

Filename 'dtb.dtb'.

Load address: 0x40000000

Loading: #################################################################

#########

963.9 KiB/s

done

Bytes transferred = 1048576 (100000 hex)

=> tftp 0x40200000 Image

Using e1000#0 device

TFTP from server 10.0.2.2; our IP address is 10.0.2.15

Filename 'Image'.

Load address: 0x40200000

Loading: #################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

###################################

10 MiB/s

done

Bytes transferred = 26489344 (1943200 hex)

=> tftp 0x42000000 initramfs.cpio.gz

Using e1000#0 device

TFTP from server 10.0.2.2; our IP address is 10.0.2.15

Filename 'initramfs.cpio.gz'.

Load address: 0x42000000

Loading: #################################################################

#################

1 MiB/s

done

Bytes transferred = 1169894 (11d9e6 hex)

=> booti 0x40200000 0x42000000 0x40000000

Moving Image from 0x40200000 to 0x40280000, end=41c44000

Wrong Ramdisk Image Format

Ramdisk image is corrupt or invalid



At the end, it says "Ram disk image is corrupt or invalid". What am I doing
wrong?

I tried with un-gzipped file of initramfs, the same. Should I use real
initrd format(dd image)?

Any help will be very much appreciated.



Thank you!

Chan Kim




-- 


  <https://static.linaro.org/common/images/linaro-logo-web.png> 


François-Frédéric Ozog | Director Business Development


T: +33.67221.6485
 <mailto:francois.ozog@linaro.org> francois.ozog@linaro.org | Skype: ffozog

 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: please help, "Ram disk image is corrupt or invalid" (qemu virt machine, arm64)
  2021-10-19  9:59   ` Chan Kim
@ 2021-10-19 10:43     ` Jaehoon Chung
  2021-10-19 12:31       ` Chan Kim
  0 siblings, 1 reply; 7+ messages in thread
From: Jaehoon Chung @ 2021-10-19 10:43 UTC (permalink / raw)
  To: Chan Kim, 'François Ozog'; +Cc: u-boot

Hi,

On 10/19/21 6:59 PM, Chan Kim wrote:
> Hi, François
> 
>  
> 
> Thank you for the response.
> 
> I’m now studying u-boot so it’ll take some time to learn about SystemReady boot.
> 
> BTW, inspired by your email, I tried this one. (after tftp of all three files)
> 
>  
> 
> => fdt addr 0x40000000
> 
> => fdt chosen 0x42000000 0x4211e2a1       // the length of initramfs.cpio.gz is 1172129 = 0x11e2a1)
> 
> => fdt print /chosen
> 
> chosen {
> 
>            linux,initrd-end = <0x00000000 0x4211e2a1>;
> 
>            linux,initrd-start = <0x00000000 0x42000000>;
> 
>            stdout-path = "/pl011@9000000";
> 
> };
> 
> =>  booti 0x40200000 0x42000000 0x40000000
> 
> Moving Image from 0x40200000 to 0x40280000, end=41c44000
> 
> Wrong Ramdisk Image Format
> 
> Ramdisk image is corrupt or invalid

You can check the debug message in common/image-board.c.
Did you create ramdisk image the correct format?

Best Regards,
Jaehoon Chung

> 
>  
> 
> I hoped now I set the device tree to have the initrd location, the kernel could find it, but not.
> 
> Isn’t there a correct method using this approach?
> 
> Thank you! Best regards,
> 
>  
> 
> Chan Kim
> 
>  
> 
> From: François Ozog <francois.ozog@linaro.org> 
> Sent: Tuesday, October 19, 2021 4:32 PM
> To: Chan Kim <ckim@etri.re.kr>
> Cc: u-boot@lists.denx.de
> Subject: Re: please help, "Ram disk image is corrupt or invalid" (qemu virt machine, arm64)
> 
>  
> 
> Hi
> 
>  
> 
> If you use the second argument to indicate the location of the initrd then Linux will use device tree information to get the size of the initrd. That information is probably absent or incorrect.
> 
>  
> 
> The initrd= in your command line is thus useless as you task U-boot to load it.
> 
>  
> 
> You may want to consider the Arm defined SystemReady boot flow to avoid issues and  benefit from secure boot flow and future extensions. In the SystemReady boot flow , the Linux efi stub asks uboot to load the initrd and do not need devicectree metadata to get any location or size (this is to reinforce the use of device tree for hardware description as opposed to hacking all information sharing between boot stages).
> 
>  
> 
> Cheers
> 
>  
> 
> FF
> 
>  
> 
>  
> 
>  
> 
>  
> 
> Le mer. 13 oct. 2021 à 07:44, Chan Kim <ckim@etri.re.kr <mailto:ckim@etri.re.kr> > a écrit :
> 
>  
> 
> Hello all,
> 
> 
> 
> I can boot linux kernel using this command line.
> 
> ${QEMU_DIR}/qemu-system-aarch64 -M ${QMACHINE} -cpu cortex-a72 -kernel
> ${LINUX_DIR}/arch/arm64/boot/Image -initrd ${BUSYBOX_DIR}/initramfs.cpio.gz
> --append "root=/dev/ram init=/init nokaslr earlycon ip=dhcp" -m 2048M
> -nographic -netdev user,id=n1 -device e1000,netdev=n1
> 
> 
> 
> After reading some docs and getting helps, I tried u-boot. 
> 
> After loading Image (for arm64) and dtb.dtb, I could see the kernel booting
> to the final stage of deploying initramfs but it failed because I didn't
> give the initramfs.cpio.gz address. (I used "booti 0x40200000 - 0x40000000)
> 
> 
> 
> So I added initramfs.cpio.gz under /opt/tftp, and loaded kernel, initramfs,
> and dbt on memory and gave "booti 0x40200000 0x42000000 0x40000000",
> addresses are kernel, initramfs and dtb).
> 
> Below is the log. (please see the final error message below)
> 
> 
> 
> ++ /home/ckim/QEMU/qemu/build/aarch64-softmmu/qemu-system-aarch64 -M virt
> -bios u-boot.bin -cpu cortex-a57 -bios u-boot.bin -nographic -drive
> if=pflash,format=raw,index=1,file=envstore.img -netdev
> user,id=net0,tftp=/opt/tftp -device e1000,netdev=net0
> 
> 
> 
> 
> 
> U-Boot 2021.10-00455-g50c84208ad (Oct 13 2021 - 12:58:40 +0900)
> 
> 
> 
> DRAM:  128 MiB
> 
> Flash: 64 MiB
> 
> MMC:   
> 
> Loading Environment from Flash... *** Warning - bad CRC, using default
> environment
> 
> 
> 
> In:    pl011@9000000
> 
> Out:   pl011@9000000
> 
> Err:   pl011@9000000
> 
> Net:   e1000: 52:54:00:12:34:56
> 
>        eth0: e1000#0
> 
> Hit any key to stop autoboot:  0 
> 
> starting USB...
> 
> No working controllers found
> 
> USB is stopped. Please issue 'usb start' first.
> 
> scanning bus for devices...
> 
> 
> 
> Device 0: unknown device
> 
> 
> 
> Device 0: unknown device
> 
> starting USB...
> 
> No working controllers found
> 
> BOOTP broadcast 1
> 
> BOOTP broadcast 2
> 
> BOOTP broadcast 3
> 
> DHCP client bound to address 10.0.2.15 (1004 ms)
> 
> Using e1000#0 device
> 
> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
> 
> Filename 'boot.scr.uimg'.
> 
> Load address: 0x40200000
> 
> Loading: *
> 
> TFTP error: 'File not found' (1)
> 
> Not retrying...
> 
> BOOTP broadcast 1
> 
> BOOTP broadcast 2
> 
> BOOTP broadcast 3
> 
> DHCP client bound to address 10.0.2.15 (1001 ms)
> 
> Using e1000#0 device
> 
> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
> 
> Filename 'boot.scr.uimg'.
> 
> Load address: 0x40400000
> 
> Loading: *
> 
> TFTP error: 'File not found' (1)
> 
> Not retrying...
> 
> => tftp 0x40000000 dtb.dtb
> 
> Using e1000#0 device
> 
> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
> 
> Filename 'dtb.dtb'.
> 
> Load address: 0x40000000
> 
> Loading: #################################################################
> 
> #########
> 
> 963.9 KiB/s
> 
> done
> 
> Bytes transferred = 1048576 (100000 hex)
> 
> => tftp 0x40200000 Image
> 
> Using e1000#0 device
> 
> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
> 
> Filename 'Image'.
> 
> Load address: 0x40200000
> 
> Loading: #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> #################################################################
> 
> ###################################
> 
> 10 MiB/s
> 
> done
> 
> Bytes transferred = 26489344 (1943200 hex)
> 
> => tftp 0x42000000 initramfs.cpio.gz
> 
> Using e1000#0 device
> 
> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
> 
> Filename 'initramfs.cpio.gz'.
> 
> Load address: 0x42000000
> 
> Loading: #################################################################
> 
> #################
> 
> 1 MiB/s
> 
> done
> 
> Bytes transferred = 1169894 (11d9e6 hex)
> 
> => booti 0x40200000 0x42000000 0x40000000
> 
> Moving Image from 0x40200000 to 0x40280000, end=41c44000
> 
> Wrong Ramdisk Image Format
> 
> Ramdisk image is corrupt or invalid
> 
> 
> 
> At the end, it says "Ram disk image is corrupt or invalid". What am I doing
> wrong?
> 
> I tried with un-gzipped file of initramfs, the same. Should I use real
> initrd format(dd image)?
> 
> Any help will be very much appreciated.
> 
> 
> 
> Thank you!
> 
> Chan Kim
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: please help, "Ram disk image is corrupt or invalid" (qemu virt machine, arm64)
  2021-10-19 10:43     ` Jaehoon Chung
@ 2021-10-19 12:31       ` Chan Kim
  2021-10-19 22:40         ` Jaehoon Chung
  0 siblings, 1 reply; 7+ messages in thread
From: Chan Kim @ 2021-10-19 12:31 UTC (permalink / raw)
  To: 'Jaehoon Chung', 'François Ozog'; +Cc: u-boot

Hi, Jaehoon,

Thanks for the help.

> You can check the debug message in common/image-board.c.
> Did you create ramdisk image the correct format?

To make ramdisk image (I made initramfs which I know is not a real disk image format (https://stackoverflow.com/questions/10603104/the-difference-between-initrd-and-initramfs, 
but with -kernel=Image -initrd=initramfs.cpio.gz, qemu ran ok to the shell prompt), 
I followed this procedure under busybox-1.32.1 directory.

o build busybox

    make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
    make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig
   ==> set CONFIG_CROSS_COMPILE_PREFIX=aarch64-linux-gnu- and set CONFIG_STATIC=y (position independent executable automatically not set)
    make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
    make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- install

o after make install, under _install,
    mkdir -p dev
    sudo mknod dev/console c 5 1
    sudo mknod dev/ram b 1 0

o make init script which contains (under _install)

    #!/bin/sh
    echo "### INIT SCRIPT ###"
    mkdir /proc /sys /tmp
    mount -t proc none /proc
    mount -t sysfs none /sys
    mount -t tmpfs none /tmp
    echo -e "\nThis boot took $(cut -d' ' -f1 /proc/uptime) seconds\n"
    ifconfig eth0 10.0.2.15 netmask 255.255.255.0 up
    route add default gw 10.0.2.2
    exec /bin/sh

o make ramdisk image (under _install directory)
    find -print0 | cpio -0oH newc | gzip -9 > ../initramfs.cpio.gz


I tried to set breakpoint in boot_get_ramdisk function in common/image.c (where "Wrong Ramdisk Image Format" is printed) but somehow the break point doesn't work. (But I could stop at board_init_f function).
I'll try to figure out why the break point isn't working there.

Can you find anything suspicious or give me a suggestion?

Thank you!
Best regards,

Chan Kim

> -----Original Message-----
> From: Jaehoon Chung <jh80.chung@samsung.com>
> Sent: Tuesday, October 19, 2021 7:43 PM
> To: Chan Kim <ckim@etri.re.kr>; 'François Ozog' <francois.ozog@linaro.org>
> Cc: u-boot@lists.denx.de
> Subject: Re: please help, "Ram disk image is corrupt or invalid" (qemu
> virt machine, arm64)
> 
> Hi,
> 
> On 10/19/21 6:59 PM, Chan Kim wrote:
> > Hi, François
> >
> >
> >
> > Thank you for the response.
> >
> > I’m now studying u-boot so it’ll take some time to learn about
> SystemReady boot.
> >
> > BTW, inspired by your email, I tried this one. (after tftp of all
> > three files)
> >
> >
> >
> > => fdt addr 0x40000000
> >
> > => fdt chosen 0x42000000 0x4211e2a1       // the length of
> initramfs.cpio.gz is 1172129 = 0x11e2a1)
> >
> > => fdt print /chosen
> >
> > chosen {
> >
> >            linux,initrd-end = <0x00000000 0x4211e2a1>;
> >
> >            linux,initrd-start = <0x00000000 0x42000000>;
> >
> >            stdout-path = "/pl011@9000000";
> >
> > };
> >
> > =>  booti 0x40200000 0x42000000 0x40000000
> >
> > Moving Image from 0x40200000 to 0x40280000, end=41c44000
> >
> > Wrong Ramdisk Image Format
> >
> > Ramdisk image is corrupt or invalid
> 
> You can check the debug message in common/image-board.c.
> Did you create ramdisk image the correct format?
> 
> Best Regards,
> Jaehoon Chung
> 
> >
> >
> >
> > I hoped now I set the device tree to have the initrd location, the
> kernel could find it, but not.
> >
> > Isn’t there a correct method using this approach?
> >
> > Thank you! Best regards,
> >
> >
> >
> > Chan Kim
> >
> >
> >
> > From: François Ozog <francois.ozog@linaro.org>
> > Sent: Tuesday, October 19, 2021 4:32 PM
> > To: Chan Kim <ckim@etri.re.kr>
> > Cc: u-boot@lists.denx.de
> > Subject: Re: please help, "Ram disk image is corrupt or invalid" (qemu
> > virt machine, arm64)
> >
> >
> >
> > Hi
> >
> >
> >
> > If you use the second argument to indicate the location of the initrd
> then Linux will use device tree information to get the size of the initrd.
> That information is probably absent or incorrect.
> >
> >
> >
> > The initrd= in your command line is thus useless as you task U-boot to
> load it.
> >
> >
> >
> > You may want to consider the Arm defined SystemReady boot flow to avoid
> issues and  benefit from secure boot flow and future extensions. In the
> SystemReady boot flow , the Linux efi stub asks uboot to load the initrd
> and do not need devicectree metadata to get any location or size (this is
> to reinforce the use of device tree for hardware description as opposed to
> hacking all information sharing between boot stages).
> >
> >
> >
> > Cheers
> >
> >
> >
> > FF
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Le mer. 13 oct. 2021 à 07:44, Chan Kim <ckim@etri.re.kr
> <mailto:ckim@etri.re.kr> > a écrit :
> >
> >
> >
> > Hello all,
> >
> >
> >
> > I can boot linux kernel using this command line.
> >
> > ${QEMU_DIR}/qemu-system-aarch64 -M ${QMACHINE} -cpu cortex-a72 -kernel
> > ${LINUX_DIR}/arch/arm64/boot/Image -initrd
> > ${BUSYBOX_DIR}/initramfs.cpio.gz --append "root=/dev/ram init=/init
> > nokaslr earlycon ip=dhcp" -m 2048M -nographic -netdev user,id=n1
> > -device e1000,netdev=n1
> >
> >
> >
> > After reading some docs and getting helps, I tried u-boot.
> >
> > After loading Image (for arm64) and dtb.dtb, I could see the kernel
> > booting to the final stage of deploying initramfs but it failed
> > because I didn't give the initramfs.cpio.gz address. (I used "booti
> > 0x40200000 - 0x40000000)
> >
> >
> >
> > So I added initramfs.cpio.gz under /opt/tftp, and loaded kernel,
> > initramfs, and dbt on memory and gave "booti 0x40200000 0x42000000
> > 0x40000000", addresses are kernel, initramfs and dtb).
> >
> > Below is the log. (please see the final error message below)
> >
> >
> >
> > ++ /home/ckim/QEMU/qemu/build/aarch64-softmmu/qemu-system-aarch64 -M
> > ++ virt
> > -bios u-boot.bin -cpu cortex-a57 -bios u-boot.bin -nographic -drive
> > if=pflash,format=raw,index=1,file=envstore.img -netdev
> > user,id=net0,tftp=/opt/tftp -device e1000,netdev=net0
> >
> >
> >
> >
> >
> > U-Boot 2021.10-00455-g50c84208ad (Oct 13 2021 - 12:58:40 +0900)
> >
> >
> >
> > DRAM:  128 MiB
> >
> > Flash: 64 MiB
> >
> > MMC:
> >
> > Loading Environment from Flash... *** Warning - bad CRC, using default
> > environment
> >
> >
> >
> > In:    pl011@9000000
> >
> > Out:   pl011@9000000
> >
> > Err:   pl011@9000000
> >
> > Net:   e1000: 52:54:00:12:34:56
> >
> >        eth0: e1000#0
> >
> > Hit any key to stop autoboot:  0
> >
> > starting USB...
> >
> > No working controllers found
> >
> > USB is stopped. Please issue 'usb start' first.
> >
> > scanning bus for devices...
> >
> >
> >
> > Device 0: unknown device
> >
> >
> >
> > Device 0: unknown device
> >
> > starting USB...
> >
> > No working controllers found
> >
> > BOOTP broadcast 1
> >
> > BOOTP broadcast 2
> >
> > BOOTP broadcast 3
> >
> > DHCP client bound to address 10.0.2.15 (1004 ms)
> >
> > Using e1000#0 device
> >
> > TFTP from server 10.0.2.2; our IP address is 10.0.2.15
> >
> > Filename 'boot.scr.uimg'.
> >
> > Load address: 0x40200000
> >
> > Loading: *
> >
> > TFTP error: 'File not found' (1)
> >
> > Not retrying...
> >
> > BOOTP broadcast 1
> >
> > BOOTP broadcast 2
> >
> > BOOTP broadcast 3
> >
> > DHCP client bound to address 10.0.2.15 (1001 ms)
> >
> > Using e1000#0 device
> >
> > TFTP from server 10.0.2.2; our IP address is 10.0.2.15
> >
> > Filename 'boot.scr.uimg'.
> >
> > Load address: 0x40400000
> >
> > Loading: *
> >
> > TFTP error: 'File not found' (1)
> >
> > Not retrying...
> >
> > => tftp 0x40000000 dtb.dtb
> >
> > Using e1000#0 device
> >
> > TFTP from server 10.0.2.2; our IP address is 10.0.2.15
> >
> > Filename 'dtb.dtb'.
> >
> > Load address: 0x40000000
> >
> > Loading:
> > #################################################################
> >
> > #########
> >
> > 963.9 KiB/s
> >
> > done
> >
> > Bytes transferred = 1048576 (100000 hex)
> >
> > => tftp 0x40200000 Image
> >
> > Using e1000#0 device
> >
> > TFTP from server 10.0.2.2; our IP address is 10.0.2.15
> >
> > Filename 'Image'.
> >
> > Load address: 0x40200000
> >
> > Loading:
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > #################################################################
> >
> > ###################################
> >
> > 10 MiB/s
> >
> > done
> >
> > Bytes transferred = 26489344 (1943200 hex)
> >
> > => tftp 0x42000000 initramfs.cpio.gz
> >
> > Using e1000#0 device
> >
> > TFTP from server 10.0.2.2; our IP address is 10.0.2.15
> >
> > Filename 'initramfs.cpio.gz'.
> >
> > Load address: 0x42000000
> >
> > Loading:
> > #################################################################
> >
> > #################
> >
> > 1 MiB/s
> >
> > done
> >
> > Bytes transferred = 1169894 (11d9e6 hex)
> >
> > => booti 0x40200000 0x42000000 0x40000000
> >
> > Moving Image from 0x40200000 to 0x40280000, end=41c44000
> >
> > Wrong Ramdisk Image Format
> >
> > Ramdisk image is corrupt or invalid
> >
> >
> >
> > At the end, it says "Ram disk image is corrupt or invalid". What am I
> > doing wrong?
> >
> > I tried with un-gzipped file of initramfs, the same. Should I use real
> > initrd format(dd image)?
> >
> > Any help will be very much appreciated.
> >
> >
> >
> > Thank you!
> >
> > Chan Kim
> >
> >
> >
> >
> 





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: please help, "Ram disk image is corrupt or invalid" (qemu virt machine, arm64)
  2021-10-19 12:31       ` Chan Kim
@ 2021-10-19 22:40         ` Jaehoon Chung
  2021-10-22  1:33           ` Chan Kim
  0 siblings, 1 reply; 7+ messages in thread
From: Jaehoon Chung @ 2021-10-19 22:40 UTC (permalink / raw)
  To: Chan Kim, 'François Ozog'; +Cc: u-boot

Hi,

On 10/19/21 9:31 PM, Chan Kim wrote:
> Hi, Jaehoon,
> 
> Thanks for the help.
> 
>> You can check the debug message in common/image-board.c.
>> Did you create ramdisk image the correct format?
> 
> To make ramdisk image (I made initramfs which I know is not a real disk image format (https://stackoverflow.com/questions/10603104/the-difference-between-initrd-and-initramfs, 
> but with -kernel=Image -initrd=initramfs.cpio.gz, qemu ran ok to the shell prompt), 
> I followed this procedure under busybox-1.32.1 directory.
> 
> o build busybox
> 
>     make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
>     make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig
>    ==> set CONFIG_CROSS_COMPILE_PREFIX=aarch64-linux-gnu- and set CONFIG_STATIC=y (position independent executable automatically not set)
>     make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
>     make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- install
> 
> o after make install, under _install,
>     mkdir -p dev
>     sudo mknod dev/console c 5 1
>     sudo mknod dev/ram b 1 0
> 
> o make init script which contains (under _install)
> 
>     #!/bin/sh
>     echo "### INIT SCRIPT ###"
>     mkdir /proc /sys /tmp
>     mount -t proc none /proc
>     mount -t sysfs none /sys
>     mount -t tmpfs none /tmp
>     echo -e "\nThis boot took $(cut -d' ' -f1 /proc/uptime) seconds\n"
>     ifconfig eth0 10.0.2.15 netmask 255.255.255.0 up
>     route add default gw 10.0.2.2
>     exec /bin/sh
> 
> o make ramdisk image (under _install directory)
>     find -print0 | cpio -0oH newc | gzip -9 > ../initramfs.cpio.gz

AFAIK, you need to create the ramdisk image for U-boot with mkimage tool.
or you can include initramfs.cpio.gz in kernel at build time.

Best Regards,
Jaehoon Chung

> 
> 
> I tried to set breakpoint in boot_get_ramdisk function in common/image.c (where "Wrong Ramdisk Image Format" is printed) but somehow the break point doesn't work. (But I could stop at board_init_f function).
> I'll try to figure out why the break point isn't working there.
> 
> Can you find anything suspicious or give me a suggestion?
> 
> Thank you!
> Best regards,
> 
> Chan Kim
> 
>> -----Original Message-----
>> From: Jaehoon Chung <jh80.chung@samsung.com>
>> Sent: Tuesday, October 19, 2021 7:43 PM
>> To: Chan Kim <ckim@etri.re.kr>; 'François Ozog' <francois.ozog@linaro.org>
>> Cc: u-boot@lists.denx.de
>> Subject: Re: please help, "Ram disk image is corrupt or invalid" (qemu
>> virt machine, arm64)
>>
>> Hi,
>>
>> On 10/19/21 6:59 PM, Chan Kim wrote:
>>> Hi, François
>>>
>>>
>>>
>>> Thank you for the response.
>>>
>>> I’m now studying u-boot so it’ll take some time to learn about
>> SystemReady boot.
>>>
>>> BTW, inspired by your email, I tried this one. (after tftp of all
>>> three files)
>>>
>>>
>>>
>>> => fdt addr 0x40000000
>>>
>>> => fdt chosen 0x42000000 0x4211e2a1       // the length of
>> initramfs.cpio.gz is 1172129 = 0x11e2a1)
>>>
>>> => fdt print /chosen
>>>
>>> chosen {
>>>
>>>            linux,initrd-end = <0x00000000 0x4211e2a1>;
>>>
>>>            linux,initrd-start = <0x00000000 0x42000000>;
>>>
>>>            stdout-path = "/pl011@9000000";
>>>
>>> };
>>>
>>> =>  booti 0x40200000 0x42000000 0x40000000
>>>
>>> Moving Image from 0x40200000 to 0x40280000, end=41c44000
>>>
>>> Wrong Ramdisk Image Format
>>>
>>> Ramdisk image is corrupt or invalid
>>
>> You can check the debug message in common/image-board.c.
>> Did you create ramdisk image the correct format?
>>
>> Best Regards,
>> Jaehoon Chung
>>
>>>
>>>
>>>
>>> I hoped now I set the device tree to have the initrd location, the
>> kernel could find it, but not.
>>>
>>> Isn’t there a correct method using this approach?
>>>
>>> Thank you! Best regards,
>>>
>>>
>>>
>>> Chan Kim
>>>
>>>
>>>
>>> From: François Ozog <francois.ozog@linaro.org>
>>> Sent: Tuesday, October 19, 2021 4:32 PM
>>> To: Chan Kim <ckim@etri.re.kr>
>>> Cc: u-boot@lists.denx.de
>>> Subject: Re: please help, "Ram disk image is corrupt or invalid" (qemu
>>> virt machine, arm64)
>>>
>>>
>>>
>>> Hi
>>>
>>>
>>>
>>> If you use the second argument to indicate the location of the initrd
>> then Linux will use device tree information to get the size of the initrd.
>> That information is probably absent or incorrect.
>>>
>>>
>>>
>>> The initrd= in your command line is thus useless as you task U-boot to
>> load it.
>>>
>>>
>>>
>>> You may want to consider the Arm defined SystemReady boot flow to avoid
>> issues and  benefit from secure boot flow and future extensions. In the
>> SystemReady boot flow , the Linux efi stub asks uboot to load the initrd
>> and do not need devicectree metadata to get any location or size (this is
>> to reinforce the use of device tree for hardware description as opposed to
>> hacking all information sharing between boot stages).
>>>
>>>
>>>
>>> Cheers
>>>
>>>
>>>
>>> FF
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Le mer. 13 oct. 2021 à 07:44, Chan Kim <ckim@etri.re.kr
>> <mailto:ckim@etri.re.kr> > a écrit :
>>>
>>>
>>>
>>> Hello all,
>>>
>>>
>>>
>>> I can boot linux kernel using this command line.
>>>
>>> ${QEMU_DIR}/qemu-system-aarch64 -M ${QMACHINE} -cpu cortex-a72 -kernel
>>> ${LINUX_DIR}/arch/arm64/boot/Image -initrd
>>> ${BUSYBOX_DIR}/initramfs.cpio.gz --append "root=/dev/ram init=/init
>>> nokaslr earlycon ip=dhcp" -m 2048M -nographic -netdev user,id=n1
>>> -device e1000,netdev=n1
>>>
>>>
>>>
>>> After reading some docs and getting helps, I tried u-boot.
>>>
>>> After loading Image (for arm64) and dtb.dtb, I could see the kernel
>>> booting to the final stage of deploying initramfs but it failed
>>> because I didn't give the initramfs.cpio.gz address. (I used "booti
>>> 0x40200000 - 0x40000000)
>>>
>>>
>>>
>>> So I added initramfs.cpio.gz under /opt/tftp, and loaded kernel,
>>> initramfs, and dbt on memory and gave "booti 0x40200000 0x42000000
>>> 0x40000000", addresses are kernel, initramfs and dtb).
>>>
>>> Below is the log. (please see the final error message below)
>>>
>>>
>>>
>>> ++ /home/ckim/QEMU/qemu/build/aarch64-softmmu/qemu-system-aarch64 -M
>>> ++ virt
>>> -bios u-boot.bin -cpu cortex-a57 -bios u-boot.bin -nographic -drive
>>> if=pflash,format=raw,index=1,file=envstore.img -netdev
>>> user,id=net0,tftp=/opt/tftp -device e1000,netdev=net0
>>>
>>>
>>>
>>>
>>>
>>> U-Boot 2021.10-00455-g50c84208ad (Oct 13 2021 - 12:58:40 +0900)
>>>
>>>
>>>
>>> DRAM:  128 MiB
>>>
>>> Flash: 64 MiB
>>>
>>> MMC:
>>>
>>> Loading Environment from Flash... *** Warning - bad CRC, using default
>>> environment
>>>
>>>
>>>
>>> In:    pl011@9000000
>>>
>>> Out:   pl011@9000000
>>>
>>> Err:   pl011@9000000
>>>
>>> Net:   e1000: 52:54:00:12:34:56
>>>
>>>        eth0: e1000#0
>>>
>>> Hit any key to stop autoboot:  0
>>>
>>> starting USB...
>>>
>>> No working controllers found
>>>
>>> USB is stopped. Please issue 'usb start' first.
>>>
>>> scanning bus for devices...
>>>
>>>
>>>
>>> Device 0: unknown device
>>>
>>>
>>>
>>> Device 0: unknown device
>>>
>>> starting USB...
>>>
>>> No working controllers found
>>>
>>> BOOTP broadcast 1
>>>
>>> BOOTP broadcast 2
>>>
>>> BOOTP broadcast 3
>>>
>>> DHCP client bound to address 10.0.2.15 (1004 ms)
>>>
>>> Using e1000#0 device
>>>
>>> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
>>>
>>> Filename 'boot.scr.uimg'.
>>>
>>> Load address: 0x40200000
>>>
>>> Loading: *
>>>
>>> TFTP error: 'File not found' (1)
>>>
>>> Not retrying...
>>>
>>> BOOTP broadcast 1
>>>
>>> BOOTP broadcast 2
>>>
>>> BOOTP broadcast 3
>>>
>>> DHCP client bound to address 10.0.2.15 (1001 ms)
>>>
>>> Using e1000#0 device
>>>
>>> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
>>>
>>> Filename 'boot.scr.uimg'.
>>>
>>> Load address: 0x40400000
>>>
>>> Loading: *
>>>
>>> TFTP error: 'File not found' (1)
>>>
>>> Not retrying...
>>>
>>> => tftp 0x40000000 dtb.dtb
>>>
>>> Using e1000#0 device
>>>
>>> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
>>>
>>> Filename 'dtb.dtb'.
>>>
>>> Load address: 0x40000000
>>>
>>> Loading:
>>> #################################################################
>>>
>>> #########
>>>
>>> 963.9 KiB/s
>>>
>>> done
>>>
>>> Bytes transferred = 1048576 (100000 hex)
>>>
>>> => tftp 0x40200000 Image
>>>
>>> Using e1000#0 device
>>>
>>> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
>>>
>>> Filename 'Image'.
>>>
>>> Load address: 0x40200000
>>>
>>> Loading:
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> #################################################################
>>>
>>> ###################################
>>>
>>> 10 MiB/s
>>>
>>> done
>>>
>>> Bytes transferred = 26489344 (1943200 hex)
>>>
>>> => tftp 0x42000000 initramfs.cpio.gz
>>>
>>> Using e1000#0 device
>>>
>>> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
>>>
>>> Filename 'initramfs.cpio.gz'.
>>>
>>> Load address: 0x42000000
>>>
>>> Loading:
>>> #################################################################
>>>
>>> #################
>>>
>>> 1 MiB/s
>>>
>>> done
>>>
>>> Bytes transferred = 1169894 (11d9e6 hex)
>>>
>>> => booti 0x40200000 0x42000000 0x40000000
>>>
>>> Moving Image from 0x40200000 to 0x40280000, end=41c44000
>>>
>>> Wrong Ramdisk Image Format
>>>
>>> Ramdisk image is corrupt or invalid
>>>
>>>
>>>
>>> At the end, it says "Ram disk image is corrupt or invalid". What am I
>>> doing wrong?
>>>
>>> I tried with un-gzipped file of initramfs, the same. Should I use real
>>> initrd format(dd image)?
>>>
>>> Any help will be very much appreciated.
>>>
>>>
>>>
>>> Thank you!
>>>
>>> Chan Kim
>>>
>>>
>>>
>>>
>>
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: please help, "Ram disk image is corrupt or invalid" (qemu virt machine, arm64)
  2021-10-19 22:40         ` Jaehoon Chung
@ 2021-10-22  1:33           ` Chan Kim
  0 siblings, 0 replies; 7+ messages in thread
From: Chan Kim @ 2021-10-22  1:33 UTC (permalink / raw)
  To: 'Jaehoon Chung', 'François Ozog'; +Cc: u-boot

Hi, Jaehoon,
I followed your suggestion and used CONFIG_INITRAMFS_SOURCE to include the initramfs.cpio.gz in the 'Image' and could see the shell coming up with booti command.
Thanks!
Chan Kim

> -----Original Message-----
> From: Jaehoon Chung <jh80.chung@samsung.com>
> Sent: Wednesday, October 20, 2021 7:41 AM
> To: Chan Kim <ckim@etri.re.kr>; 'François Ozog' <francois.ozog@linaro.org>
> Cc: u-boot@lists.denx.de
> Subject: Re: please help, "Ram disk image is corrupt or invalid" (qemu
> virt machine, arm64)
> 
> Hi,
> 
> On 10/19/21 9:31 PM, Chan Kim wrote:
> > Hi, Jaehoon,
> >
> > Thanks for the help.
> >
> >> You can check the debug message in common/image-board.c.
> >> Did you create ramdisk image the correct format?
> >
> > To make ramdisk image (I made initramfs which I know is not a real
> > disk image format
> > (https://stackoverflow.com/questions/10603104/the-difference-between-i
> > nitrd-and-initramfs, but with -kernel=Image -initrd=initramfs.cpio.gz,
> > qemu ran ok to the shell prompt), I followed this procedure under
> > busybox-1.32.1 directory.
> >
> > o build busybox
> >
> >     make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
> >     make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig
> >    ==> set CONFIG_CROSS_COMPILE_PREFIX=aarch64-linux-gnu- and set
> CONFIG_STATIC=y (position independent executable automatically not set)
> >     make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
> >     make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- install
> >
> > o after make install, under _install,
> >     mkdir -p dev
> >     sudo mknod dev/console c 5 1
> >     sudo mknod dev/ram b 1 0
> >
> > o make init script which contains (under _install)
> >
> >     #!/bin/sh
> >     echo "### INIT SCRIPT ###"
> >     mkdir /proc /sys /tmp
> >     mount -t proc none /proc
> >     mount -t sysfs none /sys
> >     mount -t tmpfs none /tmp
> >     echo -e "\nThis boot took $(cut -d' ' -f1 /proc/uptime) seconds\n"
> >     ifconfig eth0 10.0.2.15 netmask 255.255.255.0 up
> >     route add default gw 10.0.2.2
> >     exec /bin/sh
> >
> > o make ramdisk image (under _install directory)
> >     find -print0 | cpio -0oH newc | gzip -9 > ../initramfs.cpio.gz
> 
> AFAIK, you need to create the ramdisk image for U-boot with mkimage tool.
> or you can include initramfs.cpio.gz in kernel at build time.
> 
> Best Regards,
> Jaehoon Chung
> 
> >
> >
> > I tried to set breakpoint in boot_get_ramdisk function in common/image.c
> (where "Wrong Ramdisk Image Format" is printed) but somehow the break
> point doesn't work. (But I could stop at board_init_f function).
> > I'll try to figure out why the break point isn't working there.
> >
> > Can you find anything suspicious or give me a suggestion?
> >
> > Thank you!
> > Best regards,
> >
> > Chan Kim
> >
> >> -----Original Message-----
> >> From: Jaehoon Chung <jh80.chung@samsung.com>
> >> Sent: Tuesday, October 19, 2021 7:43 PM
> >> To: Chan Kim <ckim@etri.re.kr>; 'François Ozog'
> >> <francois.ozog@linaro.org>
> >> Cc: u-boot@lists.denx.de
> >> Subject: Re: please help, "Ram disk image is corrupt or invalid"
> >> (qemu virt machine, arm64)
> >>
> >> Hi,
> >>
> >> On 10/19/21 6:59 PM, Chan Kim wrote:
> >>> Hi, François
> >>>
> >>>
> >>>
> >>> Thank you for the response.
> >>>
> >>> I’m now studying u-boot so it’ll take some time to learn about
> >> SystemReady boot.
> >>>
> >>> BTW, inspired by your email, I tried this one. (after tftp of all
> >>> three files)
> >>>
> >>>
> >>>
> >>> => fdt addr 0x40000000
> >>>
> >>> => fdt chosen 0x42000000 0x4211e2a1       // the length of
> >> initramfs.cpio.gz is 1172129 = 0x11e2a1)
> >>>
> >>> => fdt print /chosen
> >>>
> >>> chosen {
> >>>
> >>>            linux,initrd-end = <0x00000000 0x4211e2a1>;
> >>>
> >>>            linux,initrd-start = <0x00000000 0x42000000>;
> >>>
> >>>            stdout-path = "/pl011@9000000";
> >>>
> >>> };
> >>>
> >>> =>  booti 0x40200000 0x42000000 0x40000000
> >>>
> >>> Moving Image from 0x40200000 to 0x40280000, end=41c44000
> >>>
> >>> Wrong Ramdisk Image Format
> >>>
> >>> Ramdisk image is corrupt or invalid
> >>
> >> You can check the debug message in common/image-board.c.
> >> Did you create ramdisk image the correct format?
> >>
> >> Best Regards,
> >> Jaehoon Chung
> >>
> >>>
> >>>
> >>>
> >>> I hoped now I set the device tree to have the initrd location, the
> >> kernel could find it, but not.
> >>>
> >>> Isn’t there a correct method using this approach?
> >>>
> >>> Thank you! Best regards,
> >>>
> >>>
> >>>
> >>> Chan Kim
> >>>
> >>>
> >>>
> >>> From: François Ozog <francois.ozog@linaro.org>
> >>> Sent: Tuesday, October 19, 2021 4:32 PM
> >>> To: Chan Kim <ckim@etri.re.kr>
> >>> Cc: u-boot@lists.denx.de
> >>> Subject: Re: please help, "Ram disk image is corrupt or invalid"
> >>> (qemu virt machine, arm64)
> >>>
> >>>
> >>>
> >>> Hi
> >>>
> >>>
> >>>
> >>> If you use the second argument to indicate the location of the
> >>> initrd
> >> then Linux will use device tree information to get the size of the
> initrd.
> >> That information is probably absent or incorrect.
> >>>
> >>>
> >>>
> >>> The initrd= in your command line is thus useless as you task U-boot
> >>> to
> >> load it.
> >>>
> >>>
> >>>
> >>> You may want to consider the Arm defined SystemReady boot flow to
> >>> avoid
> >> issues and  benefit from secure boot flow and future extensions. In
> >> the SystemReady boot flow , the Linux efi stub asks uboot to load the
> >> initrd and do not need devicectree metadata to get any location or
> >> size (this is to reinforce the use of device tree for hardware
> >> description as opposed to hacking all information sharing between boot
> stages).
> >>>
> >>>
> >>>
> >>> Cheers
> >>>
> >>>
> >>>
> >>> FF
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> Le mer. 13 oct. 2021 à 07:44, Chan Kim <ckim@etri.re.kr
> >> <mailto:ckim@etri.re.kr> > a écrit :
> >>>
> >>>
> >>>
> >>> Hello all,
> >>>
> >>>
> >>>
> >>> I can boot linux kernel using this command line.
> >>>
> >>> ${QEMU_DIR}/qemu-system-aarch64 -M ${QMACHINE} -cpu cortex-a72
> >>> -kernel ${LINUX_DIR}/arch/arm64/boot/Image -initrd
> >>> ${BUSYBOX_DIR}/initramfs.cpio.gz --append "root=/dev/ram init=/init
> >>> nokaslr earlycon ip=dhcp" -m 2048M -nographic -netdev user,id=n1
> >>> -device e1000,netdev=n1
> >>>
> >>>
> >>>
> >>> After reading some docs and getting helps, I tried u-boot.
> >>>
> >>> After loading Image (for arm64) and dtb.dtb, I could see the kernel
> >>> booting to the final stage of deploying initramfs but it failed
> >>> because I didn't give the initramfs.cpio.gz address. (I used "booti
> >>> 0x40200000 - 0x40000000)
> >>>
> >>>
> >>>
> >>> So I added initramfs.cpio.gz under /opt/tftp, and loaded kernel,
> >>> initramfs, and dbt on memory and gave "booti 0x40200000 0x42000000
> >>> 0x40000000", addresses are kernel, initramfs and dtb).
> >>>
> >>> Below is the log. (please see the final error message below)
> >>>
> >>>
> >>>
> >>> ++ /home/ckim/QEMU/qemu/build/aarch64-softmmu/qemu-system-aarch64 -M
> >>> ++ virt
> >>> -bios u-boot.bin -cpu cortex-a57 -bios u-boot.bin -nographic -drive
> >>> if=pflash,format=raw,index=1,file=envstore.img -netdev
> >>> user,id=net0,tftp=/opt/tftp -device e1000,netdev=net0
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> U-Boot 2021.10-00455-g50c84208ad (Oct 13 2021 - 12:58:40 +0900)
> >>>
> >>>
> >>>
> >>> DRAM:  128 MiB
> >>>
> >>> Flash: 64 MiB
> >>>
> >>> MMC:
> >>>
> >>> Loading Environment from Flash... *** Warning - bad CRC, using
> >>> default environment
> >>>
> >>>
> >>>
> >>> In:    pl011@9000000
> >>>
> >>> Out:   pl011@9000000
> >>>
> >>> Err:   pl011@9000000
> >>>
> >>> Net:   e1000: 52:54:00:12:34:56
> >>>
> >>>        eth0: e1000#0
> >>>
> >>> Hit any key to stop autoboot:  0
> >>>
> >>> starting USB...
> >>>
> >>> No working controllers found
> >>>
> >>> USB is stopped. Please issue 'usb start' first.
> >>>
> >>> scanning bus for devices...
> >>>
> >>>
> >>>
> >>> Device 0: unknown device
> >>>
> >>>
> >>>
> >>> Device 0: unknown device
> >>>
> >>> starting USB...
> >>>
> >>> No working controllers found
> >>>
> >>> BOOTP broadcast 1
> >>>
> >>> BOOTP broadcast 2
> >>>
> >>> BOOTP broadcast 3
> >>>
> >>> DHCP client bound to address 10.0.2.15 (1004 ms)
> >>>
> >>> Using e1000#0 device
> >>>
> >>> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
> >>>
> >>> Filename 'boot.scr.uimg'.
> >>>
> >>> Load address: 0x40200000
> >>>
> >>> Loading: *
> >>>
> >>> TFTP error: 'File not found' (1)
> >>>
> >>> Not retrying...
> >>>
> >>> BOOTP broadcast 1
> >>>
> >>> BOOTP broadcast 2
> >>>
> >>> BOOTP broadcast 3
> >>>
> >>> DHCP client bound to address 10.0.2.15 (1001 ms)
> >>>
> >>> Using e1000#0 device
> >>>
> >>> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
> >>>
> >>> Filename 'boot.scr.uimg'.
> >>>
> >>> Load address: 0x40400000
> >>>
> >>> Loading: *
> >>>
> >>> TFTP error: 'File not found' (1)
> >>>
> >>> Not retrying...
> >>>
> >>> => tftp 0x40000000 dtb.dtb
> >>>
> >>> Using e1000#0 device
> >>>
> >>> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
> >>>
> >>> Filename 'dtb.dtb'.
> >>>
> >>> Load address: 0x40000000
> >>>
> >>> Loading:
> >>> #################################################################
> >>>
> >>> #########
> >>>
> >>> 963.9 KiB/s
> >>>
> >>> done
> >>>
> >>> Bytes transferred = 1048576 (100000 hex)
> >>>
> >>> => tftp 0x40200000 Image
> >>>
> >>> Using e1000#0 device
> >>>
> >>> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
> >>>
> >>> Filename 'Image'.
> >>>
> >>> Load address: 0x40200000
> >>>
> >>> Loading:
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> #################################################################
> >>>
> >>> ###################################
> >>>
> >>> 10 MiB/s
> >>>
> >>> done
> >>>
> >>> Bytes transferred = 26489344 (1943200 hex)
> >>>
> >>> => tftp 0x42000000 initramfs.cpio.gz
> >>>
> >>> Using e1000#0 device
> >>>
> >>> TFTP from server 10.0.2.2; our IP address is 10.0.2.15
> >>>
> >>> Filename 'initramfs.cpio.gz'.
> >>>
> >>> Load address: 0x42000000
> >>>
> >>> Loading:
> >>> #################################################################
> >>>
> >>> #################
> >>>
> >>> 1 MiB/s
> >>>
> >>> done
> >>>
> >>> Bytes transferred = 1169894 (11d9e6 hex)
> >>>
> >>> => booti 0x40200000 0x42000000 0x40000000
> >>>
> >>> Moving Image from 0x40200000 to 0x40280000, end=41c44000
> >>>
> >>> Wrong Ramdisk Image Format
> >>>
> >>> Ramdisk image is corrupt or invalid
> >>>
> >>>
> >>>
> >>> At the end, it says "Ram disk image is corrupt or invalid". What am
> >>> I doing wrong?
> >>>
> >>> I tried with un-gzipped file of initramfs, the same. Should I use
> >>> real initrd format(dd image)?
> >>>
> >>> Any help will be very much appreciated.
> >>>
> >>>
> >>>
> >>> Thank you!
> >>>
> >>> Chan Kim
> >>>
> >>>
> >>>
> >>>
> >>
> >
> >
> >
> >
> >
> 





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-10-22  1:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13  5:44 please help, "Ram disk image is corrupt or invalid" (qemu virt machine, arm64) Chan Kim
2021-10-19  7:32 ` François Ozog
2021-10-19  9:59   ` Chan Kim
2021-10-19 10:43     ` Jaehoon Chung
2021-10-19 12:31       ` Chan Kim
2021-10-19 22:40         ` Jaehoon Chung
2021-10-22  1:33           ` Chan Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.