# README-OpenEmbedded.ronetix # How to create bootloader, Linux kernel, root file system, toolchain, # user applications using OpenEmbedded-classic # for AT91SAM9G45/AT91SAM9263/AT91SAM9261 based boards: # PM9G45, PM9263 and PM9261. # # Ronetix GmbH # www.ronetix.at # August, 2012 # Table of contents: 1. Preparation 2. Getting openembedded - meta data, packages, relations and more 3. Get KaeilOS settings and configuration files and then extract them 4. Initial building of the system 5. Kernel configuring 6. Kernel building 7. RootFS building 8. Export SDK 9. Programming/Writing 10. Tips and tricks The OpenEmbedded has been undergoing reorganizations since 2011. All the recipes were on one place, which has caused maintenance issues and fragility. Several clone of OE, like Poky and Yocto Project, were started to fix this. And now, to consolidate forces Yocto and OE are merging in the new OpenEmbedded with layers. The OE before changes is named OpenEmbedded-classic. It is still alive. Its recipes are transferring to the layer structure. The layer structure is still on intensive development process. This readme covers the OpenEmbedded-classic. 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 http://wiki.openembedded.net/index.php/Main_Page http://www.kaeilos.com/download in Required packages 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.10.2. And don't install bitbake globally, install it as a sibling directory of openembedded/ and build/, more clearly said at ~/usr/src/oe/bitbake. $ git clone git://git.openembedded.org/bitbake.git $ cd bitbake $ git checkout -b _tag_1.10.2 1.10.2 $ cd .. 2. Getting openembedded-classic - meta data, packages, relations and more Get it, go to directory openembedded/ and update. $ git clone git://git.openembedded.org/openembedded $ cd openembedded Since KaelOS distribution will be used, check out a tested OE metadata. $ git checkout -b kaeilos-2011 origin/mckoan/kaeilos-2011 $ cd .. As the OE is developing continuously sometimes the OE can not be build successfully so you can keep updating OE until it builds or use a build verified state(commit). The latest stable states can be found at http://www.kaeilos.com/latest-changes. !!! BIG FAT WARNING !!! Warning: even the tested OpenEmbedded/Bitbake metadata state after "some" time the build process can not produce the desired images and fail, due to URL sources are not available, most probably a new version of that resource, and the old one have been removed. Also there is recipes referring to a source in a svn, git or other repositories, which at the build time could be in broken state. 3. Get KaeilOS settings and configuration files and then extract them $ wget ftp://ftp.koansoftware.com/public/kaeilos/kaeilos-4.11-config-files.tgz $ tar xzvf kaeilos-4.11-config-files.tgz Get custom-extra-image.bb recipe file and save it in $OEBASE/openembedded/recipes/images: $ wget http://download.ronetix.info/boards/linux/rootfs/custom-extra-image.bb \ -O openembedded/recipes/images/custom-extra-image.bb Edit the files listed below so that they contains the correct paths. Use the absolute path: - in file setup-kaeilos.sh adjust the paths - in build/kaeilos/conf/auto.conf you can select the machine to build KaeilOS for. The default machine is "ronetix-pm9263", to build for pm9g45 change the name "ronetix-pm9263" to "ronetix-pm9g45", and if the case is pm9261 use "ronetix-pm9261" - in build/kaeilos/conf/local.conf remove "ext2" parameter in IMAGE_FSTYPES. Change the SCREEN_TERMCMD to 'xterm -e'. - in build/kaeilos/conf/site.conf adjust the paths, select a Debian mirror near you for higher download speed and in the Debian mirror remove the "pub/" part, also. 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 --continue console-base-image Warning: custom-extra-image.bb is recipe example, it is useful to to demonstrate how to add stuff you like/want. Doe to continuous change/improvement of OE there could be a time when some packages included in the custom-extra-image.bb are not buildable, and the items in the custom-extra-image.bb have to be adopted. The "x11-image", "console-image" and "console-base-image" are general for OE. Warning: even the tested OpenEmbedded/Bitbake metadata state after "some" time the build process can not produce the desired images and fail, due to URL sources are not available, most probably a new version of that resource, and the old one have been removed. Also there is recipes referring to a source in a svn, git or other repositories, which at the build time could be in broken state. This initial system building is to let the OpenEmbedded build the system(toolchain, tools running on the host and the required packages) and later you can customize the OpenEmbedded. Note that eternal toolchain installation is not required as the OE makes one. There is an option to tell OE to use external toolchains. OE could provide this toolchain as SDK(software development kit) for external usage. 5. AT91Bootstrap AT91Bootstrap for PM9G45 is configured and build automatically. The image to program is in the deploy directory. ~/usr/src/oe/build/kaeilos/tmp/deploy/eglibc/images/ronetix-pm9g45/at91bootstrap.bin For more details refer to AT91Bootstrap README. 6. U-Boot U-Boot for PM9G45 is configured and build automatically. The image to program is in the deploy directory. ~/usr/src/oe/build/kaeilos/tmp/deploy/eglibc/images/ronetix-pm9g45/u-boot-ronetix-pm9g45.bin For more details refer to U-Boot README. 7. Linux Kernel configuring Go to $OEBASE/build/kaeilos to configure and build your linux kernel: $ cd $OEBASE/build/kaeilos $ bitbake virtual/kernel -c menuconfig 8. Linux 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 9. 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. This is the image you should program into the NAND Flash of PM9G45: KaeilOS-custom-extra-image-glibc-ipk-2010.1-20110223-ronetix-pm9g45.rootfs.jffs2 10. Export SDK Creating a toolchain(SDK) is the same as creating a rootfs image. From the $OEBASE directory: $ source setup-kaeilos.sh /home/ivan/usr/src/oe/build/kaeilos $ bitbake meta-toolchain and the resulted SDK is in $DEPLOY directory. For reference: http://docs.openembedded.org/usermanual/html/commonuse_qte_sdk.html http://docs.openembedded.org/usermanual/html/ch05s08.html 11. Programming/Writing On how to program it see the README-programming. 12. Tips and tricks 12.1 Rotate KaeilOS boot logo In /etc/defaul/psplash add "--angle 90" in psplash arguments variable, so that splash screen is rotated properly. 12.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. 12.3 To rotate X display properly you can execute this from the command line Take a look at /etc/X11/xorg.conf in Section "Device", and add or change the Option "Roatate", like this: Option "Rotate" "CCW" Adjusting touchscreen axes, in 'Section "InputDevice"' modify or add: Option "SwapAxes" "True" Option "InvertX" "True" Option "InvertY" "True" 12.4. Getting eth0 gateway parameter from dhcp In /etc/network/interface add "iface eth0 inet dhcp" before "iface eth0 inet static" line. Form the command line call "udhcpc" or "dhclient eth0" to set network through DHCP server. 12.5. Calibrating the touchscren A. From a terminal using keyboard on USB port, run "ts_calibrate" B. In GPE from Settings/Screen Setting press the "start" button in the calibration section. A text from "http://comments.gmane.org/gmane.comp.handhelds.openembedded/32629" with title "[oe] Handling different touchscreen calibration systems" --- citation --- There are several way to calibrate a touchscreen: *ts_calibrate : it uses the framebuffer and so it must be started before xorg(an init script can do that). works only for tslib. *xtscal : works only for kdrive and tslib(if I understood well) *xinput-calibrator: works with xorg and can calibrate many things,but I had huge issues with it with tslib,with /etc/pointercal from ts_calibrate it works fine but without it can't calibrate... Note that it also supports other protocols like evdev,evtouch etc... *other specific uttilities for evtouch etc... --- citation --- 12.6. Screen blanking, screen saver and screen DPMI Screen blanking/saver can be controlled with xset utility. To use the "xset" the DISPLAY cariable have to be set: # export DISPLAY=:0.0 To set the timeout time to 30 secund and screen saver change cycle time to 3 secunds use: # sleep 2; xset s 30 3 To see the blank(dark) screen pattern instead of the screen saver(a X like symbow jumping around) use: # sleep 2; xset s blank Screen saver can be shown instead of a dark pattern: # sleep 2; xset s noblank # sleep 2; xset s no To activate the screen saver or blanking at any time: # sleep 2; xset s activate To disable the screen saver and blanking # sleep 2; xset s reset 12.7. Enabling the sound To record sound from MIC create file ~/.asoundrc --- .asoundrc --- pcm.copy { type plug slave { pcm hw } route_policy copy } --- .asoundrc --- A. on BB9G45 - run "alsamixer --view=capture" then select Mic using Left/Rigt arrows and the space bar to enable it. Only Mic have to be enabled. - Run "alsamixer -V playback" and with Up/Down keys select Mic as "Input Mux" and unmute "Output Mixer HiFi" using the M key. - In the playback view of alsamixer you may try to mute or unmute "Mic boost" to adjust the sound level. - Make a record "arecord -d 10 -f cd -t wav -D copy foobar.wav" - Play it "aplay foobar.wav" B. on BB9263 By default in ALSA mixer are enabled the "Jack sensing" for Mic and Headphone, set sensing to off.