Howto compile debian for e-box 2300 sx

Recently, I acquired a small barebone with low power consumption (10 watts) in one box, based on a 300 MHz Vortex SX cpu. This one was pretty affordable, because of the missing co-processor, I assume, which makes a linux install a challenge. Nevertheless, in principle, it works and I post here a short howto, for the ones going the same path. Be warned, without the co-processor and only 128 MByte of RAM, the 2300 sx is suited for simple applications only.

The steps to achieve a running system where as follows:

  • Compile kernel and build package, including initrd (with Vortex kernel patches)
  • Build aufs module with new kernel
  • Build a debian repository, including the packages with the new kernel and the aufs module
  • Prepare a debian live system for usb stick, including the new kernel and aufs module
  • Boot system with the new kernel from the debian live on usb stick
  • bootstrap debian system on harddisk and copy the kernel from usb stick to the system

The following steps just show the basic commands and the overall structure, to give a roadmap. It might be, that the one or other step needs modification or is not completely shown.

Compile kernel

Download 2.6.24 kernel patches from DMP homepage: config and kernel patch. There also is a introduction howto compile the kernel.

Download 2.6.24 kernel source (I took 2.6.24.7) from debian.org.

Download the aufs sources, with apt-get aufs-source and extract them to the /src/modules directory.

Install debian live system with apt-get install live-helper.

Extract kernel, rename directory to 2.6.24.orig (that is, what the patch expects), apply patch with
patch -p0 <patch-2.6.24-DMP

copy the config file into this directory:
cp config 2.6.24-DMP 2.6.24.orig/.config
rename the directory, to something meaningful, like 2.6.24.7-ebox (lower letters are needed for "ebox", capital letters do not work with debian live, therefore "DMP" original naming is also not suitable).
cd into the new kernel directory and change name of package to ebox
make menuconfig
General setup->Local version: "-ebox"

Everything else is fine and no changes are needed. This configuration will compile a kernel, which includes a proper ethernet driver and a math emulation (for missing co-processor). The following command (inside the kernel directory, compiles the kernel and provides a debian package for it, together with the initrd needed.
make-kpkg linux-image --initrd

Build aufs module

For the debian live system, we also need the aufs filesystem module, fitted to the kernel, issue from the kernel dir the following command:
make-kpkg --append-to-version="ebox" -added-modules=aufs modules-image

Now, we have to debian packages in the directory above the kernel source dir. One package with the kernel and the initrd and the other one with the aufs module. On my system, the packages have the names:
linux-image-2.6.24.7-ebox_2.6.24.7-ebox-10.00.Custom_i386.deb
aufs-modules-2.6.24.7-ebox_0+20080719-4+2.6.24.7-ebox-10.00.Custom_i386.deb

We are ready, to prepare the live image, to get a bootable system on usb stick.

Build debian repository

For creation of the debian live system, we need a repository, to get the packages included. The most important part here is, to get the path mechanics right, it might be that some trial and error is needed until everything works.

First create a suitable directory, lets say: /home/ebox-dist/dists/stable/main/binary-i386/, then copy the both modules created above into that directory, cd there and issue the command:
dpkg-scanpackages /home/ebox-dist/dists/stable/main/binary-i386/ | gzip -9c >Packages
which creates the index for the repository. (You can check content of Packages.gz in case the paths do not work).

Prepare a debian live system on usb stick

To create a bootable media, with a debian basic system and the new kernel, I used the debian live CD software. The homepage contains a lot of help and tips, how to use it.

Create a directory, for the debian live build system, change into that and create a first configuration.
mkdir life-image
cd life-image
lh_config

This created a default configuration in the folder config, those are plain text files. We need to modify a couple of them, to include the new packages and to build with the right options. Basically the following modifications were done:

  • binary: LH_BINARY_IMAGES="usb-hdd" (to get a usb stick image)
  • binary:LH_CHROOT_FILESYSTEM="ext2" (therefore we do not need additional module squashfs and also non-compressed image is ca. 350mb, which is no problem on todays usb sticks)
  • binary:LH_LINUX_FLAVOURS="ebox" (searches for the right kernel version to include in image)
  • binary:LH_LINUX_PACKAGES="linux-image-2.6.24.7 aufs-modules-2.6.24.7" (basename of kernel and modules, -box gets appended, due to change above)
  • added file to config/chroot_source, with name "ebox.chroot", containing one line: "deb file:/home/ebox-dist stable main".(this will create an additional repository path for debian packages during chroot creation. It allows us, to include our created packages on a special place on disk)
  • common:LH_APT_SECURE="disabled" (our packages are not signed, this wil allow debian live scripts to use them anyway

Normally, we now could start, building the image for the debian live usb stick with one single command. To be able, to put the new kernel package and aufs module package into it, we split the creation process into the following steps:
lh_bootstrap
this creates the chroot directory, in which we now copy the directory with the prepared debian repository. We now need to move the directory with the repository here:
mv /home/ebox-dist chroot/home
Now we can go ahead and create everything:
lh_chroot
lh_binary

this should build us a usb stick binary in the top directory.

You can test the image with qemu:
qemu -usb binary.img

Boot system with usb stick

The last step is, to copy the image to your usb stick.

dd if=binary.img of={device of usb stick, check for example output of dmesg}

Important Notes:

Be cautious, the dd command, issued with the wrong device will completely destroy all your data on one disk.

please do not use a partition, like /dev/sdc1, but the complete device /dev/sdc as parameter for of=

Finished with part one, you should be able, to boot from this usb stick your ebox 2300 sx. For booting there are some additional tips: it seems easy, if no harddisk is present. But if you already have a bootable harddisk, it might be neccessary, to also obey the following rules: setup the ebox bios in a way, that the usb harddisk is the hdd number one and also setup the boot device to this harddisk. It might be, that this is possible only, when the usb stick has been connected, during boot of the e-box.

Part 2, create debian system on ebox with debootstrap

The good question is, how to get this system now, to the ebox on disk? It turned out, that a simple way, is to use debootstrap, to finally install a fresh debian to the disk of your ebox (if you have one), this is easily done, since the kernel does contain a working ethernet driver, so access to internet can be provided.

The steps are provided in detail here: install debian from other linux.

Additional to those steps, the kernel, the initrd and the /lib/modules/ should be copied to the new root file system. A boot loader should be installed, taking the kernel and the initrd from the ebox version.

Image

For the ones, which would like to try a short boot on their box with debian 2.6.24.7-ebox, I provide here the image compiled by the instructions above, please see also the following disclaimer:

2.6.24.7-ebox-image

By the way, the root password is not set, the password for the live user is "live". From the live debian distribution FAQ:

Q: What is the root /user password?
A: The user password for the live user is 'live'. By default, there is not any root password. you can switch to root with sudo -i or set a password for root with sudo passwd.

Disclaimer

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

The software is based on Debian, for license, see Debian License and on Debian Live, see Debian Live Legal. All is based on the Open-Source GNU License, a copy is provided here: GNU 3 License.

Also the software includes a patch from the manufacturer: DMP Electronics INC, ddress: 8F., No.12, Wucyuan 7th Rd., Wugu Township, Taipei County 248, Taiwan (R.O.C.). The patch is provided on their web-site, for licensing, please have a look there.

For more information, please send and email to the contact provided below.