Title: Developing Embedded Linux With Target Control
1Developing Embedded LinuxWith Target Control
ByTim BirdSony Corporation
2Outline
- Introducing Target Control
- What is Target Control?
- How do you use it?
- How do you configure it?
- Where to get it
3Introducing Target Control
- What is it?
- A program that helps you build and install
kernels on a target board, then install and run
programs on the board
- Where did it come from?
- "tc" was originally written for the CELF test
lab
- Intent was to support remote development and test
operations
- Test lab didn't work out
- (although CELF might revive it)?
- tc is now in active use inside Sony
- This is my official release to the public, and I
expect to maintain it going forward
4Tc Purpose (1)?
- Allows you to develop and test a kernel on
different boards, using the same commands
- Primary goal is to preserve my own sanity
- I use lots of different boards, with different
attributes
- architectures (arm, mips, powerpc, x86, etc.)?
- toolchains (different versions, endian-ness,
etc.)?
- bootloaders (u-boot, pmon, custom)?
- network address, serial port, etc.
- install procedures (tftp, serial upload, USB
load, re-flash)?
- remote execution programs (telnet, ssh)?
- I usually work on at least 2 boards at a time,
and sometimes on 5 or 6 at a time (for testing)?
- Boards are sometimes shared
- Some boards are in a remote lab
5Tc Purpose (2)?
- Allows developers to share boards
- Allows access to boards on a remote host
- Allows for test automation
- Same commands can be used to perform tests on
different target boards
- Can perform same steps manually, or write a
program to perform the steps
- manual automation
6How does it work?
- Tc provides an abstraction layer to shield the
developer from details of board configuration and
control
- Basic 'tc' operation
- Read a configuration file
- Set up environment
- Run command(s) appropriate for the specified
target
- It is not rocket science, just a simple helper
utility
- Tc is command-line oriented
- It works over an network login
- e.g. ssh'ed to a remote host?
- It can be automated from any language (sh,
python, etc.)?
7Development architecture
- tc is on a host machine
- Host machine has toolchain, access to kernel
sources, patches, etc.
- Host has ability to control power to target (or
some method to reset the target)?
- Host has network connection to target
- Host has connection to target serial port
8TC commands
- get_kernel retrieve kernel sources
- get_config get config for board
- kbuild build kernel
- kinstall install the kernel to be boot on the
target boart
- reboot reboot the board
- Reset performs an optional soft reset
- console monitor kernel console
- Usually starts minicom
- run execute a command on the target
9More TC commands
- reserve reserve a target board for use
- set_config set an individual configuration
option
- more
10TC sample session
- tc list
- osk
- tx49
- tc osk setenv
- tc get_kernel -o printk-test cd printk-test
- tc get_config
- tc set_config CONFIG_PRINTK_TIMESy
- (in another terminal) tc console
- tc kbuild tc kinstall tc reboot
- tc run dmesg
11TC config file
- tc is a pretty thin layer - most logic is in the
config file
- global conf file /etc/tc.conf
- local conf file specified by LOCAL_TARGET_CONF
- Config file has list of targets, with attributes
for each one
- attributes are name
- attributes with a '_cmd' ending are executed
- Example
- targettx49
- ARCHmips
- kimageuimage
- kbuild_cmdmake ARCHARCH kimage
- Command tc tx49 kbuild
12TC config file sample
targetosk description"""TI OMAP Starter Kit (OS
K) OMAP5912 processor (ARM926EJ-S core and a C55x
DSP)"" TOOL_PATH/usr/local/arm-sony-linux/deve
l/bin ARCHarm CROSS_COMPILEarm-sony-linux- TM
PDIR/tmp KBUILD_OUTPUT../build/osk ipaddr192.
168.1.72 kimageuImage get_kernel_cmdgit clone
sony-git-master o KERNEL_SRC
get_config_cmdmake omap5912_defconfig
console_cmdminicom USB0-115k login_cmdtelnet os
k2 kinstall_cmdcp -v KBUILD_OUTPUT/arch/arm/boo
t/uImage /target/osk2/boot reboot_cmdomap-reboot
target_bin/devel/usr/bin copy_to_cmdcp src /
target/osk2/dest copy_from_cmdcp /target/osk2/
src dest rm_cmdrm /target/osk2/dest
13TC config file (cont.)?
- Advanced stuff
- Inheritance
- targetbar
- inherit_fromfoo
- Macros
- bazfrob-nob x (var_name)s -g
- Convenience/temporary environments
- tc tx49 setenv
- tc tx49 setenv -o tempfile source tempfile
command
14My setup preferences
- Bootloader that can automatically download and
boot kernel via tftp
- Mount root file system over NFS
- Kernel console over serial port
- Target supports ssh for remote login and remote
execution
- No password on root (but this is not a big deal)
15Host/Target requirements
- REQUIREMENT It must be possible to install a
kernel or file system on the target from the
command line (i.e. non-interactively)
- Most boards support this fairly easily
- Some bootloaders and board configs require the
use of expect scripts
- I tend to use python expect (pexpect.py)?
- Some targets can only be re-flashed using a
windows utility (Ugh!)?
- There must be a way to automate this - have fun!
16Supporting programs
- -reset, -reboot
- Custom reboot/reset scripts for your power
controller
- switch-target-fs
- used with 'tc reserve'
- get-kernel
- Standalone program to download a kernel from
kernel.org (similar to ketchup, but with less
features)
- Can be used with 'tc get_kernel'
- telnet_exec/ssh_exec
- used by 'tc run'
- minicom (or other terminal emulator)?
- used by 'tc console'
- telnet, ssh
- used by 'tc login'
17Resources
- Home Page
- http//mirror.celinuxforum.org/labwiki/Target_Cont
rol
- Documentation
- http//mirror.celinuxforum.org/labwiki/Target_Cont
rol_Usage_Guide
- E-mail
- List celinux-dev_at_tree.celinuxforum.org
- Me tim.bird am.sony.com