Generating a rootfs.img for eMMC

Hi, I am a beginner at building Operating Systems so please bear with me.

I am using the SnapDragon 410c board.

I am using buildroot to generate my kernel. Buildroot has an option to build different rootfs types(e.g. *tar, *cpio, *.romfs, etc…). I use fastboot to flash the boot image and rootfs(generated from buildroot) to the emmc. I also use Linario’s initrd to build the boot.img. When I flash everything and boot, It gets to the ramfs and looks for the rootfs but could not find it. As a result, it goes back to the initramfs shell.
Here is the log :

Begin: Running /scripts/local-premount ... done.
mount: mounting /dev/disk/by-partlabel/rootfs on /root failed: Invalid argument
Begin: Running /scripts/local-bottom ... done.
Begin: Running /scripts/init-bottom ... mount: mounting /dev on /root/dev failed: No such file or directory
mount: mounting /sys on /root/sys failed: No such file or directory
mount: mounting /proc on /root/proc failed: No such file or directory
Target filesystem doesn't have requested /sbin/init.
    No init found. Try passing init= bootarg. 
    BusyBox v1.22.1 (Ubuntu 1:1.22.0-9ubuntu1) built-in shell (ash)
Enter 'help' for a list of built-in commands.


I have tried flashing different types of rootfs except for .img type.
How do I generate a rootfs.img file? (similar to linario’s rootfs)?

Could you fill in a few gaps? Things like which board you are using, which rootfs file you flashed and what “gets stuck” means (what messages are you seeing on the UART)?

Apologies, I have edited the post to contain all the information that you have requested. Hopefully that fills in all the gaps. Just tell if there is anything you want to know.

So… buildroot is unusual in that you can use it as your initramfs (e.g. run everything from RAM… lose any changes on reset) or as a normal filesystem.

You are currently attempting the second one and the problem you have is that the initramfs doesn’t recognise the new rootfs and therefore fails to mount it (see the error message linked to /dev/disk/by-partlabel/rootfs). To have a recognisable filesystem you should ensure BR2_TARGET_ROOTFS_EXT2 is set (see Filesystem Imagesext2/3/4 root filesystem) and that you are writing a filesystem image ending *.ext4 (I think) using fastboot.

1 Like

Thank you very much Danielt. I have went pass through ramfs! Although I am having new problem now. It is now getting stuck in runlevel 3 where it says “INIT: no more processes left in this runlevel”. As I have read around, after runlevel 3, it should be proceeding straight into the getty login prompt.

I’m afraid its a little hard for me to “visualize” without seeing the full boot log. Can you put the logs it in a pastebin somewhere (or github gist if you prefer)? Actually whilst you’re at it can you share your .config too? buildroot is pretty flexible and there may be other missing config options.

Thanks again for your interest.
Here is the config file :

and here is the log :

Hope that helps.

I , or rather my friend, found a solution. We were not sure about the reason why it worked but all we did was use rootfs.ext2.