You are not logged in.

#1 2008-10-23 15:33:17

dav7
Member
From: Australia
Registered: 2008-02-08
Posts: 674

Kernel binary/compiler compatiblity

As Linux grows, a just-the-bare-essentials kernel image will slowly become too big to fit on a floppy disk, unless someone has something amazing they want to pipe up about. The last time I played with kernel compilation the smallest kernel image I created was about 500kB. By Linux v3 that's probably going to be 2MB.

Floppy disks are dying out faster than ever now especially with the event of bootable flash disks, but it still helps to keep a Linux distro that can fit on one around for when an older system that doesn't support booting off flash disks (like my own) needs to be recovered or repaired, or just for the fun of it big_smile

Therefore, to fit Linux on a floppy disk typically means resorting to an older kernel, if I plan to fit anything meaningful on it besides the kernel image. This instantly creates the problem of the fact that older kernel means older glibc, and older glibc possibly means less calls and most certainly means different memory/call/data offsets, if I'm correct.

At any rate, a 2.6 kernel is going to choke on something compiled for, say, 2.2. For an actual real example, here's what happens when I try to run a version of xterm compiled for 2.2.25 on my 2.6.26 box (I'm not touching .27 until the "KABOOM!!! KERNEL HAS ASPLODED MY PC" reports floating around on here die down a bit):

/Users/dav7/Xwoaf/woaf-0.2.0g-custom/woaf-0.2.0g/xvesa/woaf-ref/usr/X11R6/bin/ + ls
total 624K
-rwxr-xr-x 1 dav7  127 2005-10-30 11:01 Cmd
-rwxr-xr-x 1 dav7   50 2005-11-01 05:35 OXElmo
-rwxr-xr-x 1 dav7   58 2004-02-19 10:21 Start
-rwxr-xr-x 1 dav7   16 2004-09-23 17:30 Top
-rwxr-xr-x 1 dav7  17K 2005-03-17 06:15 bcalc
-rwxr-xr-x 1 dav7  130 2004-03-15 11:15 calendar
-rwxr-xr-x 1 dav7  141 2004-10-22 09:52 clrmail
-rwxr-xr-x 1 dav7  31K 2005-03-17 08:11 edx
-rwxr-xr-x 1 dav7   44 2005-10-30 12:59 hv
-rwxr-xr-x 1 dav7  74K 2005-03-17 06:21 jwm
-rwxr-xr-x 1 dav7 6.2K 2005-03-17 06:22 menu
-rwxr-xr-x 1 dav7 2.0K 2004-03-01 11:24 mime_start
-rwxr-xr-x 1 dav7   50 2005-11-01 05:35 rdesktop
-rwxr-xr-x 1 dav7 126K 2005-11-03 07:49 retawq
-rwxr-xr-x 1 dav7  61K 2005-03-17 06:25 rxvt
-rwxr-xr-x 1 dav7   45 2004-03-16 05:59 sendto
-rwxr-xr-x 1 dav7  98K 2005-03-17 06:26 txplor
-rwxr-xr-x 1 dav7   26 2004-03-01 08:24 x
-rwxr-xr-x 1 dav7  17K 2005-03-17 06:15 xcalc
-rwxr-xr-x 1 dav7  130 2004-03-15 11:15 xcalendar
-rwxr-xr-x 1 dav7 4.6K 2005-10-02 13:43 xcmd
-rwxr-xr-x 1 dav7  31K 2005-03-17 08:11 xless
-rwxr-xr-x 1 dav7 8.2K 2005-03-17 06:26 xsetroot
-rwxr-xr-x 1 dav7  61K 2005-03-17 06:25 xterm
-rwxr-xr-x 1 dav7   69 2004-09-23 18:08 xtop
-rwxr-xr-x 1 dav7   72 2005-08-29 13:58 retawq.sh
-rwxr-xr-x 1 dav7   96 2004-03-15 11:51 txplor.sh
/Users/dav7/Xwoaf/woaf-0.2.0g-custom/woaf-0.2.0g/xvesa/woaf-ref/usr/X11R6/bin/ + ./xterm
-bash: ./xterm: No such file or directory
/Users/dav7/Xwoaf/woaf-0.2.0g-custom/woaf-0.2.0g/xvesa/woaf-ref/usr/X11R6/bin/ + sh xterm
xterm: xterm: cannot execute binary file
/Users/dav7/Xwoaf/woaf-0.2.0g-custom/woaf-0.2.0g/xvesa/woaf-ref/usr/X11R6/bin/ + file xterm
xterm: symbolic link to `rxvt'
/Users/dav7/Xwoaf/woaf-0.2.0g-custom/woaf-0.2.0g/xvesa/woaf-ref/usr/X11R6/bin/ + file rxvt
rxvt: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), corrupted section header size

As you can see, neither the kernel or my shell is exactly prepared for this encounter, and file doesn't seem to show anything strange.

Even ldd explodes when it encounters the binary!

/Users/dav7/Xwoaf/woaf-0.2.0g-custom/woaf-0.2.0g/xvesa/woaf-ref/usr/X11R6/bin/ + ldd rxvt
/usr/bin/ldd: line 124: ./rxvt: No such file or directory

With this in mind, I'm faced with a bit of a problem if I want to develop and configure a base system using a kernel older than what my system is running.

What do you recommend I do so that I can easily compile [and develop software for] older Linux kernels?

Lastly, the [ ] in the previous line brings me to my final question: with their contents removed, the line reads "...compile older Linux kernels?" - I did a bit of downloading at ftp.kernel.org one evening only to find that the 2.0, 2.1 and 2.2 kernels wouldn't compile with either gcc 4 or 3.2, and understandably so - they were released before 2000, and C has had some major updates since then (I think we like, even have a new standard, haha). So, how indeed can I compile older versions of the Linux kernel?

PS. I'm reinventing the wheel here, you'll notice "Xwoaf" in some of the paths above. X Windows On A Floppy is my inspiration to have a go of my own; it fits Xvesa in 1.44MB of space, and I just can't wait to beat it. tongue

-dav7

Last edited by dav7 (2008-10-23 15:36:27)


Windows was made for looking at success from a distance through a wall of oversimplicity. Linux removes the wall, so you can just walk up to success and make it your own.
--
Reinventing the wheel is fun. You get to redefine pi.

Offline

#2 2008-10-27 04:35:47

dav7
Member
From: Australia
Registered: 2008-02-08
Posts: 674

Re: Kernel binary/compiler compatiblity

Bump? tongue


Windows was made for looking at success from a distance through a wall of oversimplicity. Linux removes the wall, so you can just walk up to success and make it your own.
--
Reinventing the wheel is fun. You get to redefine pi.

Offline

Board footer

Powered by FluxBB