How to port IPlinux to a new architecture
preparations
- 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
- 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 bison
dpkg
- Test dpkg: dpkg-architecture -a<your arch> should emit lots of variables. Check the correctness of variables.
- 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
- Create a new directory and clone the binutils-host, linux-libc-dev, gcc-4.3, 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-host 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
- Clone the mktpkg tool git:
git clone git://git.iplinux.org/mktpkg.git
- In the directory with sources run:
./mktpkg/mktpkg -d <arch>
- See lots of error messages.
- Fix the problems, repeat until success.
- Send patches to mailing list / maintainer / IRC.
To test the toolchain, you can build a minimalistic rootfs with it:
Get the source code:
mkdir pkg-build; cd pkg-build for i in apt apt-keys base-files base-passwd busybox dpkg dropbear fakechroot-cross-target-helper ifupdown ncurses netbase perl sysvinit zlib; do git clone git://git.openinkpot.org/$i.git done
Build and cross a few essential libraries:
for i in ncurses zlib ; do (cd $i; dpkg-buildpackage -b -us -uc -a<ARCH>) done sudo dpkg-cross -i -a <arch> libz1-dev_*.deb libz1_*.deb libncurses5-dev_*.deb libncurses5_*.deb
Build some basic utilities:
for i in apt akt-keys base-files base-passwd busybox dpkg dropbear fakechroot-cross-target-helper ifupdown netbase perl sysvinit; do (cd $i; dpkg-buildpackage -b -us -uc -a<ARCH> -d) done
Now, we use debootstrap to build the rootfs.
Create the repository containing your packages and the toolchain (only the libs are required):
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> --foreign --components=main zelazny rootfs file:///home/build/repo
profit!
- Enjoy your new shiny toolchain and rootfs.
