Installing uClinux on the DragonEngine II ----------------------------------------- * Note * This document is outdated... The latest infos and patches about uClinux on the DragonEngine can be found at: http://www.menie.org/georges/DragonEngine/index.html 1) Installing the m68k-elf toolchain ------------------------------------ I've tested two toolchains, from Bernhard Kuhn's web site: http://www.rcs.ei.tum.de/~kuhn/uclinux/uClinux-m68k-elf-toolchain/20010718/RPMS and from the uClinux web site: http://www.uclinux.org/ports/coldfire/source.html the first toolchain is RPM based and install itself into /opt/uClinux/, the second one is tarball based and install itself into /usr/local/. If you already have a m68k-elf toolchain up and running, you may skip this step and install directly the uClinux distribution. 2) Downloading the uClinux distribution --------------------------------------- I'm working with this distribution: http://www.uclinux.org/ports/coldfire/uClinux-dist-20011112.tar.gz which is the Full Source Distribution link from: http://www.uclinux.org/ports/coldfire/source.html once downloaded, install it in your workspace (for example 'work') $ cd $ mkdir work $ cd work $ tar xvfz /uClinux-dist-20011112.tar.gz 3) Applying the patch --------------------- copy the patch to your 'work' directory, then $ cp /patch-uClinux-dist-20011112-de2-20011215.gz . $ cd uClinux-dist $ zcat ../patch-uClinux-dist-20011112-de2-20011215.gz | patch -p1 this will create a new board setup, with defaults settings. 4) Generating an image ---------------------- as root, create a /tftpboot directory and change its permission, this directory will receive the generated image to be downloaded. if this directory already exist, adjust its permission. # mkdir /tftpboot # chmod 777 /tftpboot as a normal user (in the work/uClinux-dist directory): $ make xconfig (or make menuconfig, or make config) click on the "Target Platform Selection" button select the "Exys/de2" board on the vendor/product selector keep the "uClinux-2.4.x" selection for the Kernel version, the patch does not work for uClinux-2.0. keep the uC-libc setting. select "y" on the "Default all settings" choice and click on the "Main menu" button, then click on the "Save and Exit" button on the main window. go back to your terminal window and type: $ make dep; make clean then: $ make after a couple of minutes, you will have a new file: /tftpboot/image.bin the file contains the boot kernel and a rom file system. 5) Running the image -------------------- on your de2 board, download the image file cb 115200 dl 0x01E00000 cb 19200 go 0x01E00400 Note: the download address (0x01E00000) is different from the start exec address (0x01E00040) the image is generated for a 32MB DragonEngine II if you have 8 or 16 MB SDRAM, change the memory map in uClinux-dist/vendors/Exys/de2/himem.ld and uClinux-dist/vendors/Exys/de2/rom.ld (see note below). The RAM option is not working yet, this patch allow to run uClinux from RAM through the HIMEM option or from Flash through the ROM option. during the boot, there will be a pause during 'Calibrating delay loop...' it's not hanging, be patient (0 to 10 seconds) You should be able to log on (login: root, password: uClinux) and try the onboard commands. Note on the ETH hardware address -------------------------------- The default build compile the hardware address directly in the kernel : uClinux-dist/linux-2.4.x/arch/m68knommu/platform/68VZ328/de2/config.c you can set your own hardware address at the end of the file if you can write this address into the EEPROM memory of the board, there is an build option to read it at boot time from the EEPROM. The option can be activated when running make xconfig, selecting "customize kernel settings" then "processor type and features". The option name is "Read ETH address from EEPROM" below the DragonEngine board support option. You may also set the offset in bytes from the beginning of the EEPROM at which read the address. Note on memory map ------------------ The file himem.ld and rom.ld located in the directory uClinux-dist/vendors/Exys/de2, may be customized to you memory layout. the file himem.ld for a 32MB SDRAM contains: romvec : ORIGIN = 0x01e00000, LENGTH = 1k flash : ORIGIN = 0x01e00400, LENGTH = 2M - 1k eflash : ORIGIN = 0x02000000, LENGTH = 0 ramvec : ORIGIN = 0x00000000, LENGTH = 1k ram : ORIGIN = 0x00010000, LENGTH = 30M - 64k eram : ORIGIN = 0x01e00000, LENGTH = 0 the file himem.ld for a 16MB SDRAM should have: romvec : ORIGIN = 0x00e00000, LENGTH = 1k flash : ORIGIN = 0x00e00400, LENGTH = 2M - 1k eflash : ORIGIN = 0x01000000, LENGTH = 0 ramvec : ORIGIN = 0x00000000, LENGTH = 1k ram : ORIGIN = 0x00010000, LENGTH = 14M - 64k eram : ORIGIN = 0x00e00000, LENGTH = 0 the file himem.ld for a 8MB SDRAM should have: romvec : ORIGIN = 0x00600000, LENGTH = 1k flash : ORIGIN = 0x00600400, LENGTH = 2M - 1k eflash : ORIGIN = 0x00800000, LENGTH = 0 ramvec : ORIGIN = 0x00000000, LENGTH = 1k ram : ORIGIN = 0x00010000, LENGTH = 6M - 64k eram : ORIGIN = 0x00600000, LENGTH = 0 romvec is the initializing copy of the INT vectors array, flash and eflash are the target address for the code segment (usually a rom/flash). ramvec is the base address of the initialized INT vectors. ram and eram are the target address for the R/W memory used for data, RAM file systems and processes. In the himem.ld file, we are using the top 2MB of SDRAM as the code segment target. The rom.ld file is really using the Flash to store the code segment. --------------------------------------------------------- Run example --------------------------------------------------------- DEII> cb 115200 DEII> dl 0x01E00000 DEII> cb 19200 DEII> go 0x01E00400 ABCDEF Linux version 2.4.10-uc0 (gmenie@kq7u0) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(-msep-data patches)) #1 Tue Dec 11 23:35:17 CET 2001 68VZ328 DragonBallVZ support (c) 2001 Lineo, Inc. uClinux/MC68VZ328 M68VZ328 support by Evan Stawnyczy Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne DragonEngine II board support by Georges Menie On node 0 totalpages: 7680 zone(0): 0 pages. zone(1): 7680 pages. zone(2): 0 pages. Kernel command line: Calibrating delay loop... 2.83 BogoMIPS Memory available: 29916k/30656k RAM, 0k/0k ROM (575k kernel code, 243k data) 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 Starting kswapd pty: 256 Unix98 ptys configured MC68328 serial driver version 1.00 ttyS0 at 0xfffff900 (irq = 64) is a builtin MC68328 UART block: 64 slots per queue, batch=8 RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize cs89x0:cs89x0_probe(0x0) PP_addr=0x3000 cs89x0.c: v2.4.3-pre1 Russell Nelson , Andrew Morton eth0: cs8900 rev J found at 0x8000040 cs89x0 media RJ-45, IRQ 9, programmed I/O, MAC 00:40:b9:ff:ff:ff cs89x0_probe1() successful Blkmem copyright 1998,1999 D. Jeff Dionne Blkmem copyright 1998 Kenneth Albanowski Blkmem 1 disk images: 0: 1EB8018-1F39017 [VIRTUAL 1EB8018-1F39017] (RO) 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. VFS: Mounted root (romfs filesystem) readonly. eth0: using half-duplex 10Base-T (RJ-45) Welcome to ____ _ _ / __| ||_| _ _| | | | _ ____ _ _ _ _ | | | | | | || | _ \| | | |\ \/ / | |_| | |__| || | | | | |_| |/ \ | ___\____|_||_|_| |_|\____|\_/\_/ | | |_| For further information check: http://www.uclinux.org/ deII login: root Password: # ls sbin tmp var usr proc mnt lib home etc dev bin # free total used free shared buffers Mem: 29916 1360 28556 0 176 # cat /proc/meminfo total: used: free: shared: buffers: cached: Mem: 30633984 1396736 29237248 0 180224 483328 Swap: 0 0 0 MemTotal: 29916 kB MemFree: 28552 kB MemShared: 0 kB Buffers: 176 kB Cached: 472 kB SwapCached: 0 kB Active: 92 kB Inactive: 556 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 29916 kB LowFree: 28552 kB SwapTotal: 0 kB SwapFree: 0 kB # ping -c4 192.168.1.3 PING 192.168.1.3 (192.168.1.3): 56 data bytes 64 bytes from 192.168.1.3: icmp_seq=0 ttl=255 time=20.0 ms 64 bytes from 192.168.1.3: icmp_seq=1 ttl=255 time=10.0 ms 64 bytes from 192.168.1.3: icmp_seq=2 ttl=255 time=10.0 ms 64 bytes from 192.168.1.3: icmp_seq=3 ttl=255 time=10.0 ms --- 192.168.1.3 ping statistics --- 4 packets transmitted, 4 packets received, 0% packet loss round-trip min/avg/max = 10.0/12.5/20.0 ms # cat /proc/interrupts Internal 68VZ328 interrupts 1: 7477 timer 2: 1622 M68328_UART 9: 11 eth0 # cd /etc # ls -l -rwxr-xr-x 1 0 0 2778 ramfs.img -rw-r--r-- 1 0 0 44 inetd.conf -rw-r--r-- 1 0 0 55 version -rw-r--r-- 1 0 0 21 passwd -rw-r--r-- 1 0 0 296 motd -rwxr-xr-x 1 0 0 8205 services -rw-r--r-- 1 0 0 73 fstab -rw-r--r-- 1 0 0 95 inittab -rw-r--r-- 1 0 0 390 rc # cat rc hostname deII /bin/expand /etc/ramfs.img /dev/ram0 mount -t proc proc /proc mount -t ext2 /dev/ram0 /var mkdir /var/tmp mkdir /var/log mkdir /var/run mkdir /var/lock ifconfig lo 127.0.0.1 route add -net 127.0.0.0 netmask 255.0.0.0 lo ifconfig eth0 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255 route add 192.168.1.2 eth0 route add default gw 192.168.1.1 portmap & cat /etc/motd # ifconfig eth0 Link encap:Ethernet HWaddr 00:40:B9:FF:FF:FF inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:6 errors:0 dropped:0 overruns:0 frame:0 TX packets:6 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 Interrupt:9 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 # ps PID TTY Uid Size State Command 1 0 740352 S init 2 0 0 S [keventd] 3 0 0 S [ksoftirqd_CPU0] 4 0 0 S [kswapd] 5 0 0 S [bdflush] 6 0 0 S [kupdated] 21 1 0 S portmap 23 0 0 S /bin/inetd 24 0 0 S /bin/boa 25 ttyS0 0 0 S sh 34 ttyS0 0 0 R ps # uptime 12:01am up 1 min, load average: 0.02, 0.02, 0.00 # reboot Restarting system. ************************* * DragonEngine II board * ************************* (c) 2000,2001 SDT Int'l DEMon revision 1.1.0 ready: DEII> --------------------------------------------------------- Have fun ! Georges Menie