AnsweredAssumed Answered

Boot with initramfs

Question asked by ranshalit on Jan 18, 2018
Latest reply on Feb 5, 2018 by Diego Dorta

Hello,

 

I am trying to boot initramfs.

 

1. I first validate that my rootfs starts correctly when booting from sd

I use the following booargs, and it boots without issues from sd.

  • setenv boot "ext2load mmc 1:1 && ext2load mmc 1:1 $fdtaddr $fdtfile && setenv bootargs $mtdparts $params  root=mmcblk0p1 ro && bootm $loadaddr - $fdtaddr"
  • run boot

 

2. I then created initramfs and loaded the file with tftp to memory:

 

  •  sh -c 'cd rootfs/ && find . | cpio -H newc -o' | gzip -9 > new_initramfs.cpio.gz
  •  mkimage -A arm -O linux -T ramdisk -C none -a 0x40800000 -n "Root Filesystem" -d ./new_initramfs.cpio.gz ./initramfs.cpio.gz.uboot
  •  tftp 42000000 initramfs.cpio.gz.uboot;

 

      

3. then I boot from u-boot with simple modification in bootargs which takes care to find rootfs in memory instead of searching rootfs in sd files.

  • setenv boot "ext2load mmc 1:1 && ext2load mmc 1:1 $fdtaddr $fdtfile && setenv bootargs $mtdparts $params root=/dev/ram0 rw initrd=0x42000000,20M ramdisk_size=100000 && bootm $loadaddr - $fdtaddr"

 

 

Yet, I get failures on boot:

 

VGEN2: disabling
VGEN5: disabling
ALSA device list:
#0: imx-spdif
#1: imx-hdmi-soc
List of all partitions:
0100 100000 ram0 (driver?)
0101 100000 ram1 (driver?)
0102 100000 ram2 (driver?)
0103 100000 ram3 (driver?)
0104 100000 ram4 (driver?)
0105 100000 ram5 (driver?)
0106 100000 ram6 (driver?)
0107 100000 ram7 (driver?)
0108 100000 ram8 (driver?)

..

No filesystem could mount root, tried: ext3 ext2 ext4 cramfs vfat
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
CPU2: stopping
CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.1.31-imx6+ #1
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)

 

 

I also noticed the following in kernel boot:

rootfs image is not initramfs (junk in compressed archive); looks like an initrd
Freeing initrd memory: 20480K (b2000000 - b3400000)

 

 

I have also checked kernel .config and it seems to be OK:

CONFIG_BLK_DEV_INITRD=y
CONFIG_RD_GZIP=y

 

4. I then tried to change bootargs as following (removed root parameter, and bootm with 3 parameters)

sesetenv boot "ext2load mmc 1:1 && ext2load mmc 1:1 $fdtaddr $fdtfile && setenv bootargs $mtdparts $params  && bootm $loadaddr 0x42000000 $fdtaddr"

Now I get "Waiting for root device ..." , but nothing happens......

smarc_usb0: disabling
VGEN2: disabling
VGEN5: disabling
ALSA device list:
#0: imx-spdif
#1: imx-hdmi-soc
Waiting for root device ...

 

 

I tried many combinations, and variables, but nothing helped.

Can anyone please help with it ?

 

Thank you,

Ran

Outcomes