(Answer) (Category) Linux on PowerPC FAQ-O-Matic : (Category) Languages and Compilers : (Category) How to compile a new kernel :
Building a linuxPPC kernel (2.2.x)
Here is how I managed to build a linuxPPC kernel (2.2.5). Most of this information is reprinted with permission from http://128.223.194.185/~louisk/linux/how-to.html, along with a few comments and caveats from my installation (in square brackets). Many thanks go to louisk@d194-184.uoregon.edu for posting his experience!

In order to compile a current kernel, you need to get the latest versions of the following from ftp://ftp.linuxppc.org/linuxppc/users/gdt/linux-2.2.0p9+glibc-1.99.patch ftp://ftp.linuxppc.org/linuxppc/users/gdt/redhat/RPMS/ppc/binutils-2.9.1-19b.ppc.rpm ftp://ftp.linuxppc.org/linuxppc/users/gdt/redhat/RPMS/ppc/egcs-1.1-2b.ppc.rpm ftp://ftp.linuxppc.org/linuxppc/users/gdt/redhat/RPMS/ppc/egcs-as-gcc-1.1-2b.ppc.rpm ftp://ftp.linuxppc.org/linuxppc/users/gdt/redhat/RPMS/ppc/egcs-c++-1.1-2b.ppc.rpm ftp://ftp.linuxppc.org/linuxppc/users/gdt/redhat/RPMS/ppc/egcs-g77-1.1-2b.ppc.rpm ftp://ftp.linuxppc.org/linuxppc/users/gdt/redhat/RPMS/ppc/egcs-java-1.1-1a.ppc.rpm ftp://ftp.linuxppc.org/linuxppc/users/gdt/redhat/RPMS/ppc/egcs-objc-1.1-2b.ppc.rpm ftp://ftp.linuxppc.org/linuxppc/users/gdt/redhat/RPMS/ppc/glib-1.2.0-1a.ppc.rpm ftp://ftp.linuxppc.org/linuxppc/users/gdt/redhat/RPMS/ppc/glibc-0.961212-1r.ppc.rpm ftp://ftp.linuxppc.org/linuxppc/users/gdt/redhat/RPMS/ppc/glibc-devel-0.961212-1r.ppc.rpm ftp://ftp.linuxppc.org/linuxppc/users/gdt/redhat/RPMS/ppc/glibc-info-0.961212-1r.ppc.rpm ftp://ftp.linuxppc.org/linuxppc/users/gdt/redhat/RPMS/ppc/glibc-static-0.961212-1r.ppc.rpm
[You should also get ftp://ftp.linuxppc.org/linuxppc/users/gdt/redhat/RPMS/ppc/modutils-2.1.121-1.ppc.rpm ]

You also need to go to ftp://ftp.us.kernel.org/pub/linux/kernel/v2.2/ to find a current kernel. it will be something like linux-2.2.x.tar.gz and will be around 12mb. Before you download this, you do 'cd /usr/src' directory and remove the contents with 'rm -r linux-2.1.24' then you should download the and kernel and place it in the "/usr/src" directory with 'mv linux-2.2.5.tar.gz /usr/src'. Unpack it with 'tar -xvzpf linux-2.2.x.tar.gz' this will create a directory called linux. now you much go to "/usr/include" and type 'rm -rf asm scsi linux'. then 'ln -s /usr/src/linux/include/asm-ppc asm', ' ln -s /usr/src/linux/include/linux linux', and lastly 'ln -s /usr/src/linux/include/scsi scsi'. [This works, but I think it is easier/safer to untar the new source into /usr/src, rename the resulting directory to 'linux-2.2.x' and make then 'ln -s linux-2.2.x linux'. When upgrading from the LinuxPPC 4.1 dist I did not have to recreate any other links in /usr/include/.]

Finally, you have to apply the patch to the kernel, this is easily done with 'gzip -cd linux-2.2.0p9+glibc-1.99.patch.gz | patch -p0' [NOTE: If your file layout differs from what the patch file expects, you may have to use a different argument to 'patch' in order for it to locate the necessary files. (This can be done with the '-pX' option, it tells patch to strip off 'X' leading elements from the path before looking for the file.) If the patch doesn't go through cleanly, (it failed on one of the files in the 2.2.5 source, feel free to read the patch file and make the correction manually. It's easier than it sounds.] There, you are now set up to compile source that you download from the web.

'cd /usr/src/linux', then 'make menuconfig'. here you have to specify the options you want to have in your new kernel. As a general rule, the defaults are a good guideline to follow. After you have finished the configuration, 'make deps', 'make clean', 'make vmlinux', ' make modules', and finally 'make modules_install'. This will create all the necessary files, and also install the modules in the proper place. now all that's left is moving the "vmlinux" and "System.map" to the "/boot" directory with 'mv vmlinux System.mp /boot'. This will replace the old kernel and system.map. If you're using bootX, you also need to copy the kernel to the macOS system folder. [Instead of replacing the kernel and System.map files outright, I tag the new (and old files) with their version number (ie. by renaming vmlinux to vmlinux-2.2.5) and then make symlinks (ie. 'ln -s vmlinux-2.2.5 vmlinux').]
In order to get your modules to load, you either have to do it by hand each time, or write a script to do it. I favor the script idea and have a script you can look at to get an idea of writing your own http://128.223.194.185/~louisk/linux/rc.modules Modules are in "/lib/modules/2.2.x". you should have one line for each module. The rc.modules file lives in "/etc/rc.d" and needs to be executable 'chmod 755 rc.modules'. you also have to place it in "/etc/rc.d" with 'mv rc.modules /etc/rc.d'. [I'm not completely convinced that this is necessary...one of the advantages of modules (I'm told) is that they will load when required. That said, I still followed the procedure above and it works fine. You may want to make sure that the module fat.o loads before the msdos and vfat modules to avoid unresolved symbol errors.]
brad.s@usask.ca

Something that should be added is that for people running linuxppc R5 or Yellow Dog Linux or some other system based on glibc 2, the above instructions will not work and you will cause your system to be unbootable. That is because the libc that comes with R4 and the one that comes with R5 are incompatible. Of course none of the other rpms listed above should be installed on an R5 system as well as they will also be based on glibc 2 and will not run either. Also it is not necessary to apply the patch listed above as glibc 2 is so much move clever and well designed and so on :). However all the other steps for building a kernel should be the same.
b.judd@xtra.co.nz
Hello ,
My name is Zvika Yehudai and I work for IBM Research at IBM Haifa Research Lab. Recently I installed linuxPPC on my PowerG3 machine. I have no problems as far as day to day work, but once I want to compile a new Kernel... problems start: I followed all instructions and built the new Kernel. Now, I wanted to use it in BootX. I used mountX to copy the new created vmlinux to the System/kernel extensions/ folder. I was able to see it in the BootX menu, but when I tried to use it as the kernel image, it just started and got stuck in boot.... That kernel has no modifications at all, and I just wanted to see if I am able to create a new one and use it.
Any ideas what should I do next? Is it possible to test the Kernel i created form within the Linux itself? I noticed that while making the Kernel I had a lot of warnings... could this be a problem? I use the LinuxPPC CD from www.linuxppc.com which I purchased two weeks ago. Thanks in advance,
-Zvika
                        --
Zvika Yehudai IBM Haifa Research Lab Matam 31905 Haifa Israel E-mail: yehudai@il.ibm.com Tel: + 972-4-829-6352 Fax: + 972-4-829-6114

yehudai@il.ibm.com
[Append to This Answer]
Previous: (Answer) Recompiling kernels
This document is: http://www.jonh.net/cgi-bin/lppcfom/fom?file=578
[Search] [Appearance]
This is a Faq-O-Matic 2.717d.
Hosted by anduin.org and SourceForge Logo