This how-to describes the process to build a RAM disk or init.rd image. This is a part of the Xilinx design flow described in Xilinx Open Source Linux.
Task Dependencies (Pre-requisites)
Input Files Required
- ramdisk.image.gz (required for Zynq AP SoC)
- initramfs.cpio.gz (required for MicroBlaze and PowerPC)
Output Files Produced
There are two types of formats being used for root filesystems. Before Vivado/SDK version 2013.1, Linux for Zynq AP SoC used an initial ramdisk/initrd (ramdisk.image.gz); Since then, the Zynq uses initramfs. MicroBlaze and PowerPC are using initramfs (initramfs.cpio.gz).
Prebuilt images can be found here:arm_ramdisk.image.gz
: for Zynq AP SoC (ARM) systems. (initrd)microblaze-le_minimal.cpio.gz
: for AXI (Little Endian) MicroBlaze systems. (initramfs)microblaze_minimal.cpio.gz
f: or PLB (Big Endian) MicroBlaze systems. (initramfs)microblaze_complete.cpio.gz
: for PLB (Big Endian) MicroBlaze systems. (initramfs)
Modifying the root filesystem
To modify an initial ramdisk:
1. Extract the initrd image from the gzip archive.
2. Mount the initrd image.
3. Make changes in the mounted filesystem.
4. Unmount the initrd image and compress the image.
To create an initrd from scratch, tools such as Buildroot or Yocto may be used to populate the filesystem (with BusyBox, tools, etc.).
Alternatively, an empty initrd may be created and then populated with the desired filesystem contents as specified above. To create an empty (8MB) initrd:
To modify an initramfs:
1. Extract the contents of the cpio.gz archive.
2. Make changes to the filesystem.
3. Repack the filesystem into a cpio.gz archive.
To create an initramfs from scratch, tools such as Buildroot or Yocto may be used to populate the filesystem (with BusyBox, tools, etc.).
Alternatively, initramfs image may be created by populating a directory with the desired filesystem contents and packing these contents into a cpio.gz archive as mentioned above.
Wrapping the image with a U-Boot header
For Zynq SoC devices the ramdisk.image.gz needs to be wrapped with a U-Boot header in order for U-Boot to boot with it. The architecture option (-A) will be 'arm' for Zynq7000 and 'arm64' for ZynqUS+ devices.
For MicroBlaze and PowerPC, the initramfs.cpio.gz presently needs to be embedded into the kernel (see Build Linux Kernel
Unwrap the image with the u-boot header
Check File Type