Contents
N900 Boot Process
Kernel
/sbin/preinit
N900 Custom Kernel
Contents
|
Restore the original default configuration
Login to your scratchbox and create a MaemoKernel-Target. How to do this is described here: http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Kernel_and_Debugging_Guide/Maemo_Kernel_Guide
make EXTRAVERSION=-omap1 rx51_defconfig
Edit the configuration file
# Enable the framebuffer console to display kernel messages CONFIG_FRAMEBUFFER_CONSOLE=y
Include your changes for compilation
make EXTRAVERSION=-omap1 oldconfig
Compile the kernel
make EXTRAVERSION=-omap1 bzImage
Flash the kernel
Download and install the flasher from http://tablets-dev.nokia.com/maemo-dev-env-downloads.php
flasher-3.5 -f -k /scratchbox/users/sysop/home/sysop/maemo_kernel/kernel-2.6.28/arch/arm/boot/zImage
N900 Initial Setup
First things first
Add repositories
File: /etc/apt/sources.list.d/hildon-application-manager.list
deb https://downloads.maemo.nokia.com/fremantle/ssu/apps/ ./ deb https://downloads.maemo.nokia.com/fremantle/ssu/mr0 ./ deb https://downloads.maemo.nokia.com/fremantle/ovi/ ./ deb http://repository.maemo.org/extras fremantle free non-free deb http://repository.maemo.org/extras-devel fremantle free non-free deb http://repository.maemo.org/extras-testing fremantle free non-free
Install mandatory software
rootsh mad-developer
N900 Installing and using Bootchart
Contents
|
Introduction
Actually we need 3 files: bootchartd bootchartd.conf and usleep. These files get modified and installed on the N900. But read on…
Enter build-env
Login to scratchbox and select target:
scratchbox sb-conf select FREMANTLE_ARMEL
Download bootchart
wget http://prdownloads.sourceforge.net/bootchart/bootchart-0.9.tar.bz2 tar xvfj bootchar-0.9.tar.bz2
Create a directory for our files
mkdir BOOTCHART cd BOOTCHART
And copy the relevant bootchart files to it
cp ../bootchart-0.9/scripts/bootchartd ./ cp ../bootchart-0.9/scripts/bootchartd.conf ./
Modifying Bootchart-Scripts
To get bootchart running on the N900 some modifications are necessary:
sleep vs. usleep
bootchart uses the gnu sleep which accepts sleep times less than a second like: sleep 0.2. Maemo on the other hand uses busybox’s sleep function which only accept integers like: sleep 5. Because of this we have to develop a small binary to fulfill the requirement of sleeping less than a second.
Develop usleep by creating a file with the following content:
#include <stdio.h> #include <stdlib.h> int main (int argc, char **argv) { if (argc != 2) { printf("Usage: usleep [usec]\n"); return 1; } else { usleep(atoi(argv[1])); return 0; } }
and compile the file with:
gcc -o usleep usleep.c
and copy it also to our directory BOOTCHART
Now replace every occurrence of
sleep $SAMPLE_PERIOD
with
usleep $SAMPLE_PERIOD
NOTE: don’t touch the strings with “sleep 5” for example, since our usleep would only sleep for 5 usec insted of 5s!
Bash variable manipulation
Since the bootchart script isn’t run within bash we have to deal with another incompatibility from busybox. Within the script you will find (line 104) something like this:
uptime=${uptime/./}
In bash this would remove all dots (.) within the variable $uptime. Not so in busybox where you will get a error message: -sh: syntax error: Bad substitution
We will replace that line with:
uptime=${uptime%%.*}${uptime##*.}
This line just concatenate everything before and everything after the dot (.). Same effect, different approach.
Include configuration
Since there’s only 8 configuration variables within the bootchart.conf I included them directly within the script.
Note: Be sure that you replace the SAMPLE_PERIOD variable because of our usleep command.
SAMPLE_PERIOD=200000
Insert exit process
Since the bootchart logs it’s data to a tmpfs which isn’t actually existing (accessible) once the N900 is up again, we have to define a process which will trigger bootchart to stop logging and start packaging and saving it’s results to $BOOTLOG_DEST (/var/log/bootchart.tgz by default). I’ve used the process “browser” to trigger this. So when I reboot the N900 the logging stops immediately if i start the default webrowser.
... local exit_proc="gdmgreeter gdm-binary kdm_greet kdm browser" ... exit_proc="mingetty agetty rungetty getty browser" ...
Force tmpfs creation
Since there might be a /tmp directory (which would be preferred by bootchart) force the script to create the tmpfs by uncomment the if-clause at around line 43:
# if [ -z "$LOG_DIR" ]; then LOG_DIR="/mnt" LAZY_UMOUNT="yes" mount -n -t tmpfs -o size=$TMPFS_SIZE none "$LOG_DIR" >/dev/null 2>&1 # fi
Installing files on N900
Now we have 2 files within our BOOTCHART directory:
* bootchartd * usleep
Copy both files to /sbin on your N900 with ssh or whatever.
Rebooting the N900
The last thing we have to do is to tell the kernel to use /sbin/bootchart as initscript and tell bootchart that it should start /sbin/preinit. Normally this would be archived with the kernel option:
init=/sbin/bootchart bootchart_init=/sbin/preinit
To archieve this you can:
- build custom kernel with the appropriate CONFIG_CMDLINE
- WARNING UNTESTED (might mess up NOLO-bootloader) use the flasher-3.5 with the commandline option –boot[=ARG]
Results
N900 Repositories
INSTALL ALL REPOS: N900 click here
Contents
|
Supported
extras
http://my-maemo.com/download/repos/extras.install
Catalog name: maemo.org extras Web address: http://repository.maemo.org/extras Distribution: fremantle Components: free non-free
maemo.org sdk tools
Catalog name: Maemo 5 SDK tools Web address: http://repository.maemo.org/ Distribution: fremantle/tools Components: free non-free
Un Supported
extras-testing
http://my-maemo.com/download/repos/extras-testing.install
Catalog name: maemo.org extras-testing Web address: http://repository.maemo.org/extras-testing Distribution: fremantle Components: free non-free
extras-devel
http://repository.maemo.org/extras/install/extras-devel-fremantle.install
http://my-maemo.com/download/repos/extras-devel.install
[catalogues] catalogues = extras-devel [extras-devel] name = Extras-Devel uri = http://repository.maemo.org/extras-devel/ components = free non-free