LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Slax: how to build a new kernel? (http://www.linuxquestions.org/questions/linux-general-1/slax-how-to-build-a-new-kernel-606913/)

xlq 12-15-2007 03:51 AM

Slax: how to build a new kernel?
 
How to build a new (new as in 2.6.21.5) kernel for Slax 5.1.whatever, on a usb stick? I need this to get networking to work. There are tutorials for rebuilding the slax 2.6.16 series kernel, but not for a more up-to-date kernel.

I know I need squashfs and unionfs, but I'm not sure what else I need, and how to actually install it in the squashfs, initrd.gz etc.

slak05 12-18-2007 01:03 PM

there are thousands of tutorials and howtos out there going over how to compile the kernel. No matter the distro, the kernel can always be compiled the same way. I've never used slax but this example (2.6.23.11) should work:

Code:

# wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.23.11.tar.bz2
# tar xvf linux-2.6.23.11.tar.bz2 -C /usr/src/
# cd /usr/src/linux-2.6.23.11
# make menuconfig
# make && make modules-install
# cp -v arch/i386/bzImage /boot/linux-2.6.23.11
# cp -v System.map /boot/System.map-2.6.23.11


make menuconfig is where you specify all your kernel build options that are placed in .config in the src root dir. Also I wrote that all on the top of my head so the paths to the kernel and map might be a little off. Make sure to update your grub/lilo/etc to utilize the new kernel.

vstoykov 12-20-2007 11:50 AM

See this:
http://forums.remote-exploit.org/sho...7914&styleid=1

Hint: open build.kernel and edit this line:
Code:

VERSION=2.6.22.6

xlq 12-21-2007 09:39 AM

Thanks, but the problem is not with building the kernel, but with building a kernel that can boot slax.

After some experimentation, I found this to work, if anyone else wants to know:

1. download and untar Linux, squashfs3.3, aufs
2. make squashfs3.3/squashfs-tools and install them (mksquashfs/unsquashfs) somewhere on the host system
3. "make distclean" the kernel source tree
4. apply the squashfs patch (use patch -Np1 < ...)
5. follow the aufs instructions (copy the fs/ and include/ directories into the Linux source tree and update various config files)
6. configure the kernel (don't forget to include squashfs and aufs, preferably built-in instead of as modules)
7. make the kernel
8. mount the slax iso and copy all the files so you can modify them
9. replace the vmlinuz with your new bzImage
10. take boot/initrd.gz and gunzip it. If you run "file" on it, you can see it is an ext2 filesystem. Mount it somewhere.
11. Remove the old modules in the initrd from lib/modules/xxx/ and install the new ones to this directory (you only need the modules required to boot - I started with Slackware's huge-smp configuration, so I needed only a blank modules.dep in this directory)
12. modify linuxrc to use 'aufs' instead of 'unionfs'
13. in the sample/ folder in the aufs source tree, there is a script called unionctl. Replace bin/unionctl in the initrd with this script.
14. unmount the initrd, recompress it with gzip -9 and put it back in the boot/ directory where it came from.
15. use unsquashfs to extract all the files from base/01_kernel.mo on the cd (the files go into squashfs-root)
16. remove all the kernel modules (lib/modules/xxx/) from the squashfs-root and install the new ones; in the Linux source tree use "make INSTALL_MOD_PATH=xxx modules_install" where xxx is the path of squashfs-root (NOT the path of squashfs-root/lib/modules/xxx/)
17. replace bin/mksquashfs and bin/unsquashfs with the new versions (come to think of it, the squashfs tools you built earlier might be linked against incompatible glibc versions; I was using Slackware so it worked fine for me)
18. delete the old 01_kernel.mo and run mksquashfs squashfs-root <path-to-cd-files>/base/01_kernel.mo
19. use mkisofs to make the new cd image, and hope it works

lukas712 01-23-2010 12:01 PM

new kernel
 
Quote:

Originally Posted by xlq (Post 2998110)
Thanks, but the problem is not with building the kernel, but with building a kernel that can boot slax.

After some experimentation, I found this to work, if anyone else wants to know:

1. download and untar Linux, squashfs3.3, aufs
2. make squashfs3.3/squashfs-tools and install them (mksquashfs/unsquashfs) somewhere on the host system
3. "make distclean" the kernel source tree
4. apply the squashfs patch (use patch -Np1 < ...)
5. follow the aufs instructions (copy the fs/ and include/ directories into the Linux source tree and update various config files)
6. configure the kernel (don't forget to include squashfs and aufs, preferably built-in instead of as modules)
7. make the kernel
8. mount the slax iso and copy all the files so you can modify them
9. replace the vmlinuz with your new bzImage
10. take boot/initrd.gz and gunzip it. If you run "file" on it, you can see it is an ext2 filesystem. Mount it somewhere.
11. Remove the old modules in the initrd from lib/modules/xxx/ and install the new ones to this directory (you only need the modules required to boot - I started with Slackware's huge-smp configuration, so I needed only a blank modules.dep in this directory)
12. modify linuxrc to use 'aufs' instead of 'unionfs'
13. in the sample/ folder in the aufs source tree, there is a script called unionctl. Replace bin/unionctl in the initrd with this script.
14. unmount the initrd, recompress it with gzip -9 and put it back in the boot/ directory where it came from.
15. use unsquashfs to extract all the files from base/01_kernel.mo on the cd (the files go into squashfs-root)
16. remove all the kernel modules (lib/modules/xxx/) from the squashfs-root and install the new ones; in the Linux source tree use "make INSTALL_MOD_PATH=xxx modules_install" where xxx is the path of squashfs-root (NOT the path of squashfs-root/lib/modules/xxx/)
17. replace bin/mksquashfs and bin/unsquashfs with the new versions (come to think of it, the squashfs tools you built earlier might be linked against incompatible glibc versions; I was using Slackware so it worked fine for me)
18. delete the old 01_kernel.mo and run mksquashfs squashfs-root <path-to-cd-files>/base/01_kernel.mo
19. use mkisofs to make the new cd image, and hope it works

Hi, please cau you upload the file 01_kernel.mo with updated kernel somewhere into net?

SqdnGuns 01-23-2010 12:19 PM

Quote:

Originally Posted by lukas712 (Post 3837814)
Hi, please cau you upload the file 01_kernel.mo with updated kernel somewhere into net?

It was over 2 years ago..........(Dec 21st, 2007 10:39)


All times are GMT -5. The time now is 07:13 PM.