Nokia N800 development experience

Source: Internet
Author: User
Tags unpack

Source: Liu Jianwen | academic half-it Song-Wen (http://arttech.us)

 

I am a theoretical emperor and want to do more things from a metaphysical point of view. One of the evidence of this conclusion is that I decided to purchase a handheld computer for experiments nearly a year after studying embedded Linux. At the beginning of the year, a friend suggested that I purchase a Development Board to quickly master development technologies through experiments. However, I do not agree. First, I think basic skills are more important. Development Technologies can be learned in a short period of time. What are basic skills, deep understanding of the kernel structure, and a thorough understanding of hardware? Second, I think what else can I do after I buy a Development Board for 3 to five hundred shopping? The result of the previous thought was that I purchased a machine for experiment at the end of October. The result of the thought was that I purchased the N800 of Nokia instead of a one-time license board.

So far, I have made two simple experiments on N800. This article records the entire experiment process, and does not seek to be the same, but I want to record it as a reference.

In the first experiment, a hello module is compiled to N800 to verify the availability of the development environment and hardware. In the second experiment, a new kernel is customized to N800, the touch screen and keypad in the new kernel are loaded as modules, rather than the default built-in ones.

Nokia N800 device metadata

  • Omap2420Microprocessor
    With a native speed of 400 MHz
  • Memory
    : 128 MIB of Ram and 256 MIB of flash memory
  • Connectivity
    : IEEE 802.11 B/g, Bluetooth 2.0 (Dun, OPP, FTP, HFP, hid profiles as well as a2dp/avrcp and Pan via third party emulation ), and USB 2.0 OTG high-speed.
  • Display
    & Resolution: pressure-sensitive resistive touch-screen LCD 4.1 inches 800 × 480 at 225 DPI
  • Expansion
    : 2 full-sized secure digital card slots
  • Camera
    : Built-in pop-up rotating webcam.
  • Audio
    : Microphone, stereo speakers, FM radio tuner, 3.5-mm headphone jack (compatible with standard stereo headphones, but also containing a fourth pin with microphone input ).
Main device chip (Controller) Model
  • Omap2420 n8x0 System-on-chip
  • TMS320 c55x n8x0 DSP
  • OMAP video n8x0 video output
  • Powervr mbx n8x0 OpenGL ES and openvg Acceleration
  • OMAP boot tags n8x0 provides boot information from bootloader (Nolo)
  • Omap mmc n8x0 SD/MMC cards
  • Tcm825x n8x0 webcam + I2C bus
  • Tea5761 N800 FM radio
  • Blizzard n8x0 LCD Controller
  • Menelus n8x0 gpio extender + I2C bus ++ ???
  • Tmp105 n8x0 temperature sensor (menelus gpio)
  • Mcspi n8x0 SPI bus
  • Sharp ls041y3 n8x0 LCD Panel (compatible with mipid)
  • Cx3110x/stlc4550 n8x0 802.11b/g WiFi
  • Tsc2301 N800 touchscreen + keypad + gpio + audio
  • Onenand n8x0 flash memory
  • Tusb6010 n8x0 USB
Development Process
  • Build a Development Environment

    • Define Project Layout
    • Build a cross-compilation development environment
    • Connect N800 to PC through USB
  • Experiment 1-Hello Test Module
  • Experiment 2-custom modular Kernel
    • Compile the kernel and Driver Module
    • Modify initramfs
    • Firing
Build a development environment and define the Project Layout
  • Project Home Directory :~ /N800
  • Kernel SRC :~ /N800/maemo/kernel-source-Diablo/kernel-Source
  • Cross-compilation tool chain :~ /N800/cross-Tools
  • Auxiliary build tool :~ /N800/build-Tools
  • Test items :~ /N800/projects/hello_module | modulize_kernel
Build a cross-compilation development environment

1. Download maemo4.1 source code and patch: http://repository.maemo.org/pool/maemo4.1.2/free/k/kernel-source-diablo/

2. Unpack and make up:

$ Patch-P2 <kernel-source-diablo_2.6.21-200842maemo1.diff

3. Install pre-build cross-compilation toolchain: http://www.codesourcery.com/sgpp/lite/arm/releases/2005q3-2

This is a pre-compiled tool chain of the commercial free version, which is directly decompressed ~ /N800/cross-toolchain/

4. Add a shell search path

$ Export Path = ~ /N800/cross-toolchain/bin: $ path

5. Test the availability of the source code tree and cross-compilation tool chain

$ Cd ~ /N800/maemo/kernel-source-Diablo/kernel-Source
$ Cp arch/ARM/configs/nokia_2420_defconfig. confg
$ Make arch = arm cross_compile = arm-None-Linux-gnueabi-bzimage

This official source code has a symbolic declaration Missing: scripts/MoD/sumversion. c path_max undeclared
Solution: modifying linux-2.6.x/scripts/MoD/sumversion. C, and adding # include <limits. h> fixes this issue.

After the kernel is compiled successfully, it is proved that the tool chain and source code tree are available. Compile the source code tree to prepare for compiling external modules (you can also execute the kbuild interface make modules_prepare), because the compilation of external modules will depend on some kernel information, like the kernel output symbol (module. symvers ). For details, see the kernel document/kbuild/modules.txt.

--- 2.4 preparing the kernel tree for module build

To make sure the kernel contains the information required to build external modules the target 'Les les _ prepare' must be used. 'modules' _ prepare' exists solely as a simple way to prepare a kernel source tree for Building external modules. note: modules_prepare will not build module. symvers even if config_modversions is set. therefore a full kernel build needs to be executed to make module versioning work.

 

Connect N800 to the development PC through USB (I use fedora 13) at the fedora end

1. Enable USB networking support in the kernel.

# USB network adapters #
Config_usb_usbnet = m
Config_usb_net_cdcether = m

2. Install the USB net Module

Linux-PC: $ modprobe usbnet

3. Configure the USB Network Interface

By using the IFUP configuration file (/etc/sysconfig/network-scripts/ifcfg-usb0:

Device = usb0
Bootproto = static
Ipaddr = 192.168.2.14

# Ipaddr = 10.0.1.2/24 shoshould imply this...

# But its support code seems to be buggy.

Broadcast = 192.168.2.255

Netmask = 255.255.255.0

Network = 192.168.2.0

# This is likely to break sometime

Gateway = 192.168.2.1

Onboot = Yes

4. Enable Network Interfaces

Linux-PC: $ ifup usb 0

N800 end

1. Obtain the root permission and install the ether_over_usb module (g_ether.ko ):

There are two ways to obtain the root permission: first, enable the R & D mode of the machine and use gainroot; second, install the rootsh package and use the root command to obtain the most permissions:

Nokia-N800: $ id uid = 29999 (User) gid = 29999 (users)
# If use R & D Mode
Nokia-N800: $ sudo/usr/sbin/gainroot

# Or use rootsh
Nokia-N800: $ Root
Nokia-N800: # insmod/mnt/initfs/lib/modules/2.6.18-omap1/g_ether.ko

2. Enable Network Interfaces

Nokia-N800: # ifup usb 0

3. Test connectivity

Nokia-N800: # Ping 192.168.2.14

If no connection is available, unplug the USB cable.

Use SSH to log on

Linux-PC $ ssh-l root 192.168.2.15
PW: 111111 (this password is set when OpenSSH is installed)

Transfer File Linux-PC $ SCP ~ /N800/projects/modulize_kernel/tsc23020.kp.ko root@192.168.2.15:

Experiment 1-Hello Test Module

1. Compile the source file hello_mod.c.

01 

/* hello_mod.c */


02

#include <linux/init.h>


03

#include <linux/module.h>


04

#include <linux/kernel.h>


05


06

static int

hello_init

(

void

)


07

{


08

printk

(

KERN_ALERT "Hello, world

/n

"

);


09

return

0

;


10

}


11


12

static void

hello_exit

(

void

)


13

{


14

printk

(

KERN_ALERT "Goodbye, cruel world

/n

"

);


15

}


16


17

module_init

(

hello_init);


18

module_exit

(

hello_exit);


19

MODULE_LICENSE

(

"GPL"

);


 

2. Compile the kbuild makefile

01 

# Makefile for the hello module


02

obj-m :=

hello_mod.o
03

KDIR :=

~/

n800/

maemo/

kernel-source-diablo/

kernel-source
04

PWD := $(

shell

pwd)


05

default:


06

$(

MAKE) -

C $(

KDIR)

M=$(

PWD)

modules

 

3. Compile

$ Cd ~ /N800/projects/hello_module
$ Export Path = ~ /N800/cross-toolchain/bin: $ path

$ Make arch = arm cross_compile = arm-None-Linux-gnueabi-

4. Test the process of downloading the compiled hello_mod.ko to N800 through SSH.

Experiment 2-customize the modular kernel to compile the kernel and Driver Module

1. Configure the kernel

The configuration task is to change the keyboard and touch screen drivers to modules, and the official kernel is build-in.

$ Cd ~ /N800/maemo/kernel-source-Diablo/kernel-Source
$ Cp arch/ARM/configs/nokia_2420_defconfig. config
# The configuration file library (ARCH/ARM/configs) also has an n800_defconfig, which is not suitable for os2008
$ Make menuconfig

2. The configuration items are as follows. You can find the location in the configuration program. The configuration process is omitted.

Config_keyboard_tsc2301 = m
Config_touchscreen_tsc2301 = m

3. Check the configuration result:

$ Cat. config | grep tsc2301
Config_keyboard_tsc2301 = m
Config_touchscreen_tsc2301 = m

Config_spi_tsc2301 = y

Config_spi_tsc2301_audio = y

4. Compile the kernel

$ Export Path = ~ /N800/cross-toolchain/bin: $ path
$ Export arch = arm cross_compile = arm-None-Linux-gnueabi-
$ Make zimage

$ Cp arch/ARM/boot/zimage ~ /N800/projects/modulize_kernel

5. Compilation Module

$ Install_mod_path = ~ /N800/projects/modulize_kernel
$ Make modules
$ Make modules_install

Modify initramfs

Initramfs is a new implementation of kernel's [Front root file system] boot function (they use a new concept called early-userspace) in version 2.6. The first version of initrd is well known. Initramfs is no longer a virtual disk outside the core, but an image of the memory root file system in the core. filesystem is the tempfs implemented by the cache mechanism. In short, initramfs is the root file system (Object dump) of the kernel running in memory to the disk. In order to achieve better flexibility, the new version of the kernel's [Front root file system] still provides the [off-core kernel] configuration method. The appearance of the off-core configuration is similar to that of initrd, but it is completely different from the concept. The kernel uses completely different code to interpret the original root file system. initramfs is only a cpio file, and after bootloader is transferred to the memory, the kernel automatically identifies and links.

1. Download the firmware (http://tablets-dev.nokia.com/nokia_N800.php
) And unpack it ~ /N800/firmware

2. download and install the official scratch program flash3.5 (an open-source scratch program 0 xFFFF can also be used here) and decompress it directly ~ /N800/build-tools/flasher/

  • Flash3.5: http://tablets-dev.nokia.com/maemo-dev-env-downloads.php
  • 0 xFFFF: http://www.nopcode.org/0xFFFF? P = home

3. Unpack the firmware to./firmware/43-7-fiasco.

$ Cd ~ /N800/firmware
$ Mkdir 43-7-fiasco; CD 43-7-fiasco
$ ~ N800/build-tools/flasher-3.5-f ~ /N800/firmware/RX-34_DIABLO_5.2008.43-7_PR_COMBINED_MR0_ARM.bin-u

4. initramfs. jffs2 is a jffs2 image.

$ Mknod/tmp/mtdblock0 B 31 0
$ Mkdir/mnt/initfs
$ Modprobe Loop
$ Losetup/dev/loop0 ~ // N800/firmware/43-7-fiasco/initfs-0.95.22-200842maemo1w38b3

$ Modprobe mtdblock

$ Modprobe block2mtd

# Note the, 128kib is needed (on 2.6.26 at least) to set the eraseblock size.

$ Echo "/dev/loop0, 128kib">/sys/module/block2mtd/parameters/block2mtd

$ Modprobe jffs2

$ Mount-T jffs2/tmp/mtdblock0/mnt/initfs/

5. The virtual disk cannot be directly modified and must be copied. After modification, use MTD tool (mkfs. jffs2) to recreate the initramfs image.

$ Mkdir/mnt/tmp/initramfs
$ CP-A/mnt/initfs // MNT/tmp/initramfs

6. Copy the driver module and modify the startup script linuxrc.

$ CP ~ /N800/projects/modulize_kernel/tsc23020.kp.ko/mnt/tmp/initramfs/lib/modules/omapxxx/
$ CP ~ /N800/projects/modulize_kernel/tsc23020.ts.ko/mnt/tmp/initramfs/lib/modules/omapxxx/

$ Echo "insmod $ module_path/tsc23020.kp.ko">/mnt/tmp/initramfs/linuxrc

$ Echo "insmod $ module_path/tsc23020.kp.ko">/mnt/tmp/initramfs/linuxrc

7. Rebuild initramfs image (http://sources.redhat.com/jffs2/
)

$ Mkfs. jffs2-n-r/mnt/tmp/initramfs-e 20000-O rootfs. jffs2

P.s. After the event, we found that the N800 maemo can be directly modified. to modify it, we have to re-mount the initramfs flash memory partition to read/write:

Nokia-N800: # Mount-O remount, RW/dev/mtdblock3/mnt/initramfs

Firing

$ Cd ~ /N800/build-tools/
$ Flash3.5-K ~ /N800/projects/modulize_kernel/zimage-F

# Prompt to connect N800, connect the N800 to the USB cable, and press the Home key to start the instance.

$ Flash3.5-n ~ /N800/projects/modulize_kernel/initramfs. jffs2-F-R

The test process is omitted after restart.

Reference
  • Http://elinux.org/N800
  • Http://en.wikipedia.org/wiki/N800

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.