![]() |
[HOWTO] Compiling new kernels on Harmattan device
I finally managed to compile and flash a custom kernel for my N950 and N9 to get bluetooth pan tethering working with NAT modules. I am so happy now with the PAN sharing that I can now move from Maemo5/N900 to Harmattan platform device!
I first did this on my N950. I then did it also on the N9. The SDK doesn't seem to have sources for PR1.3 used on N9. Anybody know where to get that? Here I've documented the exact steps I took. There are lots of posts about open mode kernels and how to flash the ones that exist already, but I could not find information on the steps used to produce those kernels in order to customize them. Hope this helps others who want to compile their own kernels. This post is still a work in progress. I will try to make it prettier over time. Just wanted to get the information out there. Thanks:
References:
Open questions:
Downloads You can download my nat-enabled kernel and modules from here: http://www.ctrl-h.net/nokia/harmattan/pr1.2/ http://www.ctrl-h.net/nokia/harmatta...3/kernel/btlc/ http://www.ctrl-h.net/nokia/harmatta.../kernel/lopan/ Instructions: Follow the instructions to get the firmware and emmc for your device: http://talk.maemo.org/showthread.php?t=82693 Download the 3.12 Harmattan flasher from: http://skeiron.org/tablets-dev/maemo-dev-env-downloads/ Download the open mode kernel (you'll use this to be able to chroot and compile on the device itself. It's also a good way to learn how to flash the kernel before you build your own): Nokia N950 PR1.2: http://maemo.cloud-7.de/HARM/N9/1.2/openmode-kernel/ Nokia N9 PR1.3: http://maemo.cloud-7.de/HARM/N9/1.3/openmode-kernel/ Flash the open mode kernel: (Here I am wiping the whole device, you may have reason not to do this, though you'll definitely want to do this at some point as described later in the instructions): Code:
flasher -F ../../navifirmplus_1.7/NaviFirm+\ 1.7/Fw/059J228/DFL61_HARMATTAN_40.2012.21-3_PR_LEGACY_006-OEM1-958_ARM.bin -F ../../navifirmplus_1.7/NaviFirm+\ 1.7/Fw/059J228/DFL61_HARMATTAN_40.2012.13-7.MEA_EMMC_MEA.bin -k zImage-2.6.32.54-dfl61-20121301 -f Code:
flasher -F img.bin -k zImageC --flash-only=kernel -f -R Unplug the phone from the computer and it will boot to the open mode kernel Configure a network connection Enable developer-mode (settings; security; developer-mode) Check open mode with the command "accli -I" after the phone reboots. You should see "open" (you probably already saw a warning on boot which confirms this, too. You can clear this warning in later steps). Follow the steps here to get an SDK chroot on the device: http://talk.maemo.org/showthread.php?t=86158 I used the steps on that post in 2B Get easy-chroot package according to: http://talk.maemo.org/showthread.php?p=1247020 I do this: I download the .deb then Code:
devel-su Download the lzma direct to the N9 or using a computer and transfer using USB. Extract it according to the instructions Code:
xz -d harmattan-sdk.img.ext3.lzma on the device as root do Code:
dd if=/dev/zero of=/home/user/MyDocs/src.img.ext3 bs=1M count=2222 Code:
/sbin/mkfs.ext3 /home/user/MyDocs/src.img.ext3 Code:
mkdir /home/user/SDK Code:
qmount /home/user/MyDocs/harmattan-sdk.img.ext3 /home/user/SDK Code:
qmount /home/user/MyDocs/src.img.ext3 /home/user/SDK/usr/src Code:
qchroot /home/user/MyDocs/harmattan-sdk.img.ext3 /home/user/SDK Code:
mkdir -p /usr/src/dpkg/k/kernel/ Code:
cd /usr/src/dpkg/k/kernel Code:
apt-get source kernel Apply the open-mode patch from one dir up from kernel source: Code:
patch -p0 < openmode.patch Code:
cp arch/arm/configs/rm581_defconfig .config Code:
make oldconfig Code:
make menuconfig Here are the places in menu config that I changed to enable IP NAT and MASQUERADE for Bluetooth tethering: Networking Support; Networking Options; Network packet filtering framework (netfilter); Core Netfilter Configuration; Netfilter connection Tracking Support <M>; Networking Support; Networking Options; Network packet filtering framework (netfilter); IP: Netfilter Configuration; IPv4 connection tracking support (required for NAT) <M>, Full NAT <M>, MASQUERADE target support <M> A few additional packages are needed in order to compile. Do Code:
apt-get install diff lzop Code:
make ARCH=arm zImage Code:
CHK include/linux/utsrelease.h I work around it by first editing Makefile and appending a letter (in this case, "c") to the EXTRAVERSION such as: Code:
VERSION = 2 Code:
2.6.32.48c-dfl61 Code:
make ARCH=arm zImage Code:
make ARCH=arm modules modules_install Code:
depmod -a 2.6.32.48c-dfl61-20115101 Attach to the computer doing the flashing and mount USB (since the SDK image is in MyDocs, you may need to reboot before mass storage will work again to transfer the kernel. Or you could sftp off or sftp in to grab it). Get the kernel off your N9 or N950 via USB or SFTP upload/download Power off Flash the new kernel and reboot! There are several ways to reflash. If you just want to test flashing the kernel, then something like this will work: Code:
flasher -F img.bin -k zImageC --flash-only=kernel -f -R Repeated Password Prompts With open mode kernels, you will need to flash the whole system so that new aegis keys for open mode will be created on first boot. If you don't do this, then your passwords for services won't get saved and you'll have to keep re-entering them in, which is very annoying! Based on what I've read on the forums, doing application-based backup/restore *should* work after doing a full wipe. Code:
flasher -F img.bin -F emmc.bin -k zImageC -f -R Warranty VOID Message If you don't like the warranty void message, there are a couple of steps before you even start this whole thing (see http://talk.maemo.org/showpost.php?p...ostcount=358): Flash a completely stock system. Install developer tools run: Code:
disclaimer-cal remove View-openmode When you flash the new kernel, add the --suppress-warranty-warning flag. E.g. Code:
flasher -F img.bin -F emmc.bin -k zImageC --suppress-waranty-warning -f -R |
Re: [HOWTO] Compiling new kernels on Harmattan device
Quote:
http://depot.javispedro.com/nit/harm/srcs/ |
Re: [HOWTO] Compiling new kernels on Harmattan device
Quote:
|
Thanks a lot. Delighted to see such posts. :)
|
Re: [HOWTO] Compiling new kernels on Harmattan device
Great and amazing work! Bluetooth tethering would be great to have. This might be a bit too advanced for me, but with such nice instructions I am tempted to learn and try it with my back up device.
Great job, really appriciated! |
Re: [HOWTO] Compiling new kernels on Harmattan device
Quote:
|
Re: [HOWTO] Compiling new kernels on Harmattan device
So now that I have Bluetooth tethering working, does anybody know if the Bluetooth 4 work mentioned in these forums got anywhere? Tethering is now only limited by Bluetooth 2 speeds. Would love more... ;)
|
Re: [HOWTO] Compiling new kernels on Harmattan device
proper way to build kernel is ofcourse to use dpkg-buildpackage.
And you never need to use --suppress-warranty-warning, as that was just added as internal joke to flasher binary, in reality it doesn't do anything :) |
Re: [HOWTO] Compiling new kernels on Harmattan device
Quote:
If I want to use my own config inside dpkg-buildpackage, where should I specify that? |
Re: [HOWTO] Compiling new kernels on Harmattan device
Quote:
|
All times are GMT. The time now is 23:38. |
vBulletin® Version 3.8.8