How to run core-image-tiny-initramfs.cpio.gz (or ramfs / ramdisk.gz) from an SD card 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 i.MX 8M | i.MX 8M Mini | i.MX 8M Nano Re: How to run core-image-tiny-initramfs.cpio.gz (or ramfs / ramdisk.gz) from an SD card Hi @goodspeed , @ScottSJ , @kimease , Currently working on i.MX8M Plus EVK board and would like to boot file system using initramfs (ramfs.img / ramfs.cpio.gz) as the root filesystem, loaded directly from an SD card with boot partition only(FAT32). The SD card does not contain a separate root filesystem partition. Current Setup SD card contains only one FAT32 boot partition Files present on the FAT32 partition: Image(U-boot+kernel) Device Tree Blob (.dtb) initramfs image(cpio.gz) Below are the exact U-Boot commands and behavior. U-Boot Commands Used u-boot=> setenv bootargs console=ttymxc1,115200 root=/dev/ram rw u-boot=> fatload mmc 1:1 ${loadaddr} Image_copy.gz 13450466 bytes read in 282 ms (45.5 MiB/s) u-boot=> fatload mmc 1:1 ${fdt_addr} imx8mp-evk.dtb 82784 bytes read in 4 ms (19.7 MiB/s) u-boot=> fatload mmc 1:1 ${ramdisk_addr_r} core-image-minimal-initramfs-imx8mp-ddr4-evk.cpio.gz 12602736 bytes read in 264 ms (45.5 MiB/s) u-boot=> booti ${loadaddr} ${ramdisk_addr_r}:${filesize} ${fdt_addr} After executing the booti command, the kernel starts booting, but it does not mount or use the initramfs (cpio.gz) as root filesystem. I have attached the full kernel boot log for reference. Questions What could be the possible reasons for the kernel not loading the initramfs (cpio.gz) even though it is correctly loaded into memory by U-Boot? Are there any mandatory kernel configuration options required for initramfs support that I should verify? Is the bootargs configuration correct for booting with initramfs on i.MX8M Plus, or are additional parameters required? Re: How to run core-image-tiny-initramfs.cpio.gz (or ramfs / ramdisk.gz) from an SD card 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. Re: How to run core-image-tiny-initramfs.cpio.gz (or ramfs / ramdisk.gz) from an SD card 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-rootfs-in-spi-nor-demo/ta-p/1663994 Re: How to run core-image-tiny-initramfs.cpio.gz (or ramfs / ramdisk.gz) from an SD card 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.) Re: How to run core-image-tiny-initramfs.cpio.gz (or ramfs / ramdisk.gz) from an SD card 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. Re: How to run core-image-tiny-initramfs.cpio.gz (or ramfs / ramdisk.gz) from an SD card Hello, Is there any documentation or information how to use the supplied ramfs recipes? Thanks, Scott Re: How to run core-image-tiny-initramfs.cpio.gz (or ramfs / ramdisk.gz) from an SD card 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. Re: How to run core-image-tiny-initramfs.cpio.gz (or ramfs / ramdisk.gz) from an SD card Hello, Does anyone have an answer? Is there documentation for using the supplied core-image-tiny-initramfs? Thanks, Scott Re: How to run core-image-tiny-initramfs.cpio.gz (or ramfs / ramdisk.gz) from an SD card 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 Re: How to run core-image-tiny-initramfs.cpio.gz (or ramfs / ramdisk.gz) from an SD card 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
View full article