Setting up the OMAP1610 H2 ========================== Contents 1. Overview 2. Required components 2.1 HW components 2.2 SW components 3. HW Setup 4. SW Setup 4.1 ARM tool-chain 4.2 U-Boot 4.3 BitKeeper client 4.4 Kernel 4.4.1 Get the kernel sources 4.4.2 Configure and build the kernel 4.5 Lauterbach Trace32 4.6 Download U-Boot and kernel to the target 4.7 Set up the NFS root for the target 4.7.1 Create the root filesystem 4.7.2 Export the root filesystem 5. Further Reading 1. OVERVIEW ------------------------------------------------------------- This document serves as an aid for those who want to set up Linux on the TI OMAP1610 based H2 Sample development board (target). It will start with describing how to connect the HW components. After finishing the steps in this document, Linux will be installed on the target's NVRAM, and a login session will be available on the serial line and the targets’s LCD console. It will cover to some extent also how to set up a debugging environment with the Lauterbach debug module. The host computer will connect to the target through a RS232 and an Ethernet link. The debug module will connect to the host through a parallel link. Both Windows and Linux are used on the host. In the following examples (starting with $) I'll use the bash shell. 2. REQUIRED COMPONENTS ------------------------------------------------------------- I'll list the HW and SW I used during the setup together with any version information. This is a working configuration, but one could also use different tools of course (for debugging for ex.). 2.1 HW components H2 Sample development kit: - H2 sample module - H2/P2 expansion board (Surfer board) - Multiport debug module - JTAG adapter board - Power supply for the kit - Cross-link Ethernet cable - RS232 null-modem cable Lauterbach debug kit: - Power Debug Interface (LA-7702) - Podbus Parallel Interface (LA-7809) - JTAG-ARM9 ICD (LA-7742) - Power supply for PODPAR - Parallel cable 2.2 SW components On the host: - Windows (2000) - Linux (2.6) - Lauterbach Trace32 debugger (Build 1190) (for Windows) - BitKeeper client (for Linux) - Kermit (for Linux) For the target: - Linux-OMAP (2.6.6-omap1 http://linux-omap.bkbits.com ) - ARM tool-chain (20031127 http://ftp.snapgear.org/pub/snapgear/tools/arm-linux ) - U-Boot (1.1.1 http://u-boot.sourceforge.net ) - uClibc (http://www.uclibc.org ) 3. HW SETUP ------------------------------------------------------------- I won't go into details what the functionality of all the connectors and switches on the H2 kit are, but I give the configuration you have to set your board to. DIP switch and jumper settings: - H2 sample module: S401 DIP: SW6, SW9 are ON all the others (SW1-SW5, SW7, SW8, SW10) are OFF - JTAG adapter module: JP1: 1-2 JP2: 2-3 JP3: 2-3 - H2/P2 expansion module S29 DIP: SW1, SW6-SW8 are OFF, SW2-SW5 are ON - Multiport debug module SW2.1-SW2.4 are OFF SW3.1-SW3.7 are ON SW3.8 is OFF JP1: 2-3 JP2: 2-3 JP3: 1-2 (closed) Connect the LB Power Debug module to the J4 connector of the JTAG adapter module (small PCB) using the JTAG-ARM9 ribbon cable. Pin1 is marked with a red stripe on one side of the cable and a white dot on the PCB. The other end of the cable connects to the "Debug Connector" of the Debug module. Connect the LB Parallel module to the Power Debug module through the "Podbus In/Out" connectors and the Parallel module to the host using the parallel cable. The power supply has to be attached to the LB Parallel module. The power supply as well as the battery shipped with the H2 kit must be attached to the H2 expansion module (Surfer board). The blue and white power cables coming from the surfer board must be connected to the H2 sample module. Connect the UART port to a COM port on the host using the null-modem cable. If necessary make sure that the cable transfers the modem signals (CTS) properly, as the Linux serial console code depends on them. Connect the Ethernet port on the Multiport debug module to the host's Ethernet port using a cross-link cable. Switch on the H2 kit. The power switch on the surfer board is a 3 position switch: Power Supply, OFF, Battery. When everything is Ok, lot's of green LEDs should lit up on the surfer board and on the Multiport debug module. 4. SW SETUP ------------------------------------------------------------- 4.1 ARM tool-chain Instructions on how to build an x86 to ARM cross tool-chain from source and prebuilt packages can be found at these URLs: http://www.opersys.com/quickref.html http://www.arm.linux.org.uk/developer/tools.shtml I used Snapgear’s prebuilt arm-linux-tools-20031127 for building the boot loader and the kernel. You can download it from: http://ftp.snapgear.org/pub/snapgear/tools/arm-linux/arm-linux-tools-20031127.tar.gz You can choose to install it either to some system-wide place or to your home directory. I prefer the latter, so that there is no chance that it interferes with the native build tools. Whenever this tool-chain needs to be accessible PATH must include its bin directory. For make’s uImage target the mkimage tool is necessary, so add U-Boot’s tools directory as well. It's also useful to specify a target directory, where binaries and other result files from the build process go. These are best placed in one of your init scripts: $ PATH=/bin:/tools:$PATH $ TARGET_DIR=$HOME/target $ mkdir $TARGET_DIR $ mkdir $TARGET_DIR/kernel $ mkdir $TARGET_DIR/u-boot $ mkdir $TARGET_DIR/root 4.2 U-Boot Download U-Boot from http://u-boot.sourceforge.net . Some minor patching to the U-Boot code is required to work with the H2 board, I included a patch, which can be used when building with the ARM tool-chain I referred to in 4.2. Apply the patch I provided: $ cd u-boot $ cat ../patch-u-boot-1.1.1-omap | patch –p1 Configure and build U-Boot: $ cd u-boot $ make omap1610h2_cs_autoboot_config $ make This will produce u-boot.bin, a raw binary image, which we will download later to the target: $ cp u-boot.bin $TARGET_DIR/u-boot 4.3 BitKeeper client BitKeeper is needed to download linux-omap kernel in the next step. From http://www.bitkeeper.com/Products.Downloads.html you can download the client (registration required). Install the package by running the provided install program. 4.4 Kernel 4.4.1 Get the kernel sources If you are behind a firewall you may have to specify your http proxy. For example: $ http_proxy=http://proxy.mine.com:8080 Get a copy of the linux-omap repository: $ bk clone http://linux-omap.bkbits.net/main linux-omap This will download the latest sources from the server. The make has a mechanism to check out the required files automatically during the build, but I couldn’t make this work. So check out now all the source files from our local repository: $ bk sfiles –U | bk edit - The version I used was linux-2.6.6-omap1. The network device driver (smc91x) doesn't function correctly, there are sporadic TX overrun errors, which is currently being discussed on the kernel mailing lists. I could live however with this. 4.4.2 Configure and build the kernel There is a default configuration file provided in the source tree, the make target for that is omap_h2_1610_defconfig. You should further tailor the configuration for NFS root support. For this enable the followings during make menuconfig. These must be available at boot time so don’t modularize: - File systems/Network File Systems NFS file system support (CONFIG_NFS_FS) Root file system on NFS (CONFIG_ROOT_NFS) - Networking support/Networking options IP: kernel level autoconfiguration (CONFIG_IP_PNP) IP: DHCP support (CONFIG_IP_PNP_DHCP) IP: BOOTP support (CONFIG_IP_PNP_BOOTP) IP: RARP support (CONFIG_IP_PNP_RARP) - Networking support Networking device support (CONFIG_NET_DEVICES) - Networking support/Ethernet (10 or 100Mbit) SMC 91C9x/91C1xxx support (CONFIG_SMC91X) The omap_h2_1610_defconfig target sets the MPU frequency to 60MHz, for me the normal 192MHz setting worked fine, so you can change it as well. First clear the 60MHz setting and then set: - System type/TI OMAP Implementations OMAP ARM 192 MHz CPU (CONFIG_OMAP_ARM_192MHZ) Also make sure that the followings are enabled for serial console to function (don’t modularize): - Character devices/Serial drivers Console on 8250/16550 and compatible serial port (CONFIG_SERIAL_8250_CONSOLE) OMAP serial port support (CONFIG_SERIAL_8250_OMAP) $ cd linux-omap $ make omap_h2_1610_defconfig $ make menuconfig $ make uImage $ make modules Note that 'dep' is no longer needed with 2.6 series. You can also omit the ARCH=arm CROSS_COMPILE=arm-linux- parameters to make since in this version it's default in the Makefile. Copy the kernel image along with the symbol information to the target dir: $ cp vmlinux $TARGET_DIR/kernel $ cp arch/arm/boot/uImage ${TARGET_DIR}/kernel 4.5 Lauterbach Trace32 We will use Trace32 for downloading the images to the target and it’s also a great tool for debugging the kernel. Install Trace32 on Windows. For parallel port mode edit the corresponding part in config.t32: PBI= PARPORT=1 EPP ADDRESS=632 This will set EPP mode on address 632 (0x278), for which you may also have to adjust the host's BIOS settings. Windows is needed actually only because currently there is no parallel mode support in the Linux version of Trace32. If you have an LB Ethernet module or are willing to install WINE to your Linux box, then you can have a pure Linux environment. 4.6 Download U-Boot and kernel to the target To access the U-Boot console and later to have a Linux login session on the serial line we need a terminal program. I used Kermit with the following init commands. You can put them also in your .kermrc file: C-Kermit> set line /dev/ttyS0 C-Kermit> set speed 115200 C-Kermit> set carrier-watch off C-Kermit> set flow-control rts/cts C-Kermit> connect Next we will download U-Boot and the kernel to the target's RAM with Trace32 on Windows, then copy them to the target's flash memory with U-Boot's own commands. To initialize the target and do the downloading we'll use the Trace32 script omap1610_download.cmm. Edit the corresponding part in the script so that it can locate the binary images: d.load.b /kernel/uImage 0x10000000 d.load.b /u-boot/u-boot.bin 0x11000000 /verify Execute the script with the menu selection File/Batchfile. The script downloads the kernel image to 0x10000000 and U-Boot to 0x11000000 and starts the execution of U-Boot console. At this point you should see U-Boot's welcome message and command prompt in the terminal window we set up above: U-Boot 1.0.2 (Mar 19 2004 - 12:10:54) U-Boot code: 11080000 -> 11093F64 BSS: -> 11097E8C RAM Configuration: Bank #0: 10000000 32 MB Flash: 32 MB *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial OMAP1610 H2 # For now you can ignore the warning about the environment crc error. Check if the kernel image has been downloaded correctly: OMAP1610 H2 # imi 10000000 I give the start/end addresses I reserved in the flash memory according to my configuration, you may adjust them depending on yours. At this point flash is mapped to 0c000000. Keep in mind that U-Boot uses sector 1 (0c020000 – 0c03ffff) to save its environment settings. Boot loader: 0c000000 - 0c03ffff (image size = 0x13e9c) Kernel: 0c040000 - 0c190000 (image size = 0x147c88) Let’s do now the flashing: OMAP1610 H2 # protect off 0c000000 0c18ffff OMAP1610 H2 # erase 0c000000 0c18ffff OMAP1610 H2 # cp.b 11000000 0c000000 13e9c OMAP1610 H2 # cp.b 10000000 0c040000 147c88 OMAP1610 H2 # protect on 0c000000 0c18ffff Check if flashing was successful: OMAP1610 H2 # crc32 0c000000 13e9c OMAP1610 H2 # crc32 11000000 13e9c OMAP1610 H2 # imi 0c040000 We are ready now to boot from the target. Turn off the H2 board, on S401 DIP switch SW9 to OFF position, then turn the board on again. You should see U-Boot welcome message and prompt coming up again in the terminal window. We'll set up now the boot loader to boot the kernel from flash (now flash is mapped to address 0) and pass the proper kernel parameters. This latter includes setting the target's memory size and for NFS root the server and client IP addresses. I will use here static IP addresses, consult file:///Documentation/nfsroot.txt for further details about kernel command line NFS parameters: OMAP1610 H2 # printenv OMAP1610 H2 # setenv bootargs mem=32M console=ttyS0,115200n8 root=/dev/nfs rw nfsroot=192.168.0.1:/home/imdeak/omap-root ip=192.168.0.2:::::: OMAP1610 H2 # setenv loadaddr 40000 OMAP1610 H2 # saveenv 4.7 Set up the NFS root for the target 4.7.1 Create the root filesystem Your needs regarding the structure of the root may vary a lot, so I won't go here into details. In any case you may find the uClibc project useful, take a look at http://www.uclibc.org . I used a prebuilt root fs image from http://www.uclibc.org/downloads/root_fs_arm.bz2 . Mount it to an appropriate place and copy the filesystem to a place from where you will export it via NFS: $ bzip2 -d root_fs_arm.bz2 $ sudo mount -o loop root_fs_arm mnt $ cp -a mnt/* $TARGET_DIR/root Install also the kernel modules we have built in 4.4.2 to the root fs. This will also generate the module dependency file: $ cd linux-omap $ make INSTALL_MOD_PATH=$TARGET_DIR/root modules_install Edit $TARGET_DIR/root/etc/inittab to have a console on the serial line as well: ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 4.7.2 Export the root filesystem Edit /etc/exports to make the root fs available to the target: /home/imdeak/target/root 192.168.0.2(rw,sync,no_root_squash) Restart the NFS service: $ /etc/init.d/nfs-kernel-server restart Let the kernel go on the target: OMAP1610 H2 # bootm At the end of the boot you should see a login prompt both in your terminal window and on the board's LCD screen. 5. FURTHER READING ------------------------------------------------------------- - file:///Documentation/arm/OMAP/README - http://www.muru.com/linux/omap/ - Karim Yaghmour: Building Embedded Linux Systems - Linux-OMAP mailing list: http://linux.omap.com/mailman/listinfo/linux-omap-open-source ------------------------------------------------------------- Last modified 26. May 2004 Imre Deak (3 Jun 04. Changed URL for Linux-OMAP mailing list: Steve Johnson)