Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Building Guides

Zachary Powell

General Guide to build

This is a very generic guide to building a img file of a unsupported distro, to use this guide and actually get a booting and working img you will need:

  • A machine running Linux, in many cases it must be running hte distro you want to make an img for, but not always.
  • A good understanding of the distro you wish to build, the packages it uses etc.
  • A good understanding of the Linux command line
  • The distro MUST already have an ARM version, unless you plan to port!

Building the base

The first thing we must do is actually build a img, to do this will depend on the distro, but we can start by creating a empty .img file (see HERE for more info on the format).
Bring up a command promt and move to the location you wish to use for this then type:

dd if=/dev/zero of=ubuntu.img bs=1MB count=0 seek=4096

This would generate a .img file called 'ubuntu.img' that is 4096MB in size, or 4GB. Adjust the size and name to your likeing, but remember that FAT32 file systems which are normally used for the sdcard in a device only support up to 4GB files.

To create the empty file, we must then format it to ext2, although you could use ext3/4 if you know your device supports them.

mke2fs -F ubuntu.img

Now we have the file its time to fill it with Linux.

Getting the File system

Now we have the img file we need to stuck im linux in there, so lets start by mounting the image to a folder, so first make a folder (directory) that you want the image to be mounted to and issue

sudo mount -o loop ubuntu.img ~/mountpath

Where "ubuntu.img" is your img file you just created and "~/mountpath" is the location you want it to be mounted to.

From here we need to get hold of the distro of choices RootFS (Root file system) for ARM devices. This is the bit that is down to you, for some distros you might be able to find this online ready for you, for example Ubuntus can be found HERE, but for others you may have to build it.
Check out the distro of choices wiki, or their forums etc to find out more information on how to get this.
Or if building one of the already supported distros see the guides below on how to get the rootfs

No matter how you get hold of it once you have it you will need to then copy this (uncompressed) into the folder your mounted your img file to. Something along the lines of

sudo cp -rp /rootfs/* ~/mountpath

where "/rootfs/*" is the path to your rootfs and "~/mountpath" is the path to your mounted .img file

Make it boot

In order to allow your nearly created img to boot with our system you will need a script created in the location /root/init.sh of your img file so while its still mounted with the above example we would create the script at ~/mountpath/root/init.sh

Within this script it where you would take care of anything that needs to run on booting linux, anything you need to do for the first boot etc. As an example you can take any of the offical images and read through their init.sh (which will also be in /root/init.sh). Depending on the distro and the packages used much of these may well not work, but the only line that 'should' be needed to get a booted working command line is

/bin/bash -i

Once you have created this script you can now unmount the img using

sudo umount ~/mountpath

Where "~/mountpath" is the path you mounted the file to

Then just put your .img file on your device and use our app to try and boot!


Related

Wiki: Home