rootfs image making

Christopher Hall hsw at
Mon Nov 24 12:15:23 CET 2008

Hello Werner,

On 2008 November 24 Monday 17:04:55 Werner Almesberger wrote:
> Hi Christopher,
> by the way, once the rootfs is done, how do you turn this into an
> image ? Do you just mount the uSD card and copy the files ?

There is an interactive script that uses scripts in qi, kernel etc.
to do all the hard work.  I presents me will a command line interface
that lets me run the appropriate part and asks permission for almost
every thing since many items must be done by sudo.

Once I have built kernel and root fs, I call the script in qi to
format the SD Card and put qi onto it; this script makes the file systems.
My root end up as a tar.bz2 (fakeroot created the correct permissions here)
and this is extracted to the SD Card partition the kernel is written to the
boot directory.

The directory structure looks like (all checked out from git)

testing --+-- kernel
          +-- qi
          +-- gta03-test-suite

testing/gta03-test-suite is current directory
and I run ./ here

> For myroot, I made the following three scripts:
> - mkjffs2: generates a JFFS2 image for GTA01 or GTA02 NAND
> - mkext2: makes a file containing an ext2 file system with the content
>   of the rootfs plus a user-selectable amount of free space
> - mksd: takes a kernel and an ext2 image and generates an SD card
>   image containing a partition table, a FAT partition with the kernel
>   if using u-boot, and a partition for the ext2 file system

It should be easy enough to reuse these as I retain the root fs tree and
the associated fakeroot database; so it should be just a matter of running the
with the correct fakeroot command, just like I do for tar.

> mkext2 and mksd both are designed for the production of images one
> can download and copy directly to the device. Thus, they don't take
> into account device size (because it's unknown at the time the
> image is made, and the same image may be used with different
> devices).

I did not do any images yet since I am aiming to build an SD Card for testing
at the moment.

> The JFFS2 image doesn't have this size issue because JFFS2 uses the
> whole device, even if the image is smaller.
> - Werner

Best regards.
Christopher Hall            

More information about the devel mailing list