User:Immolo/OldKernelInstall

This guide is intended for those that need to use an older kernel as that's all the hardware supports. Throughout this guide we will be using a 2.6.39 kernel as it's the oldest recommended by Musl however, older ones can still work with it and feel free to add the needed fixes to this guide.

Setup
Log into the system, create your partitions, mount them, change into that directory and then finally download the Musl stage3 tarball for your system (this guide will be using amd64 as the example.)

Due to these devices having a number of ways the above steps need to be completed this guide will start from unpacking the stage3:

Mount the required filesystems:

/run isn't provided by all old host systems so you can ignore it if it's not there.

Next copy over  so Internet works in the chroot:

Chroot into the system:

Before moving on to the next step this is the time to setup  with the require common flags and use flags and finally run.

Create Local Repository
Now, create a local repo for the kernel headers to match the device's kernel.

Next, create the required kernel headers version:

Change the header sources to what you need and others can be obtained from here.

Create a manifest for the ebuild:

Install Headers
First, remove as it won't be supported by this kernel.

Using --clean isn't recommended normally however, in this case it is required so we can emerge the 2.6.29 headers.

This is the time to add  to your.

Now, create a package.mask so a newer kernel header isn't installed:

Ebuild fixes
Some ebuilds need to be edited to work.

sys-apps/shadow
The btrfs flag will case issues here so you will need to remove the  flag inside for for this to compile.

net-misc/iputils
cannot build due to the ipv6 headers so we need to disable this systemwide so only ipv4 can be used.

net-firewall/iptables
A header file is missing to allow to successfully compile.

sys-libs/libseccomp
Stop from being pullied in the future

sys-libs/pam
won't build with earlier headers, so this will disable it.

Replace sys-apps/systemd-utils with sys-fs/eudev
won't work with the older headers so it needs to be replaced.

Next. a patch is required to remove the V4L part being built:

Some fixes need to be applied:

Edit the ebuild to remove everything after the RDEPEND line in the local repo copy.

Finally, emerge :

Re-emerge the system
Emerge the system again to take advantage of your new flags and rebuild against the correct headers for your system.

The base system is now installed, so now continue with original handbook for your system to make it bootable.

Known Packages to Fail under 2.6.39
Can be replaced with