pupngo - a small linux hobby OS

This is the home of various pupngo stuff. Link to overview of hosted ressources

Building a toolchain

pupngo toolchain was mostly based on precompiled uclibc toolchain root_fs_i386.ext2.bz2.

I will try to build a toolchain using buildroot-0.9.27 as starting point. With later versions I have had several problems getting a working native compiler in the target. The drawback (?) is that 64-bit builds are not supported as this needs later versions of uclibc/buildroot.

Buildroot expect some tools to be availeble in the host. My target is to build a toolchain capable of building it self, a goal which is not a build-in feature of buildroot. Secondly I want the toolchain to be able to build pupngo from source.

The host will be pristine P412 with devx installed. The target architecture will be i386.

For installing and configuring Puppy Linux 4.12 is beyond the instructions given here. In short you download the puppy-4.1.2-k2.6.25.16-seamonkey.iso image and burn it to a CD or DVD media. Boot from the CD/DVD and install to harddisk/usb or even to the boot CD/DVD itself. After that install the devx_412.sfs. Below are links to copies hosted at this site.

Or...: Download an iso-image - puppy-4.1.2-k2.6.25.16-seamonkey_w_devx.iso - where devx_412.sfs is included as well as a package "otf_sfs_loader_2015.pet" which after burn to a CD/DVD will boot you to a normal Puppy Linux 4.12 but with the tools needed for creating the toolchain at hands on the CD/DVD. You need min 1 Gb ram to do this or access to a large swap-partition. After boot, navigate to the CD/DVD, install the otf_sfs_loader_2015.pet, after that open a terminal in the CD/DVD and run "otf_sfs_loader devx_412.sfs". You should now have a working devellopment environment and be ready to follow the recipe further below.

Some trivial patches are needed to get started: Links to download sources has changed and the ncurses based build option menu needs small change. Some binaries needs to be compiled static to avoid break during the build, some versions need to be downgraded - other upgraded and some programs are missing.

The selection of programs are also to be settled - so are the configurations, especially busybox features need to change.

Where to start? Its an itterative process so below a description of the final patch via my incremental patches applied. You should be able to identify the incremental patches reading the patch from start to end...

  1. The target/dev is not correctly populated so added makedevs to busybox and used busybox to create the nodes.
  2. An upgrade of BB version from 1.00 to 1.13.2 is needed to get a working makedevs.
  3. Busybox "ar" is not robust enough so had to disable that.
  4. Enable cpio in busybox. Enable ed in busybox - some programs expect ed to be present during configure and make (later XFree86 will fail without this).
  5. Upgrade version of m4, zlib, bison, sed, gzip, grep, tar, bzip2, gawk and make. Minor changes of source names and links.
  6. Patch to get buildroot menu working in P412.
  7. Source link updates.
  8. Added binutils 2.19.1 as a package choice, needed later to build pupngo.
  9. Source link for ccache updated.
  10. gdb source link updated.
  11. squashfs version updated. gettext version updated.
  12. diffutils, strace, sed, tar and wget static build. strace version upgraded.
  13. Install of mksquashfs in target to be able to use later in pupngo too.
  14. gzip linked static.
  15. ncurses to build programs and include in target (tic).
  16. autoconf source link.
  17. zlib to include headers in target. Added texinfo as package option. Added perl-5.16.1 as package option. Both to be able to have working autoconf and automake. Later found that crosscompiling those two is a pain (=did not succed).
  18. gzip configure change. After upgrading version one has to give -DGNU_STANDARD=0 to CFFLAGS to get normal (old) behavior (ex. working gunzip).
  19. ncurses programs need to be compiled as static linked to be able to use during the build. microperl added as a package choise - this can be crosscompiled. autoconf version downgraded to 2.52 which can be build with microperl. less source link updated.
  20. automake version downgraded to 1.6.3 which will work with the downgrade autoconf. symlink microperl to perl in target.
  21. gawk configure changed to autoreconf to be able to build with the older versions of autoconf and automake. grep made able to use a fake makeinfo.
  22. Further patch to make sure zlib headers ends up in root-target.

A test at this point shows I am able to run buildroot and get a toolchain which is able to rebuild it self. As full perl and texinfo additions are not working a common patch is made where they are removed again.

Get the final patch via below link as well as my buildroot-config file. Also get util-linux_2.12-10.diff.gz as it might be hard to get your hands on these days.

So ends up in the following "recipe":
  1. Get buildroot-0.9.27 (wget http://buildroot.uclibc.org/downloads/old/buildroot-0.9.27.tar.gz)
  2. Unpack buildroot-0.9.27 (tar -xzf buildroot-0.9.27.tar.gz)
  3. Apply patch (cd buildroot; patch -p1 < ../buildroot-0.9.27_20150102.diff)
  4. Copy buildroot-0.9.27.config to buildroot/.config (cp ../buildroot-0.9.27.config .config)
  5. Create directory buildroot/dl (mkdir -p dl)
  6. Copy util-linux_2.12-10.diff.gz to buildroot/dl (cp ../util-linux_2.12-10.diff.gz dl)
  7. In buildroot directory issue command "make oldconfig"
  8. Run "make", sit back and wait for your target to be build. You will be asked about which target x86 Processor Family you want - I have only tested Generic 386. You can afterwards chroot into your toolchain root (in build_i386) or load the created squashfs (root_fs_i386.squashfs) in pupngo (after rename to root_fs_i386_412.sfs).

Please note that links to sources change over time. If the build stops because the source cannot be downloaded - download the source from where you can get it - and place it in dl-directory. You might have luck looking here

You can test your new toolchain by chroot into your toolchain root (build_i386/root). The toolchain should be able to rebuild itself. After chroot repeat the procedure described above 1-8. To have internet connection in the chrooted environment copy your host /etc/resolv.conf to your /root/etc/resolv.conf

Question: Which packages need automake and autoconf? They might be moved to an install upgrade for pupngo if program who need them could be excluded from the toolchain. How did perl get in?

Answer: uclibc (binutils) needs gettext, bison & flex and flex needs autoconf. So no way to avoid microperl, autoconf and automake. Might circumvent by using http://landley.net/aboriginal/mirror/binutils-397a64b3.tar.bz2?

Next step - building pupngo from source

We do not know yet if pupngo can be build from this toolchain. In pupngo-2014 all sources, patches and build scripts are included. So we grab it all and put it in the build/root/src directory. Download pUPnGO_V412_240314.iso here

Here we should have some more information about how to get the things off the iso. That is a TODO.

With all the needed files in /src in our toolchain we are ready to start.

  1. We chroot into the toolchain and run the src/pupngo_build.sh script. sysfsutils-2.1.0 require autoconf version 2.58 or higher. autoreconf not possible as full perl is needed. So try installing perl before sysfs. This helps but errors persist. Downgrade sysfsutils to 2.0.0 removes problems with autoconf/automake version. This seems to be only problem running "run_basis_install". sysfsutils is needed for pcmciautils-014 and cdrkit to build.
  2. e2fsprogs-1.40.2 might have problem with installing info. No more problems running "populate_initrd".
  3. "populate_CLIsfs" runs without problems.
  4. "create_tinyx" runs without problems.

We should now have the basic pupngo ready. Create a iso and give it a boot-try. We have a lot of applications that can e build. Try running the build_packages_01.sh. If all goes well a bunch of packages are created in the /src/packages directory.