Skip to content

ssvb/linux-n810

 
 

Repository files navigation

This is a reasonable stable kernel for Nokia N810, based on mainline 2.6.38.8 version with the patches from openwrt. Looks like openwrt folks are the most active users of recent mainline kernels on Nokia N810 and maintain their patchset in a more or less good shape.

!!! WARNING !!! be careful with battery charging and use it at your own risk. It may be safer to first fully charge the battery with maemo firmware and then experiment with running gentoo only for a few hours before it runs out of juice. To be honest, I have not experimented with this stuff much (or more like have not experimented with it at all). Though you may search for openwrt n810 battery charging information, read the guides and try to get this stuff working properly.

The included n810_nfs_defconfig is preconfigured to boot the system over NFS from /mnt/armv6-nfs-root directory on your desktop PC (see CONFIG_CMDLINE option if you want to tweak this).

Using gentoo linux with this kernel and booting it over NFS

Step one: compile the kernel and flash it to N810

First of all, you need an ARM crosscompiler. If you don't have it already, then you can do

# emerge dev-util/crossdev
# crossdev -S arm-none-linux-gnueabi

Then we can compile the kernel itself. It is also easy:

$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- n810_nfs_defconfig
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- -j8 bzImage

After this step, you get a kernel binary arch/arm/boot/zImage. Using the maemo flasher tool, this kernel can be either just booted:

$ flasher-3.5 -k arch/arm/boot/zImage -l -b

or flashed to the device, replacing the old kernel:

$ flasher-3.5 -k arch/arm/boot/zImage -f

In both cases, the flasher will wait for the N810 to be turned on or rebooted while it is plugged to your PC via usb cable. Alternatively it should be possible to use the open source 0xFFFF flasher.

Now the kernel is ready to boot the system over NFS from your PC.

Step two: setting up the network on your desktop PC

First we want to set a network connection between N810 and your PC. Let's configure usb-n810 network interface and set it to use 192.168.4.15 IP address for N810 and 192.168.4.14 IP address for your PC.

First edit /etc/udev/rules.d/70-persistent-net.rules and add the following line:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="9a:49:12:0f:53:14", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="usb*", NAME="usb-n810"

This ensures that the device with MAC address 9a:49:12:0f:53:14 (see CONFIG_CMDLINE in n810_nfs_defconfig) will be assigned a unique name usb-n810.

Then edit /etc/conf.d/net and add the following line to it:

config_usb_n810=( "192.168.4.14 netmask 255.255.255.0" )

Make a symlink:

# ln -s /etc/init.d/net.lo /etc/init.d/net.usb-n810

Edit /etc/hosts and add

192.168.4.15	n810

Run iptables to configure NAT and give N810 access to the Internet via your PC, more details are in Gentoo Home Router Guide

# First we flush our current rules
iptables -F
iptables -t nat -F

# Setup default policies to handle unmatched traffic
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP

# Copy and paste these examples ...
export LAN=usb-n810
export WAN=eth0

# Finally we add the rules for NAT
iptables -I FORWARD -i ${LAN} -d 192.168.0.0/255.255.0.0 -j DROP
iptables -A FORWARD -i ${LAN} -s 192.168.0.0/255.255.0.0 -j ACCEPT
iptables -A FORWARD -i ${WAN} -d 192.168.0.0/255.255.0.0 -j ACCEPT
iptables -t nat -A POSTROUTING -o ${WAN} -j MASQUERADE

# Tell the kernel that ip forwarding is OK
echo 1 > /proc/sys/net/ipv4/ip_forward
for f in /proc/sys/net/ipv4/conf/*/rp_filter ; do echo 1 > $f ; done

Step three: preparing gentoo rootfs and booting the system

Now we need to get armv6 gentoo stage3 tarball from one of the mirrors and unpack it to /mnt/armv6-nfs-root, also unpack portage snapshot and install nfs-utils:

# mkdir /mnt/armv6-nfs-root
# tar -xjpf stage3-armv6j-20120316.tar.bz2 -C /mnt/armv6-nfs-root
# tar -xjf portage-latest.tar.bz2 -C /mnt/armv6-nfs-root/usr
# emerge net-fs/nfs-utils
# rc-update add nfs default

Then edit /etc/exports adding

/mnt/armv6-nfs-root 192.168.4.0/24(rw,no_root_squash,no_all_squash,no_subtree_check,async)

And start nfs:

# /etc/init.d/nfs start

Now the system should be bootable on N810, but we also want ssh access to it. In order to do this, we can configure sshd to start on system boot and add your public ssh key:

# ln -s /etc/init.d/sshd /mnt/armv6-nfs-root/etc/runlevels/default
# mkdir /mnt/armv6-nfs-root/root/.ssh
# cp /home/yourusername/.ssh/id_rsa.pub /mnt/armv6-nfs-root/root/.ssh/authorized_keys

Finally in order to get some kind of DNS, /etc/resolv.conf is better to be also updated:

echo "nameserver 8.8.8.8" > /mnt/armv6-nfs-root/etc/resolv.conf

That's all. You can connect N810 via usb cable, turn it on and wait till gentoo boots. Then do "ssh root@n810".

About

Linux kernel source tree

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 97.7%
  • Assembly 2.2%
  • Perl 0.1%
  • Shell 0.0%
  • Python 0.0%
  • C++ 0.0%