User:Jebba/Kernel

Contents

[edit] Kernel

Stock kernel:

uname -a
Linux Nokia-N900-42-11 2.6.28-omap1 #1 PREEMPT Wed Oct 28 15:32:55 EET 2009 armv7l unknown

kernel, kernel-modules, kernel-flasher: 2.6.28-20094102.3+0m5

[edit] Custom Kernel Modules

I have built a pile of kernel modules which should work with the stock N900 kernel. See here:

http://www.freemoe.org/users/jebba/kernel/modules/

[edit] Installing my custom kernel

Linux Nokia-N900-42-11 2.6.28-omap1-jebba9-g649dffc #1 PREEMPT Mon Jan 11 16:25:16 MST 2010 armv7l unknown


I have built custom kernel packages closely based on the standard kernel that ships with the N900. Differences:

  • NOTE: this kernel now has NAT and a bunch of filesystems and other misc. See the latest changes
  • FRAMEBUFFER_CONSOLE=y - This fantastic option means you can see console when the kernel boots up, so you see all the text you usually see when booting up a Linux kernel.
  • IKCONFIG, IKCONFIG_PROC=y - The kernel configuration is available in /proc. To grab it:
zcat /proc/config.gz
  • CONFIG_LOGO=y, CONFIG_LOGO_LINUX_CLUT224=y - Tux, the Linux penguin, at boot! :)
  • The kernel name is 2.6.28-omap1-jebba9 so as to not confuse it with the stock kernel.

You can install this kernel via my repo with apt-get (untested), or manually, which is recommended for now. Procedure (assuming you are running the kernel that ships with the device):

  • Make a backup of your current kernel's modules. That way if you want to revert, you can flash it via USB cable and the modules will be there. (You can also revert via dpkg, but this is just in case of "emergencies").
cp -a /lib/modules/2.6.28-omap1 /lib/modules/2.6.28-omap1.orig
  • Grab my kernels with wget or whatever (check the dir for more recent versions too).
wget \
http://www.freemoe.org/users/jebba/dists/unstable/main/binary-armel/kernel_2.6.28-20094102.6+0m14_armel.deb \
http://www.freemoe.org/users/jebba/dists/unstable/main/binary-armel/kernel-modules_2.6.28-20094102.6+0m14_armel.deb \
http://www.freemoe.org/users/jebba/dists/unstable/main/binary-armel/kernel-flasher_2.6.28-20094102.6+0m14_armel.deb
  • Install the .debs with dpkg. Note the flasher has to be installed last. If you install them with dpkg all at once, dpkg will prioritize the flasher first, so it won't move the kernel into place. Point of no return:
dpkg -i \
kernel_2.6.28-20094102.6+0m14_armel.deb \
kernel-modules_2.6.28-20094102.6+0m14_armel.deb
  • Now install the flasher, which will automatically flash when installed:
dpkg -i kernel-flasher_2.6.28-20094102.6+0m14_armel.deb 
  • Ok, so the kernel is there, but lets move the original stock modules back into place so you can flash the zImage via flasher-3.5 and USB cable should it be necessary. First we need to remove the mostly empty old dir, then copy the backup:
rm -rf /lib/modules/2.6.28-omap1
cp -a /lib/modules/2.6.28-omap1.orig /lib/modules/2.6.28-omap1
  • Now just reboot, yee haw!
sudo reboot
  • Enjoy. :)

[edit] Flashing Kernel

[edit] Notes

  • The docs I can find about this all look pretty antiquated.
  • The stock system runs with 62 kernel modules loaded, including things like ext3 and fat.
  • The kernel debs that are installed are: kernel, kernel-flasher ("Linux kernel updater"), kernel-modules.


[edit] Compile custom kernel

I followed the procedure in the Maemo Kernel Guide, without making changes. This gave me a bootable kernel. :)

sb-conf select FREMANTLE_ARMEL

sb-conf setup MaemoKernel \
-c cs2007q3-glibc2.5-arm7 \
-d qemu:perl:svn:apt-https -t /scratchbox/devkits/qemu/bin/qemu-arm-sb

sb-conf select MaemoKernel

sb-conf rs MaemoKernel \
/home/jebba/maemo-sdk-rootstrap_5.0_armel.tgz

sb-conf in MaemoKernel -edFL

# disable other stuff in apt sources.list

mkdir ~/maemo_kernel

sb-conf select MaemoKernel
fakeroot apt-get update
cd ~/maemo_kernel
apt-get source kernel
cd kernel-2.6.28

make EXTRAVERSION=-omap1 bzImage
ls -lh arch/arm/boot/zImage

# flash the thing
flasher-3.5 -f -k /scratchbox/users/jebba/home/jebba/\
maemo_kernel/kernel-2.6.28/arch/arm/boot/zImage

# wow, sure flashes fast, like in 1 second


  • To unbrick if something goes wrong, unpack the main N900 .bin flash image and flash with the kernel from there. See unpacking flash image section.
  • stskeeps, the Mer developer, says he builds his kernels fine in FREMANTLE_ARMEL, so perhaps you don't even need to switch to MaemoKernel sandbox. In other words, just build in here:
sb-conf select FREMANTLE_ARMEL

[edit] My build scripts and .configs

I set up a little git repo of the lame scripts I use to build kernel .debs and the configs. You can clone it thusly:

git clone http://www.freemoe.org/users/jebba/scratchbox/kernel/.git/


[edit] Random kernel notes

  • "SmartReflex can perform continuous dynamic voltage scaling around the nominal operating point voltage according to silicon characteristics and operating conditions. Enabling SmartReflex reduces power consumption. Please note, that by default SmartReflex is only initialized. To enable the automatic voltage compensation for VDD1 and VDD2, user must write 1 to /sys/power/sr_vddX_autocomp, where X is 1 or 2.
~ $ cat  /sys/power/sr_vdd1_autocomp
0
~ $ cat  /sys/power/sr_vdd2_autocomp
0


  • Enable framebuffer console so bootup messages can be seen.

[edit] See Also

  • Compiling the kernel - "This is an article from the old midgard wiki that hasn't yet been fully updated for this wiki, please update it."