Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2591323
  • 博文数量: 333
  • 博客积分: 4817
  • 博客等级: 上校
  • 技术积分: 4413
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-28 10:51
文章分类

全部博文(333)

文章存档

2017年(20)

2016年(57)

2015年(27)

2014年(20)

2013年(21)

2012年(164)

2011年(24)

分类: 嵌入式

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:

  1. Disable automatic kernel configuration
    $ petalinux-config
    Image Packaging Configuration ---> Root filesystem type = SD card
    Auto Config Settings ---> [ ] kernel autoconfig
  2. Enable INITRAMFS support in the kernel configuration, but leave the INITRAMFS source file field empty
    $ petalinux-config -c kernel
    General setup --->
        [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
        () Initramfs source file(s)
  3. Compile and generate BOOT.BIN and rootfs.cpio
    $ 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.



阅读(1788) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~