****** [Simtec_Electronics] ****** =============================================================================== ___________________ |Product:EB675001DIP| ****** EB675001DIP mCLinux notes ****** |Date:17/6/2005_____| |Reference:NTS002___| |Author:BJD_&_VRS___| |Version:1.5________| =============================================================================== ***** Contents ***** * Introduction * Install_compiler * Unpack_and_patch_mCLinux_distribution * Configuring_and_building_mCLinux * Download_and_run_image_on_module * References (c)2005 Simtec Electronics $Id: uclinux-20041215-notes.html,v 1.4 2005/06/19 12:59:11 vince Exp $ =============================================================================== ***** Introduction ***** This document outlines how to retrieve, unpack, patch, build and install the mCLinux distribution (15th December 2004 release) for use with the Simtec EB675001DIP module. The main steps are: 1. Install toolchain (cross compiler) 2. Unpack and patch mCLinux distribution 3. Configure and build your distribution 4. Download and execute image on module ***** Install compiler ***** Because of the limitations of mCLinux native compiling is usually not possible, so a cross compiler must be employed, cross compiler tools are typically hosted on a more powerful X86 machine and generate ARM binaries. A mCLinux_toolchain can be obtained from the mCLinux website. and provides all the necessary tools to compile the distribution. The arm-elf-tools-20030314.sh is the toolchain we have used to build our example images. To install one of the pre-built uCLinux toolchains the downloaded file must be executed as root. # sh arm-elf-tools-20030314.sh this will install arm-elf-* tools into /usr/local/bin ***** Unpack and patch mCLinux distribution ***** 1. Obtain the distribution files, patches and kernel sources, the complete list of required files are: o mCLinux_15/12/2004_Distribution # EB675001DIP_vendor_patches. # BOA_webserver_MimeType_fix o Linux_2.4.24_Kernel_source # mCLinux_2.4.24 Kernel patch. # 2.4.24-uc0-eb675001dip-2_mCLinux Kernel patch. 2. unpack the software distribution: # tar -xzf uClinux-dist-20041215.tar.gz 3. Unpack 2.4.24 kernel inside the distribution # cd uClinux-dist # tar -xjf linux-2.4.24.tar.bz2 4. Apply the patches for mCLinux # cd linux-2.4.24 # zcat uClinux-2.4.24-uc0.diff.gz | patch -p1 5. Apply Simtec OKI kernel patches # zcat patch-2.4.24-uc0-eb675001dip-2.gz | patch -p1 # cd .. 6. There may be some additional patches for specific hardware, possibly from application notes. Such additional patches should be applied in the same way as above at this point. 7. Move the original kernel out of the way and link the new one in place. # mv linux-2.4.x linux-2.4.x-orig # ln -s linux-2.4.24 linux-2.4.x 8. Apply Simtec Vendor patches for the EB675001DIP to the mCLinux distribution # zcat patch-uclinux20041215-vendor-eb675001dip.gz | patch -p1 9. Optionally apply this patch to add Mimetype file parsing to the BOA webserver # zcat patch-uclinux20041215-boamimetype.gz | patch -p1 ***** Configuring and building mCLinux ***** Ensure the present working directory is the unpacked mCLinux directory # cd uClinux-dist Then make the xconfig target # make xconfig Perform the following steps in the presented menu 1. Select `Target Platform Selection` 2. Select "Simtec" in the Vendor list 3. Return to Main Menu 4. `Save and Exit` Finally build the configured distribution with # make dep # make if successful, this will create the output images image.bin, linux.text and romfs.img in the images directory. ***** Download and run image on module ***** The uCLinux image created by the preceding steps or a pre-build binary download from the EB675100DIP_resources_page, can be started by the ABLE_bootloader. The ABLE bootloader is programmed into the EB675001DIP flash at manufacture time. If ABLE has been corrupted or lost the bootstrapping guide should be followed. From the ABLE command line the uCLinux image can be booted from either the network interface using TFTP or from flash **** Running uCLinux from network **** Downloading and executing the mClinux kernels and filesystem on the module using the network interface can be easily achieved using ABLE in one of two ways. Unless there is a specific reason it is recommended the combined image method is used. The following commands can be used to load the combined kernel and romfs image.bin file. > (tftpboot)image.bin root=/dev/ram console=ttyS0,115200 ro alternatively the following command can be issued to load the kernel and romfs files separately: > setargs root=/dev/ram console=ttyS0,115200 ro > load (tftpboot)linux.text (tftpboot)romfs.img > boot **** Running uCLinux from Flash **** Executing uCLinux from flash is a relatively straightforward process. However because ABLE is capable of reading from some filesystems directly the possibility exists of placing the contents of the root filesystem directly on a flash partition rather than from a romfs initial ramdisk. This extended mode of operation is not detailed here merely noted as a possibility for more advanced users. The main steps to place a combine kernel/romfs image in flash are: * Partition the NOR flash with the ABLE FIS tool * Reset the module * Use writefis to write image to flash * Reset the module * Configure ABLE to boot from the flash * Boot uCLinux from flash The ABLE_Flash_Information_Services_(FIS)_tool allows for the creation and manipulation of standard flash partitions on the NOR. The FIS user_guide should be consulted for full details on using the FIS tool. The ABLE_FIS_tool should be downloaded and placed on a suitable TFTP server. The ABLE FIS tool is executed with > (tftpboot)ablefis if this is the first time the NOR flash has been partitioned ABLE FIS will output ABLE RedBoot FIS Partition Tool, V0.20 (c) 2003 Simtec Electronics identify_machine: ableid is 5 Machine is OKI-EB67X001DIP setting flash enabled... Identifying JEDEC flash... Flash: SST 39LF160, 2048 KByte, [0x00BF, 0x2782] did not find valid RedBoot FIS table on device, creating new Created default table Partitions (2 of 16): 00: 0x00000000 -> 00080000: ABLE 01: 0x00000000 -> 00000000: Partition Marker Free space: 0x00080000 -> 0x001ff000 (0x0017f000 bytes) commands: p - print current table d - delete partition e - edit partition x - extend table (add new partititon) s - shorten table (remove last partition) w - write table to flash q - quit main> use the x command to add a new partition and e to start editing it, use n to name the partition and p to alter length of the new partition (usually the entire remaining Free space) main> e Which partition to edit (0-2) ?2 Partition 2: Name = Unused 2 Flash Address = 0x00080000 Flash Length = 0x00000000 Data Execution Base = 0x00000000 Data Execution Entry = 0x00000000 Data Length = 0x00000000 Edit commands: n - edit name p - edit position in flash d - edit data-length b - edit execution base e - edit execution address r - return to main menu s - show parition information again h - print this help message edit 2> n Enter new name for parititon (max 15 characters): RootFS edit 2> p Free space: 0x00080000 -> 0x001ff000 (0x0017f000 bytes) Current position is 0x00080000 -> 00080000 (0 bytes) New value for start position in flash (0x00080000) ? New value for length in flash (0x00000000) ?0x0017f000 edit 2> s Partition 2: Name = RootFS Flash Address = 0x00080000 Flash Length = 0x0017f000 Data Execution Base = 0x00000000 Data Execution Entry = 0x00000000 Data Length = 0x00000000 edit 2> r main> next use the p command to display the partition table and (if acceptable) wite it to flash with the w command main> p Partitions (3 of 16): 00: 0x00000000 -> 00080000: ABLE 01: 0x00000000 -> 00000000: Partition Marker 02: 0x00080000 -> 001ff000: RootFS Free space: main> w Writing new FIS table to flash Erasing device: . done Writing data: . done Verifying data: . done Done. Changes will not take effect until next reset main> q Finishing operation: done Done > reset ABLE with the reset command and during the boot messages the following lines indicate ABLE can now detect and use the newly created partition table RedBoot partition 'ABLE': (flash0) on (nor0p1) RedBoot partition 'RedBoot': zero length, not adding RedBoot partition 'RootFS': (flash1) on (nor0p2) Once a partition has been created the uCLinux image may be written into the flash using the fiswrite tool. The ABLE_fiswrite_tool should be downloaded and placed on a suitable TFTP server. The tool is used to program the uCLinux image with: >(tftpboot)fiswrite 2 (tftpboot)eb675001dip-uclinux.bin.Z tftp: attempting bootp bootp: sending request bootp: readudp returned -2 bootp: readudp returned -2 bootp: serverip: 192.168.7.1 bootp: netmask: 255.255.255.0 bootp: readudp returned -2 bootp: serverip: 192.168.7.1 bootp: netmask: 255.255.255.0 bootp: address: 192.168.7.239 .....loaded (tftpboot)fiswrite, 0x830c bytes at 0x00008000 boot: booting 'able app1' ABLE RedBoot FIS Data Write Tool, V0.20 (c) 2004 Simtec Electronics identify_machine: ableid is 5 Machine is OKI-EB67X001DIP setting flash enabled... Identifying JEDEC flash... Flash: SST 39LF160, 2048 KByte, [0x00BF, 0x2782] read valid RedBoot FIS table Partitions (3 of 16): 00: 0x00000000 -> 00080000: ABLE 01: 0x00000000 -> 00000000: Partition Marker 02: 0x00080000 -> 001ff000: RootFS Go ahead with write of '(tftpboot)eb675001dip-uclinux.bin.Z' to '2' (y/N) ?yes .......................... ................................ ................................ ................................ ........loaded 1067163 bytes Erasing device: .............................................................. Writing data: ................................................................ Verifying data: .............................................................. Done > Once the image is written to flash it may be executed directly from the partition just as it may be from a TFTP server as shown below. >(nor0p2) root=/dev/ram console=ttyS0,115200 ro Decompressing z file. Output at 00008000 length 8388608 Output length actual 1M loaded (nor0p2), 0x1b7175 bytes at 0x00008000 boot: booting 'linux' Possible attached fs image - checking - romfs - ok relocating 815105 bytes Booting Linux Linux version 2.4.24-uc0 (vince@derik) (gcc version 2.95.3 20010315 (release) (C5 Processor: OKI ML67400X revision 1 Architecture: EB67X001 CPU is ML67500x series OKI: Clk 58.982 MHz, HClk 58.982 MHz, CCLk 29.491 MHz Reserving page zero for vector table On node 0 totalpages: 8192 zone(0): 0 pages. zone(1): 8192 pages. zone(2): 0 pages. Kernel command line: root=/dev/ram console=ttyS0,115200 ro clearing irq controller Initialising timer: registering timer interrupt... enabling timer... TMR_VAL = 00002400 timer enabled registering serial (b7b00000,9) serial_req.baud_base = 1843200 serial_req.iomem_base = b7b00000 calling register_serial() ttyS00 at iomem 0xb7b00000 (irq = 9) is a 16550A Calibrating delay loop... 29.38 BogoMIPS Memory: 32MB = 32MB total Memory: 30476KB available (874K code, 173K data, 44K init) Dentry cache hash table entries: 4096 (order: 3, 32768 bytes) Inode cache hash table entries: 2048 (order: 2, 16384 bytes) Mount cache hash table entries: 512 (order: 0, 4096 bytes) Buffer cache hash table entries: 1024 (order: 0, 4096 bytes) Page-cache hash table entries: 8192 (order: 3, 32768 bytes) POSIX conformance testing by UNIFIX Linux NET4.0 for Linux 2.4 Based upon Swansea University Computer Society NET3.039 Initializing RT netlink socket Starting kswapd Serial driver version 5.05c (2001-07-08) with no serial options enabled ttyS00 at 0xb7b00000 (irq = 9) is a 16550A RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize EB67DIP DM9000 Driver, (c) 2003 Simtec Electronics DM9000: id=90000a46 eth0: bast-dm9000 found at 0xf0e00000, IRQ 22, 00:11:AC:00:06:00. NET4: Linux TCP/IP 1.0 for NET4.0 IP Protocols: ICMP, UDP, TCP IP: routing cache hash table of 512 buckets, 4Kbytes TCP: Hash tables configured (established 2048 bind 2048) NET4: Unix domain sockets 1.0/SMP for Linux NET4.0. RAMDISK: romfs filesystem found at block 0 RAMDISK: Loading 796 blocks [1 disk] into ram disk... done. Freeing initrd memory: 796K VFS: Mounted root (romfs filesystem) readonly. Freeing init memory: 44K Shell invoked to run file: /etc/rc Command: hostname Oki Command: /bin/expand /etc/ramfs.img /dev/ram1 Command: mount -t proc proc /proc Command: mount -t ext2 /dev/ram1 /var Command: mkdir /var/tmp Command: mkdir /var/log Command: mkdir /var/run Command: mkdir /var/lock Command: mkdir /var/empty Command: cat /etc/motd Welcome to ____ _ _ / __| ||_| _ _| | | | _ ____ _ _ _ _ | | | | | | || | _ \| | | |\ \/ / | |_| | |__| || | | | | |_| |/ \ | ___\____|_||_|_| |_|\____|\_/\_/ | | |_| For further information check: http://www.uclinux.org/ Simtec Electronics Oki EB675001DIP http://www.simtec.co.uk/products/EB675001DIP/ Command: ifconfig lo 127.0.0.1 Command: route add -net 127.0.0.0 netmask 255.255.255.0 lo Command: dhcpcd & [14] Execution Finished, Exiting Sash command shell (version 1.1.1) /> The module has now successfully booted uCLinux from flash, the nvram settings boot.cmd and boot.timeout may be altered as desired. The ABLE user manual has full details on how to achieve this. ***** References ***** * http://www.kernel.org/pub/linux/kernel/v2.4/ 2.4 series kernel sources. * http://www.uclinux.org/pub/uClinux/dist/ mCLinux distribution page * http://www.uclinux.org/pub/uClinux/uClinux-2.4.x/ mCLinux Kernel source page. * http://www.simtec.co.uk/products/EB675001DIP/files/EB675001DIP- bootstrap.htmlEB675001DIP bootstrap document * http://www.simtec.co.uk/products/SWABLE/files/able-set/ABLE documentation * http://www.simtec.co.uk/products/SWABLE/files/able-set/ simtec_ablefis_book.htmlABLE FIS tool user guide * http://www.simtec.co.uk/products/EB675001DIP/resources.htmlEB6750-01DIP resources page ______________________________ |***** Simtec Electronics *****| |Web:http://www.simtec.co.uk/ | |Email:info@simtec.co.uk | |Simtec Electronics, | |Avondale Drive, | |Tarleton, | |Preston, | |Lancs | |PR4 6AX | |United Kingdom | |Tel:+44 (0)1772 812863 | |Fax:+44_(0)1772_816426________|