Using ramdisk in hikey

Hi all,

Does anyone know how to use ramdisk in hikey. Currently I have kernel image and dtb in SD card. How can I use ramdisk as my root file system? Steps would be helpful


I routinely run my hikey from a ramdisk. There’s not really anything to do… the default boot already uses an initrd so you just replace that initrd.img with one of your own.

Hi Daniel,

How can I create my own initrd? Or can we edit the existing initrd image so that I can add some files to it. I am using u-boot ,so how can I load ramdisk from u-boot? Could you please explain more


I use buildroot to generate the initial RAM disk. My .config file (which is known to generate a good image for AArch64 devices) is here: . Buildroot build system works a lot like the linux kernel builds (although there is no need to set CROSS_COMPILE). Just copy that .config into the buildroot top-level directory, run make olddefconfig and then make.

As far as loading an initial ramdisk using u-boot take a look at the examples in the documentation:;a=blob;f=doc/README.distro#l94

Thank u Daniel. But uboot guide seems to be not detailed for hikey. I wanted to know how do we setup bootargs for hikey since we need to give load address for ramdisk . What would be that load address and how do we specify root in bootargs. Shouldn’t it be something like root=/dev/ram ?


The whole point of distro boot protocol is that is does not need to be detailed for the hikey, it is a generic protocol that means the user need not worry about any hikey specifics. The distro boot code gets the ramdisk load address from a u-boot environment variable and use this to load and boot the kernel. These environment variables are also documented in README.distro:

So, if you use the distro boot protocol to load the kernel, device tree and initramfs then there is no need for you to worry about the ramdisk load address. However if you are deliberately avoiding the distro boot protocol, you can also use the these environment variables to figure out safe load addresses for hikey.

You will need to provide some kernel boot arguments, but these are the same as when you boot debian so you should copy them from there… I don’t have them to hand since all my scripts work by editing grub.cfg with scripts leaving the original arguments untouched.

Note you don’t need anything like root=/dev/ram . When you boot the kernel with an initramfs then the ramdisk is mounted and entered regardless of the presence/absense/contents of the root= argument. In fact when you have an initramfs if is the initramfs rather than the kernel that becomes responsible for parsing root= and mounting an appropriate filesystem. So, if you have an initramfs that is the rootfs (so doesn’t need to mount a rootfs) then the root= argument will be ignored.