Recompiling kernel for IBM N2200

What works, and doesn't, for you. Be specific, and please include Puppy version.
Post Reply
Message
Author
foreirongold
Posts: 12
Joined: Mon 29 Jun 2009, 01:00

Recompiling kernel for IBM N2200

#1 Post by foreirongold »

Hi there,

I'm trying to get puppy 4.2.1 running on an IBM N2200 Thin client.

System specs can be found here:

Thing that aren't mentioned:

1 SD ram slot, can be upgraded to 256 MB.
CF card based storage via a built-in IDE-CF adaptor.
No Real time clock.
DMA on the CS5530 is a no go, PIO 4 is the best you can get.
Has a built in bootloader, executes kernel.2x00 in / of an ext2 or ext3 formatted CF card.
kernel.2x00 must be an uncompressed kernel in ELF format with offset 0x2c patched to 1.
Various kernel patches must be applied to sort out the quirks in the hardware, see the sites at the bottom of this post for more info.

I know that der_odenwaelder has made up a kernel that works for puppy 4.0 however it seems to lack USB printing support and ALSA support for the CS5530 audio solution.

What I'm trying to do at the moment is to recreate der_odenwaelder's kernel to replace the one currently in that distro so as I can make alterations to it. Later on I plan to translate whatever fixes were needed into a newer kernel (2.6.24.7) and then place that into puppy 4.2.1, however my efforts so far havn't been successful.

I'm using a puppy 4.2.1 retro frugal install box as the dev machine.
I've downloaded Barry's 2.6.21.7 patched source and applied the N2200 specific patches as needed. I then compiled the source using der_odenwaelder's config file supplied with that distro.

The kernel successfully compiles, however when I place the kernel in der_odenwaelder's distro the N2200 panics during boot because it cannot sync, the console says try to pass 'init=' to the kernel but the N2200 bootloader doesn't support passing kernel parameters.

der_odenwaelder's distro is basically an unmodified frugal puppy 4.0 install with a zdrv.sfs and a pup_save.sfs which contains some fixes for the RTC from what I gather. I'm wondering what is my kernel missing that is stopping it from booting?

*edited for clarity*

Some sites of interest:
Booting 2.6 series kernel on N2200
Discussion about DMA issues

foreirongold
Posts: 12
Joined: Mon 29 Jun 2009, 01:00

#2 Post by foreirongold »

Taking a look at this again after a few weeks, obviously the error is caused by parameters not being passed to the kernel but the N2200 has an embedded boot loader whose parameters cannot be altered. Is there any way to hard-code kernel parameters during compiling?

I'm using the pre-patched 2.6.21.7 puppy 4.1 retro source from ibiblio.

foreirongold
Posts: 12
Joined: Mon 29 Jun 2009, 01:00

#3 Post by foreirongold »

Thanks for all the help guys :?

Managed to get der_odenwaelder's version booting with my own kernel, turned out that I didn't have initrd compiled in. I used the one off the puppy 4.0 live-cd and that got it all going.

foreirongold
Posts: 12
Joined: Mon 29 Jun 2009, 01:00

#4 Post by foreirongold »

Ok, now I have another problem.

I'm now trying to put Puppy 4.2.1 retro on this machine using the above kernel. Still using der_odenwaelder's config file but changed most of the filesystems to be modularized as per the original puppy 4.2.1 kernel config. As such initrd was repacked with the new modules.

The problem is that while the kernel boots, it freezes when trying to load aufs.ko (invalid module format) and then panics because it can't perform a switch_root.

I noticed that the particular version of Barry's source that I'm working from doesn't have any aufs patches. As I couldn't find any documentation as to how put the patch in or where it is (The closest I came was in patches_required.txt which simply states, compiled separatly), I'm using the aufs module taken out of the vanilla initrd off the 4.2.1 livecd and placed inside the new initrd with a reference made in modules.dep, is there anything I'm doing wrong here?

EDIT: Ok got it working. Recompiled aufs from source, depmodded and rebuilt initrd and recompiled the kernel using der_odenwaelder's config.
Something I noticed though is that the N2200 doesn't like Xvesa, only Xorg seems to work. Also, saying that this machine is slow running 4.2.1 is an understatement, hopefully this can be rectified after I disable the kernel's faulty dma implementation for the chipset and force PIO.

foreirongold
Posts: 12
Joined: Mon 29 Jun 2009, 01:00

#5 Post by foreirongold »

Feeling a bit ambitious I decided to go on and compile a pristine 2.6.24.7 kernel for Puppy 4.2.1

Patches used:

- N2200 VGA fix as explained around the middle here
- N2200 force PIO as explained here
- unionfs 2.5.2 for 2.6.24.7 here
- squashfs 3.3 for kernel 2.6.24 here
- deny write access and super fsync super patches from the 2.6.21.7 retro kernel here (I did them manually since they were only one liners, not sure if the executing the patch on 2.6.24.7 would work)
- aufs from the 2.6.21.7 kernel here

Config file was based around Antonio Cardoso Martins' Suse 10.3 version here, only alternations to it (I think) was that the selections under the files systems and general setup menus in make menuconfig match those found in the 2.6.21.7 config. It's attached anyway.

aufs local.mk was configured as the 19Jul08 entry here but with the CONFIG_AUFS_SYSAUFS and the CONFIG_AUFS_UNIONFS23_PATCH entries enabled whilst the aufs splice patch was disabled.

pup_421.sfs off the livecd was used, no pup_save atm.

It boots quite fast however as soon as I get into X it slows to an absolute crawl, no idea what causes this. der_odenwaelder's version was also slow, but it was at least usable. Maybe insufficient ram? I've only got 128MB on this unit ATM. Any ideas?

Also, I would upload the kernel binary, but for some reason the site is saying I'm trying to upload an empty file, no matter how I package it. If anyone wants it let me know and I'll try uploading it somewhere else.

I'll throw in the procedure I used to compile the kernel so new users don't need to do the run around like I did :P, though I assume some familiarity with compiling a kernel.

- Get puppy 4.2.1 installed on another machine (frugal, hard, modern, retro, it doesn't matter) make sure you have the appropriate devx file installed and the compilers usable.
- Get a copy of the puppy 4.2.1 initrd file (the one off the livecd works).
- If using a frugal install make sure your pup_save file is sufficiently large. (256MB at least for me)
- Grab the 2.6.24.7 source from kernel.org
- Create source tree structure (ie /usr/src) and extract kernel in there
- In the root of the kernel folder make a new folder called 'modules'
- Fix the kernel (clean, apply patches noted above, throw in config file, remember to rename to ".config")
- initrd generally comes in a gzipped archive. Put the extracted content in the root of kernel source folder (same directory as the .config file) then rename it 'initrd.cpio'. Do not delete or rename the original *.gz file.
- 'make menuconfig' now if you wish to change some kernel settings, but not needed if using the attached config file.
- Now we extract the folder structure of initrd, place the *.gz file one level above the kernel source (ie /usr/src) then follow this guide to extract it.
- Go into ./initdir/lib and delete the modules directory.

We'll get back to that section later, for now we'll build the kernel and modules.

- go back into the kernel source folder
- 'make bzImage'
- 'make modules'
- 'make INSTALL_MOD_PATH=./modules modules_install'
- go into the modules directory and you'll see a lib directory, copy/move all its contents of lib to the lib directory in initdir.
- now extract, patch and install aufs, remember to specify 'make KDIR = <kernel source folder here> -f local.mk'
- copy aufs.ko to initdir/lib/..../kernel/fs/aufs (make the aufs folder)
- now depmod the new modules: 'depmod -b /usr/src/initdir -v 2.6.24.7'
- check /usr/src/initdir/lib/modules/2.6.24.7/modules.dep to see if aufs.ko is mentioned in there.
- zip up the directory as per the guide above, then extract, rename and replace initrd.cpio in the kernel source folder. (might be an idea to call the new initrd.gz something else)
- go back into kernel, 'make clean' and 'make mrproper'
- reapply config file
- 'make bzImage'
- goto arch/x86/boot/compressed and grab 'vmlinux' (not vmlinux.bin or vmlinux.bin.gz)
- using a hex editor goto address 0x2C inside vmlinux and alter its value to 1
- rename to kernel.2x00 and place on an ext2 (or ext3) formatted CF card along with pup_421.sfs
- done!

Simple isn't it? Note that if any subsequent modifications are made to kernel modules then initrd.cpio will need to be recompiled, otherwise you can leave it as is. The procedure begs for a script to automate everything, but I don't really feel like writing and debugging one atm.
Attachments
DOTconfig-pup421-N2200.zip
N2200 Puppy4.2.1 kernel 2.6.24.7 config
(9.38 KiB) Downloaded 392 times
Last edited by foreirongold on Fri 05 Feb 2010, 04:10, edited 1 time in total.

foreirongold
Posts: 12
Joined: Mon 29 Jun 2009, 01:00

#6 Post by foreirongold »

Ok, having compiled the kernel I thought I'd share some experiences I've had with the distro on my N2200.

- I've given up trying to run X full time on this box, the Geode FB driver is experimental in the 2.6.24.7 kernel, along with DMA disabled this makes for incredibly long load times. That said I never intended for the N2200 to be a 'full' system, I just wanted a cheap CUPS server so I have the thing booting into by default console now and I start X when I need it.

- Sound does work, but it is very laggy playing back mp3s with the console media player (forgot what its name was...) I would try using mpg123 but its not compiling for some reason.

- I've sorta fixed the RTC issues by using a combination of NTP and a script that dumps the date/time on shutdown and restores it on startup, followed by an NTP sync. I guess you could omit the script and let the thing just sync everytime it boots, but then when theres no internet access you'll have problems.

- I've encountered a few strange memory errors:

i) When the N2200 has 256MB of ram it will crash during the switch root phase and the top section of the monitor becomes corrupted. I'd hazard a guess that the N2200 doesn't protect the 3MB of video ram and puppy decides to use all 288MB of ram on the system when copying to ram. This doesn't happen when 128MB or less is in the box.

I've worked around this by applying a kernel command line patch outlined here and then throwing in mem=256M, I lose the 32MB built-into the box but I at least get a stable system. I also threw in a few other commands to make the distro into a 'poor man's install,' which would allow the creation of a pup_save file on shutdown. Haven't tried forcing higher levels of RAM as I'm not stuffed recompiling the kernel for the umpteenth time, but I'd guess that upto mem=285M would work without corruption.

ii) Along with the above, when initially creating the pup_save file some file sizes are not possible due to corruption during the creation process. with 128MB of ram installed trying to make a pup_save file over 93MB crashes the system, with 256MB making a file over 8MB crashes the system.

I've worked around this by initially using 128MB of RAM to make a 64MB pup_save file. From there you are able to resize it to any size you wish without corruption with any amount of RAM...I have no idea why that happens.

- The devx module for 4.2.1 works fine, but compiling programs takes ages...nano took a good 20 mintues for make to finish.

- Installed NTP as per the guide in Beyond Linux From Scratch, the commands verbatim work just fine. I did use a newer version of NTP though, but all that needed changing was the directory name.

- Installed the openSSH pup for SSH access

- CUPS works as it should

- When booting X it always gives a 'cannot find /lib/modules/2.6.24.7/modules.dep' error, not that it stops it from starting but it erks me that its there.
Last edited by foreirongold on Fri 04 Sep 2009, 01:36, edited 1 time in total.

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#7 Post by ttuuxxx »

foreirongold wrote: - When booting X it always gives a 'cannot find /lib/modules/2.6.24.7/modules.dep' error, not that it stops it from starting but it erks me that its there.
Hi excellent solo-work, great reading, oh ya to fix your modules dep error
open a prompt and type
#depmod -a
that will build you a new /lib/modules/2.6.24.7/modules.dep (delete your old one if need be)
hope that helps :)
ttuuxxx
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

foreirongold
Posts: 12
Joined: Mon 29 Jun 2009, 01:00

#8 Post by foreirongold »

ttuuxxx wrote:
foreirongold wrote: - When booting X it always gives a 'cannot find /lib/modules/2.6.24.7/modules.dep' error, not that it stops it from starting but it erks me that its there.
Hi excellent solo-work, great reading, oh ya to fix your modules dep error
open a prompt and type
#depmod -a
that will build you a new /lib/modules/2.6.24.7/modules.dep (delete your old one if need be)
hope that helps :)
ttuuxxx
depmod -a doesn't work. The /lib/modules/2.6.24.7 folder doesn't exist on my system, I'm guessing its hidden away in the ramfs as this is frugal install, can't seem to find it anywhere.

It has to exist though because I put it inside the initrd when I was compiling the kernel...

Anyway, If anyone wants the scripts I've added, my kernel source/binary or pup_save I'm happy to make them available.

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#9 Post by ttuuxxx »

on 4.2 its located in pup_420.sfs ---> /lib/modules/2.6.25.16
2.14X its located in pup_214R.sfs---> /lib/modules/2.6.18.1,
So I'm thinking you have it in the wrong container, you might want to find it and move it
ttuuxxx
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

foreirongold
Posts: 12
Joined: Mon 29 Jun 2009, 01:00

#10 Post by foreirongold »

Just spent most of the night getting growler's version of AMP running on the N2200, this box is now a webserver!

here is the version I used.

Anyway, running the pet straight out under X crashed the system due to the dreaded memory corruption errors I keep on getting. I had to extract the contents of the pet and manually place all the files inside my pup_save using another puppy machine. From there I booted up the N2200 again just ran through the procedure outlined in the pinstall.sh script.(remember to mkdir /usr/local/var) mysql threw a plug-in shutdown error when making the database but that hasn't seemed to affected it.

Note that the extracted pet weighs in at around 30MB, so watch the space in your pup_save!

Hiawatha started up fine but then I found that php wasn't processing scripts, turned out the config file didn't enable php parsing, see growlers post near the bottom here on what you should change.

foreirongold
Posts: 12
Joined: Mon 29 Jun 2009, 01:00

#11 Post by foreirongold »

ttuuxxx wrote:on 4.2 its located in pup_420.sfs ---> /lib/modules/2.6.25.16
2.14X its located in pup_214R.sfs---> /lib/modules/2.6.18.1,
So I'm thinking you have it in the wrong container, you might want to find it and move it
ttuuxxx
In my case /lib/modules is actually a file containing the names of a few utilities on the system, not a directory holding kernel modules :S

Anyway, renamed that file and put the folder structure in its place. Copied the compiled modules from my kernel source and ran a depmod -a, to my surprise it ignored the modules for my 2.6.24.7 kernel and started looking for the 2.6.21.7 folder! No idea why it would be doing that...

I've achieved what I wanted from this system anyway, that being a CUPS and web server for a small network's intranet. The module issue a minor annoyance, its only effect on the system from what I can see apart from the one error starting X is that I think it might be the cause of mpg123 not compiling correctly.

gosgirl
Posts: 2
Joined: Fri 09 Oct 2009, 06:15

#12 Post by gosgirl »

I've worked around this by applying a kernel command line patch outlined here and then throwing in mem=256M, I lose the 32MB built-into the box but I at least get a stable system. I also threw in a few other commands to make the distro into a 'poor man's install,' which would allow the creation of a pup_save file on shutdown. Haven't tried forcing higher levels of RAM as I'm not stuffed recompiling the kernel for the umpteenth time, but I'd guess that upto mem=285M would work without corruption.




__________________
ncis dvd boxset
criminal minds dvd boxset
south park dvd boxset
house md dvd box set
Gilmore Girls dvd boxset

Rocktagon
Posts: 1
Joined: Fri 16 Oct 2009, 17:01

#13 Post by Rocktagon »

Hm, had anyone still a complete working Image? Because i didn't get a working Kernel wih all together. Maybe im to stupid ;)

I only need that Pearl is running, cause i want to use the Client for house automation, and this works with pearl.

Much thanks

Rock

P.s: E-Mail via PM.

foreirongold
Posts: 12
Joined: Mon 29 Jun 2009, 01:00

Lets try this again...

#14 Post by foreirongold »

Sorry about not replying, guess that what happens when email notifications are turned off :P

The kernel images are here

Kernels

The zip file contains 2 files:

Kernel.2x00 is a version with MEM=256M hardcoded into the kernel command line

kernel.nomemlim has no such limitation, rename to kernel.2x00 to use.

Both are version 2.6.24.7 for use with Puppy 4.2.1

Theres no way to change the commandline parameters without recompiling the kernel, the .config files for each kernel are in /proc/config.gz when you get the system running.

Due to my very bad upload speed I can't really post my pup_save file in a timely manner. Creating one from scratch would be easier.

So, in order to use this:

Get the kernel you want and rename to kernel.2x00
Grab the pup_421.sfs file
but both on an EXT2 or EXT3 formatted flash card, and you're good to go.

Take note of the pup_save.2fs issues in my previous post when creating it though.

The system will boot into X, but the system is alot more stable if you just let it boot into bash instead. I've got a few scripts that handle the RTC issue and the boot into bash, just need to find them. Let me know if you want it.

One more thing, the "shutdown" command doesn't work on the N2200's in X or bash. You need to use "reboot" which will place the unit into a sleep mode, from there you can safely turn it off.

Post Reply