How to port IPlinux to the new architecture?

preparations

  1. Prepare the chroot
    http://ftp.iplinux.org/contrib/iplinux-bootstrap/iplinux-bootstrap-LATEST.tar.bz2
    tar xf iplinux-bootstrap-LATEST.tar.bz2
    (cd iplinux-bootstrap; ./iplinux-bootstrap iplinux ../ip)
    ./ip/enter
    
  2. Install the development packages
    apt-get update
    apt-get install git-core build-essential toolchain-package debootstrap debhelper pkg-config po4a libncursesw5-dev zlib1g-dev libbz2-dev flex libselinux1-dev libio-string-perl quilt autoconf automake cvs gawk dpatch texinfo sharutils libgmp3-dev libmpfr-dev lsb-release realpath cdbs docbook-to-man dbs
    

dpkg

  1. Test dpkg: dpkg-architecture -a<your arch> should emit lots of variables. Check the correctness of variables.
  2. In case dpkg-architecture is not enlightened enough, fix it (see /usr/share/dpkg/*table and commits to dpkg git for the reference) and send patches to mailing list / maintainer / IRC.

toolchain

  1. Create a new directory and clone the binutils, linux-libc-dev, gcc-4.3 and either/both glibc and uclibc git repositories into it: (–depth 1 means don't fetch any history, which is huge for the linux kernel)
    mkdir toolchain-build; cd toolchain-build
    
    for i in binutils gcc-4.3 glibc uclibc; do
      git clone git://git.iplinux.org/$i.git
    done
    
    git clone --depth 1 git://git.iplinux.org/linux-libc-dev.git
    
  2. In the directory with sources run:
    mktpkg <arch>
    
  3. See the lots of error messages.
  4. Fix the problems, repeat until success.
  5. Send patches to mailing list / maintainer / IRC.

Initial rootfs

Get the source code:

for i in apt base-files base-passwd busybox dpkg dropbear ifupdown ncurses netbase perl sysvinit zlib; do
  git clone git://git.openinkpot.org/$i.git
done

Build most of the downloaded stuff:

for i in base-files base-passwd busybox ifupdown ncurses netbase perl sysvinit zlib; do
  (cd $i; dpkg-buildpackage -b -us -uc -a<ARCH> -d)
done

Install the built devel libraries:

sudo dpkg-cross -i -a <arch> libz1-dev_*.deb libz1_*.deb libncurses5-dev_*.deb libncurses5_*.deb

Build the rest:

for i in dpkg apt dropbear; do
  (cd $i; dpkg-buildpackage -b -us -uc -a<ARCH> -d)
done

Create the repository:

mkdir ~/repo
cd ~/repo
cp ~/pkg-build/*.deb ~/toolchain-build/*.deb .
apt-ftparchive --option=Tree::Architectures=<ARCH> packages . > Packages
mkdir -p dists/zelazny/main/binary-<ARCH>
ln -s ../../../../Packages dists/zelazny/main/binary-<ARCH>/Packages

Build the rootfs:

cd ~
sudo debootstrap --arch=<ARCH> --components=main zelazny rootfs file:///home/build/repo

profit!

  1. Enjoy your new shiny toolchain and rootfs.