How do I create a proper ramdisk.img for linux 4.9?

Hi there,

I’m trying to recreate the ramdisk.img used in the Vim_Ubuntu-mate-16.04_Linux-4.9_V170605 firmware. Unfortunately the resulting image is too large (~38M), as far as I am aware it must be 20M or smaller to work on the Khadas VIM.

Here are the commands I used:

cd linux
git checkout ubuntu-4.9
make ARCH=arm64 kvim_defconfig
make -j8 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image kvim.dtb modules
cd ..
cd initrd
make
cd ..
./utils/mkbootimg --kernel linux/arch/arm64/boot/Image --ramdisk images/initrd.img -o images/ramdisk.img

My ultimate goal is to create a flashable update.img completely from scratch. Any suggestions or examples would be greatly appreciated.

Best,
Michael

Hi mmeyer,

You can try the following instructions to create a ramdisk.

  • log in to VIM ubuntu mate shell

  • using mkinitramfs command to create initrd

root@Khadas:~# mkinitramfs -o /boot/initrd.img 4.9.26
  • copy /boot/initrd.img to your host pc directory images

  • then use this initrd instead of the one make from initrd directory to create ramdisk

./utils/mkbootimg --kernel linux/arch/arm64/boot/Image --ramdisk images/initrd.img -o images/ramdisk.img

Thanks!

Thank you for the help, but now I’m really curious as to why this results in a smaller ramdisk.img.
Is the khadas initrd repo GitHub outdated, or did I just not build it properly (e.g. no compression)?

Hi mmeyer,

Actually,we use mkinitramfs to build initrd now.And suggest you to use mkinitramfs to build initrd,too.

Thanks!