Problem on creating rootfs.img with make_ext4fs


#1

Hi,

I try to use make_ext4fs to generate rootfs image ( ubuntu version), but it won’t work after I use fastboot to flash it.

After booting into kernel, the HDMI clearly didn’t work.

Did anyone successfully use make_ext4fs to generate rootfs image ?

This is what I did.

===================================
sudo simg2img linaro-vivid-alip-qcom-snapdragon-arm64-20150727-80.img rootfs.img.raw
//use the official released rootfs.img

sudo mount -t ext4 rootfs.img.raw mountfolder
//mount it on a folder named mountfolder

sudo make_ext4fs -l size_of_rootfs.img.raw rootfs.img mountfolder
//use make_ext4fs to generate imaged to be flashed by fastboot

or use sparse format

sudo make_ext4fs -l size_of_rootfs.img.raw -s rootfs.img mountfolder
//use make_ext4fs to generate imaged to be flashed by fastboot with sparse format

Whether I used sparse format or not, it won’t work.

Does anyone ever succeed on this ?

Thanks for any help.
Best Regards,
John


#2

hi,

we used a patched version of make_ext4fs, we added an argument (-o) to force preserve files ownership, otherwise make_ext4fs will change all files to ‘root’. which can create a bunch of problems.

You can find our custom android-tools here:

http://repo.linaro.org/ubuntu/linaro-overlay/pool/main/a/android-tools/

the patch is in the debian tarball (preserve-ownership.patch) in case you want to rebuild make_ext4fs, if you are using Ubuntu on your host, you should be able to use our .deb file directly.

Let’s try that first… and if the problem still exists, we will need to debug more…


#3

Hi ndec,

Thank you very much for this !

It works for me now !

P.S.
I don’t recommend anyone to try these on a mac OSX.
It will encounter some problems since OXS don’t support ext4 by default, and free solution for ext4 don’t really support ext4 write.

Best Regards,
John


#4

Hello ndec and john,

How can I mount / extract the image files to my own Ubuntu ?

Thank you :slight_smile:


#5

hi,

@alonh, yes, but not directly. You first need to ‘unsparse’ the .img file:

simg2img xxx.img xxx.img.raw

then you can mount using loop device:

mount -o loop xxx.img.raw /<path>

Also, please note that we changed how we build the images recently, and we got rid of make_ext4fs all together… it was implemented in this change: https://review.linaro.org/#/c/10179/


#6

Hi alonh,

For using the image, I just flash it into the device and boot it.

Command in fastboot mode:

fastboot flash rootfs roofts.img

For extracting image, it is a bit more complicated.

You need to bring up/boot your dragon board to a state which allow you to copy files from eMMC when not using the rootfs partition.

There should be an easier way, but we put a whole Andriod operating system to a SD card and boot from the SD card.

Then we simply use dd command to copy the roofts partition to a USB stick.

Best Regards,
John


#7

Thanks for the response,

Yesterday, a few moments after I wrote the question I did that. I managed to mount the rootfs, add a file, and from that re-create the rootfs (with the changes), and it worked.

I just saw that your instructions match exactly to what I did…

Have a good day :slight_smile:


#8

Hope u r doing well
I’ve been looking, asking around to find a solution but all went in vain.

Well, my problem is with flashing system.img after it has bee repacked successfully using many commands via ubuntu … I’m working on a system.img for Galaxy s 6 sprint (g920p) 6.0 .
I’ve read an earlier reply of yours of such a question… it is about using a patched make_ext4fs… so i downloaded ur version but it says built without android support.
I’m stuck between a rock and a hard place.

Thanks in advance