# README-OpenEmbedded.ronetix # # Building and programming of KaeilOS OpenEmbedded distribution # for AT91SAM9261/AT91SAM9263 based boards PM9261 and PM9263 # # Ronetix GmbH # www.ronetix.at # # 1.Preparation First you need to prepare your host linux distribution in order to be able to get and build KaeilOS. A list of required packages for variety of host distributions is described in: http://wiki.openembedded.net/index.php/OEandYourDistro at http://wiki.openembedded.net/index.php/Main_Page Lets prepare directory structure. Login on your host as ordinary user not as root(root privileges are not needed and a good practice is to avoid being root if not needed). You can login as a user you like. Starting point is being in the home directory. You may choose working directory at your decision, but be aware of the paths. Make directory for doing things and go to it: $ cd $ mkdir -p usr/src/oe $ cd usr/src/oe Now it is time to get bitbake - the building tool. All thing here are done with bitbake version 1.8. And don't install bitbake globally, install it as a sibling directory of openembedded/ and build/. $ git clone git://git.openembedded.org/bitbake.git $ cd bitbake $ git pull $ git checkout -b 1.8.12 1.8.12 2. Getting openembedded - meta data, packages, relations and more. Get it, go to directory openembedded/ and update. $ git clone git://git.openembedded.org/openembedded $ cd openembedded $ git pull Now you have the development branch of openembedded org.openembedded.dev Check that you are in development branch. $ git branch * org.openembedded.dev $ cd .. 3. Get KaeilOS settings and configuration files and then extract them: $ wget ftp://ftp.koansoftware.com/public/kaeilos/kaeilos-4.05-config-files.tgz $ tar xzvf kaeilos-4.05-config-files.tgz Get custom-extra-image.bb recipe file and save it in $OEBASE/openembedded/recipes/images: $ wget http://download.ronetix.info/sk-eb926x/linux/rootfs/custom-extra-image.bb \ -O openembedded/recipes/images/custom-extra-image.bb Edit the listed below so that they contains the correct paths. Substitute the variables. See the List of variables. Use the full path from root(/) directory: - in file setup-kaeilos.sh correct BB_DIR to point to $OEBASE/btibake/ and OE_DIR to point to $OEBASE/openembedded/ - in build/kaeilos/conf/auto.conf you can select the machine to build KaeilOS for. The default machine is "ronetix-pm9263", to build for pm9261 change the name "ronetix-pm9263" to "ronetix-pm9261" - in build/kaeilos/conf/local.conf correct DEPLOY_DIR_PSTAGE to point to "$OEBASE/build/kaeilos/pstage/", and if you work in a screen sesion leave the three lines below "# Enable devshell with screen and bash", in the other case comment this three lines. And please dont't comment sending automatic reports. # Enable devshell with screen and bash #SCREEN_TERMCMD = 'screen -D -m -t "$TERMWINDOWTITLE" -s /bin/bash' #TERMCMD = "${SCREEN_TERMCMD}" #TERMCMDRUN = "${SCREEN_TERMCMDRUN}" # Enable this to send automatic success and failure reports #http://wiki.openembedded.net/index.php/How_do_I_send_automatic_success_and_failure_reports INHERIT += "oestats-client" OESTATS_SERVER = "tinderbox.openembedded.net" OESTATS_BUILDER = "kaeilos-user" - in build/kaeilos/conf/site.conf correct DL_DIR to become "$OEBASE/sources/" and correct BBFILES = "$OEBASE/openembedded/recipes/*/*.bb" 4. Initial building of the system. You should be in $OEBASE directory. Running this command for the first time will take a some hours to finish: $ source setup-kaeilos.sh /home/ivan/usr/src/oe/build/kaeilos $ bitbake custom-extra-image 5. Kernel configuring Go to $OEBASE/build/kaeilos to configure and build your linux kernel: $ cd $OEBASE/build/kaeilos $ bitbake virtual/kernel -c menuconfig 6. Kernel building Next comes to compile, populate stage directory, install the kernel. Executing these task will compile kernel and modules, make head files to be in the stage directory and finally copy kernel and modules to $DEPLOY directory. $ bitbake virtual/kernel -c compile -f $ bitbake virtual/kernel 7. RootFS building To create RootFS go to $OEBASE/build/kaeilos: $ cd $OEBASE/build/kaeilos $ bitbake custom-extra-image The RootFS image is in the $DEPLOY directory: KaeilOS-custom-extra-image-glibc-ipk-2009.1-test-20090914-ronetix-pm9263.rootfs.jffs2 This is the image you should program into the NAND Flash of PM9263. 8. U-BOOT programming using PEEDI JTAG Flash Programmer (www.ronetix.at/peedi.html) peedi> flash set 0 ; select the first flash profile peedi> flash erase peedi> flash program ; program u-boot-pm9263.bin 9. Setting the U-BOOT environment Boot board. Stop u-boot autoboot and set: setenv ipaddr setenv serverip setenv gatewayip setenv netmask setenv hostname setenv ethaddr saveenv 10. Programming of the Kernel A. Using PEEDI: Open a telnet console to PEEDI: peedi> flash set 1 ; select the second flash profile peedi> flash program ; program uImage-2.6.28.bin B. Using U-BOOT: Make sure the U-BOOT networking is properly initialized (see 9.) tftp 20020000 uImage-2.6.28.bin cp.b 20020000 10050000 $(filesize) 11. ROOTFS programming into the NAND flash A. Using PEEDI peedi> flash set 2 peedi> flash erase peedi> flash program ; program the image built in 7. B. Using U-BOOT Caution - the RootFS image built in 7. can't be programmed by U-BOOT, because it doesn't fit in the SDRAM. nand erase clean tftp 20020000 rootfs.jffs2 ; the image should less than 64MB nand write.jffs2 20020000 0 $(filesize) At this point you can start the Linux from the Flash, start from PEEDI or debug with arm-elf-insight 12. Running the u-boot from PEEDI go 0x10000000 13. Kernel debugging The board should be programmed with the u-boot and the binary version of the kernel. Start gdb/insight: arm-elf-insight vmlinux In the console window: (gdb) target remote peedi:2000 (gdb) set $pc = 0x10000040 ; the u-boot is flashed at 0x10000000 (after remap) (gdb) c The board is running: first starts the u-boot, then the Linux kernel. If you have a serial console you can see that the Linux is working. Now you can halt the kernel and set breakpoints where you want. If you want to have a breakpoint before the kernel is running you have to do the following: (gdb) target remote peedi:2000 (gdb) set $pc = 0x10000040 ; assuming the u-boot is flashed at 0x10000000 (gdb) hbreak start_kernel ; hardware breakpoint is used because the MMU is still not active (gdb) c The board is running (u-boot, then the kernel) and will stop at the start_kernel function. (gdb) delete ; delete the hardware breakpoint. Now you can use the software breakpoints. 14. Tips and tricks 14.1 Rotate KaeilOS boot logo: In /etc/defaul/psplash add "--angle 90" in psplash arguments variable, so that splash screen is rotated properly. 14.2 Enable/Disable mouse pointer in X: In /etc/matchbox/session find the line starting with "exec matchbox-window-manager" and change to "-use_cursor no" or to "-use_cursor yes" to hide or show mouse pointer. 14.3 To rotate X display properly you can execute this from the command line: # sed -i '/case `module_id` in/ a\ "Ronetix PM9261" | "Ronetix PM9261/BB9261" | "Ronetix PM9263" | \\\ "Ronetix PM9263/BB9261" | "Ronetix PM9263/BB9263") \ ARGS="$ARGS -rgba bgr -screen 240/54x320/81@90x16" ;; ' /etc/X11/Xserver 14.4. Getting eth0 gateway parameter from dhcp: In /etc/network/interface add "iface eth0 inet dhcp" before "iface eth0 inet static" line. 14.5. Calibrating the touchscren. - In the first runnning of Linux, GPE login screen is preceded by touch screen calibration. - To calibrate the screen in the login prompt touch randomly on the screen, from 30 secund to 1 minute and the calibrationscreen will appar again. - From a terminal using keyboard on USB port, run "xtscal" - Form Settings/Screen Setting press the "start" button in the calibration section. 15. Pre-built binaries: U-BOOT: http://download.ronetix.info/sk-eb926x/linux/bootloader/u-boot-2009.08/u-boot-pm9263.bin Linux kernel: http://download.ronetix.info/sk-eb926x/linux/kernel/2.6.28/uImage-2.6.28-r12-ronetix-pm9263.bin RootFS: http://download.ronetix.info/sk-eb926x/linux/rootfs/KaeilOS-custom-extra-image-glibc-ipk-2009.1-test-20090916-ronetix-pm9263.rootfs.jffs2