Can I place the root filesystem on external storage?


#1

I use Linaro Debian 16.06 on DragonBoard410c, And I want to place rootfs on uSD card.

I’ve created the basic root filesystem of Debian Jessie in uSD card by debootstrap.
but, there is no setting in /etc/fstab, and I can’t find bootloader setting…
How do I modify the boot loader setting and the root filesystem setting ?
In the first place, Can I place the rootfs on uSD card ?

Thanks


#2

Hi Hiroki,

Yes it is possible :slight_smile:

You need to specify the rootfs location in Command line parameters passed to kernel. You can find the kernel compilation instructions in release notes: http://builds.96boards.org/releases/dragonboard410c/linaro/debian/latest/

Mention the rootfs location in following command found in release notes:

–cmdline “root=/dev/disk/by-partlabel/rootfs rw rootwait console=ttyMSM0,115200n8”

For instance, if RFS is placed in first partition of your SD card then:

–cmdline “root=/dev/mmcblk1p1 rw rootwait console=ttyMSM0,115200n8”

Then kernel will try to find root file system in the partition you’ve specified (mmcblk1p1) in the above example and boot using that.

Hope this helps!

Thanks,
Mani


#3

Hi Mani,

Thank you for your reply.

I understand it :grinning:
I’ll try it!!

Thanks.
Hiroki


#4

Hi Mani,

I have compiled the image files (boot–4.9-r0-dragonboard-410c-20170803052121.img, dt–4.9-r0-dragonboard-410c-20170803052121.img and core-image-base-dragonboard-410c-20170803052121.rootfs.tar.gz) with Yocto project environment. I have followed the instructions from vary sources but I am still not able to create bootable image for my dragonboard 410c. The resources I was using:

  1. https://github.com/ndechesne/meta-qcom.
  2. https://github.com/96boards/documentation/blob/master/ConsumerEdition/DragonBoard-410c/Guides/GPT.md

I was spending last week and I am bit desperate for not being able to make it happened.

Please provide some helps.

Kind regards

Vincent


#5

Hello Vincent,

So you have both boot image and rootfs file generated by Yocto build!. Now you need to partition SD card by following the instructions [1]. After that, you should have SD card formatted with specific GPT as well as bootloaders contained in respective partitions.

Prepare the boot image with corresponding bootargs as shown in guide[2]

Note: You need to extract the rootfs then convert it into sparse image so that you can use ‘dd’ command to flash onto SD card.

Following command can be used to prepare sparse rootfs:

$ tar -xvf core-image-base-dragonboard-410c-20170803052121.rootfs.tar.gz
$ img2simg core-image-base-dragonboard-410c-20170803052121.rootfs rootfs.img

Now flash rootfs.img and boot.img as shown in guide[2]

Hope this helps!

Regards,
Mani

[1] https://github.com/96boards/documentation/blob/master/ConsumerEdition/DragonBoard-410c/Guides/GPT.md#create-the-sd-card
[2] https://github.com/96boards/documentation/blob/master/ConsumerEdition/DragonBoard-410c/Guides/GPT.md#boot-an-openembedded-image-from-sd-card


#6

Hi Mani,

Thank you for your response and the valuable links that point me to the
right resources.

Where should I execute the command of abootimg -u boot-XXX.img -c
"cmdline=root=/dev/mmcblk1p9 rw rootwait console=ttyMSM0,115200n8" ? in the
host machine, there is no mmcblk1p9 under /dev, the mmcblk1p9 only appeared
in the dragonboard410c embedded system.

Please advise.

Regards

Vincent


#7

That command should be executed in host machine.

Basically in that command, you are specifying the rootfile system location to kernel. Which means ‘/dev/mmcblk1p9’ on Dragonboard will contain the root file system.

It need not be present on your host :slight_smile:

Hope this clarifies!


#8

Hi Mani,

Understand that “hat command should be executed in host machine.”

but the second command “sudo dd if=rootfs.img of=/dev/sdb9” causes trouble
when it is executed, please refer to the pictures sent to you in my
previous email. In short, it turns file system of ext4 to unknown and
therefore process of loading of SD stopped abnormally.

Regards

Vincent


#9

Hi Vincent,

I’m not sure of the format of Yocto rfs image. But I guess you can try something similar below.

$ sudo mkdir -p /mnt/sd
$ sudo mount /dev/sdb9 /mnt/sd
$ sudo tar -xvf core-image-base-dragonboard-410c-20170803052121.rootfs.tar.gz -C /mnt/sd
$ sudo umount /dev/sdb9

Basically, it mounts rootfs partition(/dev/sdb9) and then places the un-compressed rootfs onto that.

Thanks,
Mani