Tuesday, October 17, 2017

Linux Kernel 2.2.x or not?

Compile newer version of Linux Kernel

So BasciLinux 2 kernel is version 2.2.16. I wanted to compile newer kernel on another machine. So i completely reinstalled my Pentium III PC, it had Debian based Linux Mint 12 or so. Used slackware-10.1 iso for that. 
First i tested version 2.4.29. It compiled fine. Small copy on to 486 and it will not boot. IDE drivers were missing. Fixed that and it boots.
Next thing was getting it to connect to LAN. Wasted lot of time and realized that it has different structure. I had them built into kernel. Nothing happens. Then made module version. Kernel try's  to load modules with modprobe. Well this is not going to work. So i dropped version 2.4.29. 

Downloaded source of Kernel 2.2.21 to this pentium PC. It wont compile. gcc version was 3.3.5. Complains about lot of stuff:

  • conflicting types for `xtime' (https://www.linux-mips.org/archives/linux-mips/2001-08/msg00014.html)
  • error: long, short, signed or unsigned used invalidly for `slot_tablelen'  (https://www.linux-mips.org/archives/linux-mips/2001-08/msg00014.html)
  • '##'  (https://gcc.gnu.org/ml/gcc-bugs/2000-08/msg00723.html)
  • __asm__  (https://lwn.net/Articles/66793/) quotes are missing in arch i386
  • warning: pasting "(" and "0x0" does not give a valid preprocessing token { (https://forums.anandtech.com/threads/help-linux-kernel-compile-issues.711957/)
  • etc
Finaly managed to compile this kernel. Swapped out my 2.4.29 bzImage. 
Result: Kernel panic
Unable to handle kernel NULL pointer dereference at virtual address 00000f2c 
(https://www.linuxquestions.org/questions/linux-software-2/kernel-panic-swapper-not-syncing-
227208/)
Removed all modules, only blank kernel. Still panic. Gave up. Time wasted again.

Google'ing around the web i noticed another cool-looking distribution: http://delicate-linux.net/

Upgrading to Slackware 10.1 

So i was thinking, maybe i still can use kernel 2.4.29. 486 has CD-ROM, but it cant boot from it. Slackware 10.1 ISO image has ramfs, so i made copy to my dos partition where i boot my kernel with loadlin.exe into ramfs. (Had to increase ramfs size in kernel, another recompilation of many). So after booting from dos i mounted CD-ROM drive and started to install Slackware 10.1 onto my drive. Selected packages i needed. Probably to much. It took forever to install. 2 hours i think.
I had all ready compiled kernel  2.4.29 for 486. I booted again after install was done. It booted to freshly installed hard drive. After some more tweaking with this kernel i was finally happy, it worked.
One thing that was problematic was memory usage. BasicLinux 2 had only small files, no services, etc. 
Window manager fails to start. Could not figure out why. Finally decided to use BasicLinux X Server with icewm. Made some changes in paths in /lib and /usr. I got may GUI. Most of the programs complain about missing lib files. Sure, i dropped newer X Server.

Whanted to compile X Server 6.3 for it. After succesful compilation transfered files to 486.  XF86Config was problematic. X Server complained about Mode is missing. I did not give up. And after some changes in there managed to boot freshly compiled X Server.

Networking

So i have two machines with same version of Slackware. I can use putty and winscp in my main box to get closer over network. It made a lot easier to copy compiled files from Pentium machine over to 486 thru my main box :D.

Sound

Well, it took a wile to get it working. For some reason alsaconf wanted to insmod modules.  I had my sound card compiled into kernel. It did not work for alsaconf.
Removed all sound modules from kernel (recompiled again) and it looked like it works. At least alsamixer started working.
I needed some program that can output some sound. I remembered that in package selection phase i selected cli mp3 player. Namely mpg123. 
Started up this player. First second of the song was ok. But after that i got:
ALSA: underrun, at least 0ms

CPU usage was 99%. There were no music, only noise.

This cant be happening.
So looked around:
http://www.tldp.org/HOWTO/MP3-HOWTO-7.html

In: http://www.mpg123.org/
Plays Layer 3 in stereo on an AMD-486-120Mhz or (of course) a faster machine.

mpg123 version was 0.54. Old. Downloaded latest source, compiled and it hang 486. Really?
I have old distro with old libs. Probably this is reason. It gives a warning if you compile with i486 target :D. Finally used version 1.22.4 with small tweak in alsa module. Reverted on function and it compiled and worked fine.
Command line was:
./configure  --with-optimization=3 --with-cpu=i486  --enable-int-quality=yes  --enable-buffer=yes CFLAGS='-march=i486' --enable-modules=no

 With option -2 CPU usage was 27-36%. Success.

Well, i have internet connection in this old PC. Why not lissen to some online stream. Used (https://www.kexp.org/help/ListenLiveLinks) MP3 32k (Standard, Low Bandwidth).
Made bash file:
#!/bash/sh
./mpg123 http://live-mp3-128.kexp.org:80/kexp128.mp3

I have now radio :D


No comments:

Post a Comment