How to run core-image-tiny-initramfs.cpio.gz (or ramfs / ramdisk.gz) from an SD card

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to run core-image-tiny-initramfs.cpio.gz (or ramfs / ramdisk.gz) from an SD card

1,324 次查看
ScottSJ
Contributor II

Hello,

Using an 8Mplus eval board, we need to run core-image-tiny-initramfs or a ramfs from SD card. I can build the image but can't find the correct uboot commands to use it. I see references in other posts to core-image-tiny-initramfs.cpio.gz but those posts don't list the uboot commands.

I've tried these commands:
setenv loadramdisk "load mmc 2:2 0x80000000 /boot/ramdisk.gz"
setenv ramargs "setenv bootargs ${mmcargs} root=/dev/ram0 rw rootfstype=ext4 ramdisk_size=0x20000000"
setenv ramboot "echo Booting from ramdisk ...; run ramargs; bootz ${loadaddr} 0x80000000 ${fdt_addr_r}"
setenv bootcmd "run loadimage loadfdt loadramdisk ramboot"

I always get the error message "zimage: Bad magic!"

I suspect the problem is the address. According to the sources for imx8mp-evk.dtb the ram address should be valid but there are no messages from uboot.

 

Thanks,
Scott

标签 (1)
0 项奖励
9 回复数

1,236 次查看
goodspeed
Contributor II

If you check the u-boot help, you can easily find how to use ramdisk.

 

u-boot=> help booti
booti - boot Linux kernel 'Image' format from memory

Usage:
booti [addr [initrd[:size]] [fdt]]
- boot Linux 'Image' stored at 'addr'
The argument 'initrd' is optional and specifies the address
of an initrd in memory. The optional parameter ':size' allows
specifying the size of a RAW initrd.
Since booting a Linux kernel requires a flat device-tree, a
third argument providing the address of the device-tree blob
is required. To boot a kernel with a device-tree blob but
without an initrd image, use a '-' for the initrd argument.

0 项奖励

1,253 次查看
ScottSJ
Contributor II

Hello,

Does anyone have an answer? Is there documentation for using the supplied core-image-tiny-initramfs?

Thanks,
Scott

0 项奖励

1,293 次查看
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

If you just want to build uboot, why don't use stand alone uboot ? for more detailed information, pls refer to the chapter Chapter 3 Porting U-Boot.

https://www.nxp.com/docs/en/user-guide/IMX_PORTING_GUIDE.pdf

 

Regards

 

0 项奖励

1,192 次查看
ScottSJ
Contributor II

Hello,

Is there any documentation or information how to use the supplied ramfs recipes?

 

Thanks,
Scott

0 项奖励

1,181 次查看
goodspeed
Contributor II

I had already told you!!!
And It is from u-boot document. It is a document!!!

If you check the u-boot help, you can easily find how to use ramdisk.

 

u-boot=> help booti
booti - boot Linux kernel 'Image' format from memory

Usage:
booti [addr [initrd[:size]] [fdt]]
- boot Linux 'Image' stored at 'addr'
The argument 'initrd' is optional and specifies the address
of an initrd in memory. The optional parameter ':size' allows
specifying the size of a RAW initrd.
Since booting a Linux kernel requires a flat device-tree, a
third argument providing the address of the device-tree blob
is required. To boot a kernel with a device-tree blob but
without an initrd image, use a '-' for the initrd argument.

If you check the uuu script 'example_kernel_emmc.uuu' in the binary release tar ball, you will find how to use the ramdisk.

FB: ucmd setenv fastboot_buffer ${loadaddr}
FB: download -f _Image
FB: ucmd setenv fastboot_buffer ${fdt_addr}
FB: download -f _board.dtb
FB: ucmd setenv fastboot_buffer ${initrd_addr}
FB: download -f _initramfs.cpio.gz.uboot
#FB: ucmd setenv bootargs console=${console},${baudrate} earlycon=${earlycon},${baudrate}
FB: acmd ${kboot} ${loadaddr} ${initrd_addr} ${fdt_addr}

FB: acmd ${kboot} ${loadaddr} ${initrd_addr} ${fdt_addr}
u-boot=> help booti
booti - boot Linux kernel 'Image' format from memory

Usage:
booti [addr [initrd[:size]] [fdt]]


kboot here is booti
loadaddr here is addr
initrd_addr here is initrd and it is ramdisk and it could be core-image-tiny-initramfs.cpio.gz
fdt here is fdt_addr


Again, I had already told you everything!!!

"without an initrd image, use a '-' for the initrd argument."
That is why you often see the '-' in boot command line with linux kernel and device tree dts. 

Because the most of time, no need ramdisk.

It is just a u-boot basic knowledge. Very basic. 

 

 

 

 

 

 

0 项奖励

1,077 次查看
ScottSJ
Contributor II

It's ok if you don't know where to find documentation. If this is "basic knowledge", there should be documentation available somewhere but I haven't found anything after many web searches.

I'm well aware of the various "boot" commands and have used them on other platforms. I've reviewed the source code and other boot configurations. I'm looking for the specific values and parameters needed for the nxp platform. This should be available with the "core-image-tiny-initramfs" build, but I can't find the steps to use that image. (I do have the steps to use a regular rootfs booting on an SD card, but we need both environments.)

0 项奖励

1,068 次查看
kimease
Contributor II

maybe this demo can help you. 

It is just a u-boot booti command. You can change the booti to bootz according to your kernel image format(Image, zImage, etc)

booti ${loadaddr} ${initrd_addr} ${fdt_addr}

The initrd_addr  is location/address of uramdisk_boot.rootfs.aarch64.img ramdisk. 

should be core-image-tiny-initramfs.cpio.gz in your case.

|-- 0001-all-in-spi-demo-lf-5.10.72-2.2.0.patch --- patch for this demo
|-- demo_binary
| |-- flash.b0.bin --- b0 bootloader
| |-- flash.bin --- c0 bootloader
| |-- Image-imx8qxpc0mek.bin --- Linux kernel
| |-- imx8qxp-mek.dtb --- device tree
| |-- uramdisk_boot.rootfs.aarch64.img --- ram disk
| |-- uuu.qspi.all.b0.uuu --- uuu script for b0
| `-- uuu.qspi.all.uuu --- uuu script for c0
`-- readme.txt --- this file

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/all-bootloader-device-tree-Linux-kernel-...

 

0 项奖励

1,043 次查看
kimease
Contributor II

I notice you said "I do have the steps to use a regular rootfs booting on an SD card, but we need both environments". 

Suggest you can read the page 35 of  SWUpdate OTA i.MX8MM EVK_rev3.pdf

SWUpdate OTA i.MX8MM EVK / i.MX8QXP MEK - NXP Community

 

Maybe that is what you want.

1.png

0 项奖励

1,290 次查看
ScottSJ
Contributor II

Hello,

We need to boot multiple kernels and/or ramfs from a single uboot. The target can be determined in uboot code, which can set the appropriate environment variables. We've done this on other systems so it should be able to be done here.

We already have the code to detect and use different kernels. We need to steps to boot a ramfs.

 

Thanks,
Scott

0 项奖励