cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
6,119 Views
Registered: ‎10-08-2016

Which Ramdisk to use?

Jump to solution

I'm working through the process of building a Linux boot SD from scratch following the gude at http://www.wiki.xilinx.com/Getting+Started.  All is going as documented until I get to the root file system, described at http://www.wiki.xilinx.com/Build+and+Modify+a+Rootfs.  There, I am given a choice among four prebuilt RFS images, none of which seem to apply.  I'm using SDK 2015.4.  Here is the paragraph that I'm worried about:

 

Task Description

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).

 

The four choices are the initrd image and three initramfs images, all three of which are said to be targeted to Microblaze, which is not my target device.  So I'm left believing that none of those are useful to me.  Is that so?

 

Then, farther down, I see this: "To create an initramfs from scratch, tools such as Buildroot or Yocto...".  So it looks like I need to use either Buildroot or Yocto and "roll my own."  is that so?

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Explorer
Explorer
10,794 Views
Registered: ‎10-08-2016

Re: Which Ramdisk to use?

Jump to solution

Thanks to both @rfs613 and @jeffdaq.  I reached the same conclusion after finding simpler instructions for making a bootable SD disk from the downloaded pre-built, and I got that working last night.  I don't think I'll ever need to "go down that rabbit hole" now.  I now need to work out how to get my own apps, supporting libraries, scripts, and data onto an SD card.  The card also needs to be formatted for saving data to it for later off-line processing.  I'm sure that's documented somewhere; hopefully I'll be able to figure that out quicker than I did the boot image.

View solution in original post

0 Kudos
8 Replies
Highlighted
Scholar
Scholar
6,090 Views
Registered: ‎05-28-2013

Re: Which Ramdisk to use?

Jump to solution

Of the two methods, initramfs is the more modern approach, it makes better use of RAM compared with an initrd. These concepts are not specific to Zynq, they apply to pretty much any Linux. Try googling for "linux initramfs vs initrd" for many more details. This will supplement the "Build and Modify a Rootfs" wiki page. You can boot your system with either method, although it is usually simplest to "go with the flow" of whatever has already been done.

 

You didn't mention which device you are using, but if it is a Zynq, you'll want the ARM image as a starting point. First step would be to make sure you can boot the pre-built image on your hardware. Then you can try unpacking the image, and re-packing it without making any changes, and check that you can still boot it. Thereafter you can start making changes. Don't worry to much about initramfs versus initrd at this point, you can convert between them if necessary (eg. unpack the ramdisk, and then re-pack it as a cpio archive for initramfs).

 

You mentioned wanting to build "from scratch", but exactly how far down the rabbit hole are you looking to go? The wiki page describes how you can modify an existing initramfs/initrd. This is good for people just getting their feet wet, as they can selectively replace (or add) programs without to much risk of something going wrong.

 

At the other end of the spectrum would be building everything from source code, and then organizing that into a root filesystem along with all the /dev nodes, config files, and so on. This is the most flexible and lets you fine tune almost anything, however it can be a lot harder to get it to work the first time. Projects such as buildroot, yocto, openEmbedded, etc, exist to facilitate this process.

 

Hope this helps somewhat...

Highlighted
Explorer
Explorer
6,072 Views
Registered: ‎11-22-2015

Re: Which Ramdisk to use?

Jump to solution

  If you really want to build everything from scratch you will have to use buildroot or yocto.  If you want to make a few changes to the ramdisk than it is easier to start with the pre-built.  I took the pre-built 2015.4 ramdisk and pushed it to a git repo, this allowed me to track any changes I made.  

  This has worked great but I'm not comfortable using pre-built binaries so I am moving to 2016.4 and using yocto to build my rootfs from scratch.  This means I have to create a bunch of recipes to add support for all my modification and is not a simple task.  But this does make it very simple to add new features to the rootfs and moving to new versions in the future.

 

jeff

 

Highlighted
Explorer
Explorer
10,795 Views
Registered: ‎10-08-2016

Re: Which Ramdisk to use?

Jump to solution

Thanks to both @rfs613 and @jeffdaq.  I reached the same conclusion after finding simpler instructions for making a bootable SD disk from the downloaded pre-built, and I got that working last night.  I don't think I'll ever need to "go down that rabbit hole" now.  I now need to work out how to get my own apps, supporting libraries, scripts, and data onto an SD card.  The card also needs to be formatted for saving data to it for later off-line processing.  I'm sure that's documented somewhere; hopefully I'll be able to figure that out quicker than I did the boot image.

View solution in original post

0 Kudos
Highlighted
Explorer
Explorer
6,041 Views
Registered: ‎11-22-2015

Re: Which Ramdisk to use?

Jump to solution

  As I mentioned, I started a git repo with the pre-built ramdisk and then added scripts directly to that repo.  However, if you do something like this you need to setup all your external builds to install into that ramdisk repo before creating the ramdisk image.  Also, if you want to add some common packages like ntp and gpsd, you have to figure out how to build and install all dependancies.   This is one of the reasons I'm moving to generating my own rootfs with yocto.  It's simple to added existing packages to your rootfs.

  When you create the SD it will have two partitions, one for boot and one for the rootfs.  If you are using a ramdisk then the rootfs partition is empty.  If you decide to modify your system to keep the rootfs on the SD then you would probably need a 3rd partition for data.

 

jeff

0 Kudos
Highlighted
Explorer
Explorer
6,020 Views
Registered: ‎10-08-2016

Re: Which Ramdisk to use?

Jump to solution

Thanks.  I just might be back with other questions. :)

0 Kudos
Highlighted
Visitor
Visitor
2,825 Views
Registered: ‎12-29-2017

Re: Which Ramdisk to use?

Jump to solution

Hallo @daryllee,

I have Problem like urs 

I am working with Zynq Ultrascale+

so please Could u tell which file should I use or the Steps to Create new initramfs.cpio.gz file

thank u very much

0 Kudos
Highlighted
Explorer
Explorer
2,817 Views
Registered: ‎10-08-2016

Re: Which Ramdisk to use?

Jump to solution

I haven't thought about this in thirteen months.  As indicated in the thread, I abandoned the path I was going down and just used the petalinux-package commands straight from the user guide, adapted to my local paths and filenames.  I don't think about ramdisk now, so I can't be much help to you.

 

Best wishes!

0 Kudos
195 Views
Registered: ‎12-29-2019

Re: Which Ramdisk to use?

Jump to solution

Hi ,

Are you able to create initramfs.cpio.gz file if you are please share me it how because, i am unable to save the files when i reboot my system.

 

0 Kudos