Advanced OpenEmbedded

From Studio Kousagi Wiki
Jump to: navigation, search

Setting up opkg feeds

  1. Install Apache
    • sudo apt-get install apache2
  2. Add a symlink to the openembedded deploy/ipk directory:
    • sudo ln -s /home/user/chumby-oe/output-angstrom-.9/deploy/eglibc/ipk /var/www/oe-repo
  3. Determine your IP address, and then add the following line to meta-chumby/conf/local.conf - you will need to rebuild the -image and re-write it to an SD card:
  4. After you finish building packages, refresh the package index
    • bitbake package-index
  5. On the device, re-fetch the package list
    • opkg update
  6. On the device, search for packages or install them
    • opkg list '*strace*'
    • opkg install strace

Tuning the build

  1. Edit meta-chumby/conf/local.conf
    • nano -w meta-chumby/conf/local.conf
  2. Change "BB_NUMBER_THREADS" to be something reasonable such as one greater than the number of cores present on your system.
  3. Change PARALLEL_MAKE to be 1 or 2, depending on how much memory you have.
  4. If you're running builds under X11, remove the "TERMCMD" and "TERMCMDRUN" commands. If you ever need to use the devshell under X11, it will open up a new xterm. The default is to open up a new "screen" session, which is best for interacting with OpenEmbedded via SSH.
  5. Save and quit
    • Press Ctrl-X, type "Y", and press Enter to save and quit.

Tuning the resulting image

  1. Edit meta-chumby/conf/machine/chumby-falconwing.conf
    • nano -w meta-chumby/conf/machine/chumby-falconwing.conf
  2. Change the size of the rootfs. Value is in kilobytes. The resulting image will always be about 16 megabytes larger, due to the overhead of the bootloader
    • IMAGE_ROOTFS_SIZE = "450000"
  3. Set the width and height of the display. Note you may need to make kernel patches in order to force it to PAL mode, or to add additional LCDs
    • MACHINE_DISPLAY_WIDTH_PIXELS = "720"
    • MACHINE_DISPLAY_HEIGHT_PIXELS = "480"

Patching the kernel (using devshell and screen)

  1. Start up a devshell
    • bitbake virtual/kernel -c devshell &
  2. Wait until the log says "task do_devshell: Started"
  3. Enter the devshell
    • screen -r
  4. Add everything to git
    • git init
    • git add *
      • Git might throw an error saying "patches" won't be added, so remove that directory and try again (rm -rf patches; git add *)
    • git commit -m "Commit"
  5. Set up for building the kernel
    • unset LDFLAGS
  6. Make changes (for example):
    • nano -w arch/arm/mach-stmp3xxx/lcd_lms350.c
    • make
  7. Test changes
    • Copy arch/arm/boot/zImage to device
    • Write kernel e.g. by running "config_util --cmd=putblock --dev=/dev/mmcblk0p1 --block=krnA < /media/usb/zImage"
  8. Commit changes (for example):
    • git add arch/arm/mach-stmp3xxx/lcd_lms350.c
    • git commit -m "Changed timing on LCD"
  9. Create a patch
    • git format-patch HEAD~1
  10. Copy the resulting .patch file to ~/chumby-oe/meta-chumby/recipes/linux/linux-falconwing/
    • cp 0001-lcd-timings.patch ~/chumby-oe/meta-chumby-recipes/linux/linux-falconwing/
  11. Exit the devshell
    • exit
  12. Edit the kernel recipe and add the new patch, adding the patch to the SRC_URI
    • nano -w ~/chumby-oe/meta-chumby/recipes/linux/linux-falconwing_2.6.28.1.0.3454.bb
    • file://0001-lcd-timings.patch \
  13. Rebuild the kernel and bootloader
    • bitbake virtual/kernel virtual/bootloader -c clean
    • bitbake virtual/kernel
    • bitbake virtual/bootloader

Make your own custom image

These instructions are based on http://bec-systems.com/site/456/capture-oe-source-changes

  1. Copy meta-chumby/recipes/images/chumby-starter-image.bb to your own image file
    • cp meta-chumby/recipes/images/chumby-starter-image.bb meta-chumby/recipes/images/my-local-image.bb
  2. Edit the image and add any packages to DEPENDS and IMAGE_INSTALL
    • nano -w meta-chumby/recipes/images/my-local-image.bb
  3. Build the image
    • bitbake my-local-image
  4. Write the image out to disk
    • sudo dd if=output-angstrom-.9/deploy/eglibc/images/chumby-falconwing/rom-chumby-falconwing-my-local-image.img of=/dev/sdb bs=8M # Write the resulting my-local-image to the SD card plugged into sdb