Reply
Thread Tools
Posts: 466 | Thanked: 661 times | Joined on Jan 2009
#1
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:
  • javispedro for all the helpful posts in meego forums on open mode kernel and the open mode kernel thread here.
  • qole for previous work on easy-chroot
  • rcolistete for easy-chroot on Harmattan and on-device SDK work

References:

Open questions:
  • Where to get PR1.3 source and config?
  • Why does my initial make command produce the release error?

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
Here is the more brief version of kernel-only flash:
Code:
flasher -F img.bin -k zImageC --flash-only=kernel -f -R
See the other posts on flashing for different variations of the flasher command to learn more.

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
dpkg -i /home/user/.downloads/easy-chroot_0.2.0-1harmattan1_armel.deb
then follow the steps to get SDK where it says "download my Harmattan SDK modified image"

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
I like to mount a separate dir for sources and compiling by creating an image file:
on the device as root do
Code:
dd if=/dev/zero of=/home/user/MyDocs/src.img.ext3 bs=1M count=2222
then
Code:
/sbin/mkfs.ext3 /home/user/MyDocs/src.img.ext3
Code:
mkdir /home/user/SDK
as root, mount the sdk image with:
Code:
qmount /home/user/MyDocs/harmattan-sdk.img.ext3 /home/user/SDK
Mount the additional space with:
Code:
qmount /home/user/MyDocs/src.img.ext3 /home/user/SDK/usr/src
Now qchroot:
Code:
qchroot /home/user/MyDocs/harmattan-sdk.img.ext3 /home/user/SDK
Create a place to compile the kernel sources:
Code:
mkdir -p /usr/src/dpkg/k/kernel/
change to the compiling location:
Code:
cd /usr/src/dpkg/k/kernel
get the kernel source:
Code:
apt-get source kernel
Get the openmode patch:
Apply the open-mode patch from one dir up from kernel source:
Code:
 patch -p0 < openmode.patch
Copy the config to the kernel directory:
Code:
cp arch/arm/configs/rm581_defconfig .config
Make the old config
Code:
make oldconfig
Modify the config to have the modules you want:
Code:
make menuconfig
(before this will work, you need the libncurses5-dev package in the SDK chroot). On the N9 with no keyboard, you need to use font size 6 or 7 in portrait mode for the terminal to be large enough for menu config.

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
Compile with
Code:
make ARCH=arm zImage
I get this error (no idea why, I assume it's due to not using dpkg scripts that read dpkg-changelog):

Code:
CHK include/linux/utsrelease.h 

"2.6.32.48cat:include/config/kernel.release:Nosuchfileordirectory-dfl61" exceeds 64 characters 

make: *** [include/linux/utsrelease.h] Error 1
If anybody knows why this happens, please let me know so I can do this some proper way rather than the workaround below.

I work around it by first editing Makefile and appending a letter (in this case, "c") to the EXTRAVERSION such as:
Code:
    VERSION = 2 
    PATCHLEVEL = 6 
    SUBLEVEL = 32 
    EXTRAVERSION = .48c
Then I modify the include/config/kernel.release file to match the version string from the Makefile with this in its contents:
Code:
2.6.32.48c-dfl61
Then compile again with
Code:
make ARCH=arm zImage
Compile the modules with
Code:
make ARCH=arm modules modules_install
From OUTSIDE the chroot and as root, copy the modules directory from /home/user/SDK/lib/modules/2.6.32.48c-dfl61-20115101 to /lib/modules and do a
Code:
depmod -a 2.6.32.48c-dfl61-20115101
Copy the zImage from /home/user/SDK/usr/src/dpkg/k/kernel/kernel-2.6.32/arch/arm/boot to MyDocs

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
START THIS WHOLE THING OVER FROM SCRATCH

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

Last edited by jackburton; 2013-08-22 at 14:12. Reason: Updates
 

The Following 26 Users Say Thank You to jackburton For This Useful Post:
mrsellout's Avatar
Posts: 889 | Thanked: 2,087 times | Joined on Sep 2010 @ Manchester
#2
Originally Posted by jackburton View Post
...
Open questions:
  • Where to get PR1.3 source and config?
...
Is the following what you're after?
http://depot.javispedro.com/nit/harm/srcs/
 

The Following 3 Users Say Thank You to mrsellout For This Useful Post:
Posts: 466 | Thanked: 661 times | Joined on Jan 2009
#3
Originally Posted by mrsellout View Post
Is the following what you're after?
http://depot.javispedro.com/nit/harm/srcs/
I think that will work! Thanks.
 

The Following User Says Thank You to jackburton For This Useful Post:
bibek's Avatar
Posts: 368 | Thanked: 826 times | Joined on May 2012 @ India
#4
Thanks a lot. Delighted to see such posts.
__________________
Blob | ClipBook | Qcal | DoMee | ShareBoard | TMO Forum App
 

The Following 2 Users Say Thank You to bibek For This Useful Post:
Posts: 498 | Thanked: 836 times | Joined on Jun 2012 @ Finland
#5
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!
 
Posts: 466 | Thanked: 661 times | Joined on Jan 2009
#6
Originally Posted by Boxeri View Post
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!
This isn't really all too advanced actually. It's just a lot of steps, but for the most part the rules for compiling a kernel are same as documented all over the web. The only parts I needed to really learn were the flasher pieces. The SDK image in my thanks section is what really made this happen. With that, I saved time by not having to setup a debian/ubuntu machine/VM and do all the scratchbox stuff. Plus, I. could screw around with it when I was out and about. I literally did all the compiling on the N950. It takes more time compiling on the device, but feels more natural to me.
 

The Following User Says Thank You to jackburton For This Useful Post:
Posts: 466 | Thanked: 661 times | Joined on Jan 2009
#7
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...
 

The Following User Says Thank You to jackburton For This Useful Post:
Posts: 1,067 | Thanked: 2,383 times | Joined on Jan 2012 @ Finland
#8
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
__________________
IRC: jonni@freenode
Sailfish: ¤ Qt5 SailfishTouchExample ¤ Qt5 MultiPointTouchArea Example ¤ ipaddress ¤ stoken ¤ Sailbox (Dropbox client) ¤
Harmattan: ¤ Presence VNC for Harmattan ¤ Live-F1 ¤ BTinput-terminal ¤ BabyLock ¤ BabyLock Trial ¤ QML TextTV ¤
Disclaimer: all my posts in this forum are personal trolling and I never post in any official capacity on behalf of any company.
 

The Following 3 Users Say Thank You to rainisto For This Useful Post:
Posts: 466 | Thanked: 661 times | Joined on Jan 2009
#9
Originally Posted by rainisto View Post
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
Thanks for the info!

If I want to use my own config inside dpkg-buildpackage, where should I specify that?
 
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#10
Originally Posted by jackburton View Post
I literally did all the compiling on the N950. It takes more time compiling on the device, but feels more natural to me.
How much time ?
__________________
Python, C/C++, Qt and CAS developer. For Maemo/MeeGo/Sailfish :
Integral, Derivative, Limit - calculating mathematical integrals, derivatives and limits. SymPy - Computer Algebra System.
MatPlotLib - 2D & 3D plots in Python. IPython - Python interactive shell.
-- My blog about mobile & scientific computing ---
Sailfish : Sony Xperia X, Gemini, Jolla, Jolla C, Jolla Tablet, Nexus 4. Nokia N9, N900, N810.
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 02:54.