全部博文(333)
分类: 嵌入式
2016-10-10 15:52:38
Hi,
when configuring my PetaLinux project with
Image Packaging Configuration ---> Root filesystem type = SD card
and building the project and then trying to generate the rootfs CPIO using the command
$ petalinux-package --image -c rootfs --format initramfs
which I do according to UG1144 (Configuring SD Card ext filesystem Boot), I get the error
[INFO ] package rootfs.cpio to /tmp/petalinux/images/linux ERROR: Linux kernel gen_init_cpio /tmp/petalinux/build/linux/kernel/usr/gen_init_cpio doesn't exits! Please build Linux kernel first! make[1]: *** [package-rootfs-cpio] Fehler 255 make: *** [package-rootfs-initramfs] Fehler 2 ERROR: Failed to package component linux/rootfs
It looks like this is due to the fact, that gen_init_cpio doesn't get built if the kernel option CONFIG_BLK_DEV_INITRD is not set. That kernel option, however, gets (and needs to be) automatically disabled as soon as the root filesystem is not an initramfs.
As a quick & dirty fix I built the necessary tool using the following command from my PetaLinux project directory
$ gcc components/linux-kernel/linux-xlnx/usr/gen_init_cpio.c -o build/linux/kernel/usr/gen_init_cpio
When executing the petalinux-package command again, it works flawlessly. I am using a custom kernel (not the stock PetaLinux kernel, but a slightly modified variant of the Xilinx kernel from GitHub) and I am using PetaLinux v2015.4.
I there any way to properly get around this problem?
Thanks,
Sven
I found a solution that appears to be working consistently:
$ petalinux-config Image Packaging Configuration ---> Root filesystem type = SD card Auto Config Settings ---> [ ] kernel autoconfig
$ petalinux-config -c kernel General setup ---> [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support () Initramfs source file(s)
$ petalinux-build $ petalinux-package --boot --fpga="$(ls subsystems/linux/hw-description/*.bit)" --u-boot $ petalinux-package --image -c rootfs --format initramfs
The only open issue I now have is how to create an SD card image without root privileges.