Developing Embedded Linux With Target Control By Tim
Developing Embedded Linux With Target Control By Tim Bird Sony Corporation 07/25/2008 © Sony Corporation of America 1
Outline Introducing Target Control What is Target Control? How do you use it? How do you configure it? Where to get it 07/11/2008 © Sony Corporation of America 2
Introducing Target Control What is it? 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 A program that helps you build and install kernels on a target board, then install and run programs on the board (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 07/11/2008 © Sony Corporation of America 3
Tc 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, x 86, 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 07/11/2008 © Sony Corporation of America 4
Tc 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 07/11/2008 “manual automation” © Sony Corporation of America 5
How 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. ) 07/11/2008 © Sony Corporation of America 6
Development 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 07/11/2008 © Sony Corporation of America 7
TC 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 console – monitor kernel console Reset performs an optional soft reset Usually starts minicom run – execute a command on the target 07/11/2008 © Sony Corporation of America 8
More TC commands reserve – reserve a target board for use set_config – set an individual configuration option more… 07/11/2008 © Sony Corporation of America 9
TC sample session tc list osk tx 49 tc osk setenv tc get_kernel -o printk-test ; cd printk-test tc get_config tc set_config CONFIG_PRINTK_TIMES=y (in another terminal) tc console tc kbuild ; tc kinstall ; tc reboot tc run dmesg 07/11/2008 © Sony Corporation of America 10
TC config file tc is a pretty thin layer - most logic is in the config file Config file has list of targets, with attributes for each one attributes are: name=<value> attributes with a '_cmd' ending are executed Example: global conf file = /etc/tc. conf local conf file = specified by LOCAL_TARGET_CONF target=tx 49 ARCH=mips kimage=uimage kbuild_cmd=make ARCH=$ARCH $kimage Command: “tc tx 49 kbuild” 07/11/2008 © Sony Corporation of America 11
TC config file sample target=osk description="""TI OMAP Starter Kit (OSK) OMAP 5912 processor (ARM 926 EJ-S core and a C 55 x DSP)""“ TOOL_PATH=/usr/local/arm-sony-linux/devel/bin ARCH=arm CROSS_COMPILE=arm-sony-linux. TMPDIR=/tmp KBUILD_OUTPUT=. . /build/osk ipaddr=192. 168. 1. 72 kimage=u. Image get_kernel_cmd=git clone sony-git-master –o $KERNEL_SRC get_config_cmd=make omap 5912_defconfig console_cmd=minicom USB 0 -115 k login_cmd=telnet osk 2 kinstall_cmd=cp -v $KBUILD_OUTPUT/arch/arm/boot/u. Image /target/osk 2/boot reboot_cmd=omap-reboot target_bin=/devel/usr/bin copy_to_cmd=cp $src /target/osk 2/$dest copy_from_cmd=cp /target/osk 2/$src $dest rm_cmd=rm /target/osk 2/$dest 07/11/2008 © Sony Corporation of America 12
TC config file (cont. ) Advanced stuff: Inheritance: Macros target=bar inherit_from=foo baz=frob-nob –x %(var_name)s -g Convenience/temporary environments 07/11/2008 tc tx 49 setenv -o tempfile ; source tempfile ; command © Sony Corporation of America 13
My 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) 07/11/2008 © Sony Corporation of America 14
Host/Target requirements REQUIREMENT: It must be possible to install a kernel or file system on the target from the command line (i. e. noninteractively) 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! 07/11/2008 © Sony Corporation of America 15
Supporting programs <xxx>-reset, <xxx>-reboot switch-target-fs used by 'tc run' minicom (or other terminal emulator) 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 with 'tc reserve' get-kernel Custom reboot/reset scripts for your power controller used by 'tc console' telnet, ssh used by 'tc login' 07/11/2008 © Sony Corporation of America 16
Resources Home Page: Documentation: http: //mirror. celinuxforum. org/labwiki/Target_Control_Usage_Guide E-mail: List: celinux-dev@tree. celinuxforum. org Me: tim. bird <at> am. sony. com 07/11/2008 © Sony Corporation of America 17
- Slides: 17