Linux BSP for MS7720RP02 README 1. Release notes 1.1 BSP Components Linux kernel version : 2.6.22.11 support CPU : SH7721 little endian GCC version : 4.2 glibc version : 2.5 Linux support driver : SCIF, USB host, USB function, LCDC userland : busybox-1.8.1, bash-3.2, microwindows-0.91 1.2 Software contents ./bin: cf-image-ms7720-20071204.bin u-boot_ms7720se-20071203a.srec rootfs-ms7720-20071204.tar.bz2 ./doc: build_sh3_linux_v0701.sh README_ms7720se.txt ./src: kernel tools u-boot userland ./src/kernel: linux-2.6.22.11-ms7720se-20071130.tar.bz2 ./src/tools: binutils-2.17-sh-linux_v0701.tar.bz2 gcc-4.2-sh-linux_v0701.tar.bz2 glibc-2.5-sh-linux_v0701.tar.bz2 linux-libc-headers-2.6.12.0-sh-linux_v0701.tar.bz2 ./src/u-boot: u-boot-sh-ms7720-20071203a.tar.bz2 ./src/userland: microwindows-0.91-20071128.tar.bz2 ./tools: toolchain_sh3_gcc4.2.tar.gz ---------------------------------------------------------------------------- 2. How to wirte uboot loader to flash You can program uboot program executable binary to the flash memory with on-board minitor utility program. This section tells you step by step procedure for this. 2.1 Set MS7720RP02's SW4-1, SW4-2, SW4-3 and SW4-4 to "on" postion. This enables board maintainace mode. 2.2 Connect RS232C cable, baudrate is 115200bps, no parity, 8bit data. 2.3 Power on MS7720RP02 to start board monitor program 2.4 Type "FL 0" command. 2.5 Send u-boot_ms7720se-20071130.srec ========================================================= MS7720RP01 Self Debugger Ver 1.1L --------------------------------------------------------- (c)Copyright 1999-2005. Hitachi.Ltd. All right reserved ========================================================= H[elp] for help messages... Ready >FL 0 Flash ROM data copy to RAM Please Send A S-format Record Start Addrs = 00000000 End Addrs = 000122D8 Transfer complete Flash erase:complete Program :complete Flash write complete Ready > 2.6 Power off MS7720RP02. 2.7 Set MS7720RP02's SW4-2 to "off" position to resume normal mode. 2.8 Re-power on MS7720RP02 to start uboot program. If uboot is successfully programed, following uboot messages should come up. U-Boot 1.3.0-rc2-geda3e1e6-dirty (Nov 30 2007 - 16:16:30) CPU: SH3 BOARD: Hitachi UL MS7720SE DRAM: 64MB FLASH: 16MB *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial => ---------------------------------------------------------------------------- 3. How to write Linux image (kernel and root filesystem) to CF card 3.1 Attach CF card to Linux host PC. CF would be recognized as /dev/sdb in most case,it depends on your environment. 3.2 Write kernel image in the Compact flash by the flollowing commands. dd if=cf-image-ms7720-20071130.bin of=/dev/sdb Note : "of" must be /dev/sdb, not /dev/sdb1 ---------------------------------------------------------------------------- 4. How to boot Linux kernel To start Linux kernel just put following 3 commands "pinit on", "ide reset", "ext2load ide :1" and "go 8e000000". Please refer boot log for your reference U-Boot 1.3.0-rc2-geda3e1e6-dirty (Dec 3 2007 - 23:02:15) CPU: SH3 BOARD: Hitachi UL MS7720SE DRAM: 64MB FLASH: 8MB *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial => pinit on Enable PCMCIA slot A => ide reset Reset IDE: Bus 0: OK Device 0: Model: SanDisk SDCFB-128 Firm: HDX 2.27 Ser#: 0043600B99Q75451 Type: Removable Hard Disk Capacity: 122.5 MB = 0.1 GB (250880 x 512) => ext2load 8e000000 Usage: ext2load- load binary file from a Ext2 filesystem => ext2load ide :1 1277956 bytes read => go 8e000000 ## Starting application at 0x8E000000 ... Linux version 2.6.22.11 (root@localhost.localdomain) (gcc version 4.2-SH3-LINUX_v0701) #1 PREEMPT Tue Dec 4 12:54:24 JST 2007 Node 0: start_pfn = 0xc000, low = 0xff00 Zone PFN ranges: Normal 49152 -> 65280 early_node_map[1] active PFN ranges 0: 49152 -> 65280 Node 0: mem_map starts at 8c23d000 Built 1 zonelists. Total pages: 16002 Kernel command line: mem=63M console=ttySC0,115200 root=/dev/sda2 PID hash table entries: 256 (order: 8, 1024 bytes) Using tmu for system timer Using 8.333 MHz high precision timer. Console: colour dummy device 80x25 Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) Memory: 61592k/61656k available (1603k kernel code, 2856k reserved, 476k data, 72k init) Mount-cache hash table entries: 512 CPU: SH7721 NET: Registered protocol family 16 SCSI subsystem initialized usbcore: registered new interface driver usbfs usbcore: registered new interface driver hub usbcore: registered new device driver usb Time: SuperH clocksource has been installed. NET: Registered protocol family 2 IP route cache hash table entries: 1024 (order: 0, 4096 bytes) TCP established hash table entries: 2048 (order: 2, 16384 bytes) TCP bind hash table entries: 2048 (order: 1, 8192 bytes) TCP: Hash tables configured (established 2048 bind 2048) TCP reno registered io scheduler noop registered (default) Console: switching to colour frame buffer device 30x40 fb0: SH7720 FB frame buffer device. (paddr=0xaff00000, vaddr=0xaff00000) SuperH SCI(F) driver initialized sh-sci: ttySC0 at MMIO 0xa4430000 (irq = 80) is a scif sh-sci: ttySC1 at MMIO 0xa4438000 (irq = 81) is a scif RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize pata_platform.c: interrupt polling ver. scsi0 : pata_platform ata1: PATA max PIO0 cmd 0xb86001f0 ctl 0xb86003f6 bmdma 0x00000000 irq 14 ata1.00: CFA: SanDisk SDCFB-128, HDX 2.27, max PIO4 ata1.00: 250880 sectors, multi 0: LBA ata1.00: configured for PIO scsi 0:0:0:0: Direct-Access ATA SanDisk SDCFB-12 HDX PQ: 0 ANSI: 5 sd 0:0:0:0: [sda] 250880 512-byte hardware sectors (128 MB) sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA sd 0:0:0:0: [sda] 250880 512-byte hardware sectors (128 MB) sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA sda: sda1 sda2 sd 0:0:0:0: [sda] Attached SCSI removable disk physmap platform flash device: 01000000 at a0000000 physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank physmap-flash.0: Found 1 x16 devices at 0x800000 in 16-bit bank Amd/Fujitsu Extended Query Table at 0x0040 physmap-flash.0: CFI does not contain boot bank location. Assuming top. number of CFI chips: 2 cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness. cmdlinepart partition parsing not available RedBoot partition parsing not available Using physmap partition information Creating 4 MTD partitions on "physmap-flash.0": 0x00000000-0x00020000 : "bootloader" 0x00020000-0x00030000 : "bootenv" 0x00040000-0x00440000 : "kernel" 0x00430000-0x01000000 : "root" usbmon: debugfs is not available sh_ohci sh_ohci: SuperH OHCI sh_ohci sh_ohci: new USB bus registered, assigned bus number 1 sh_ohci sh_ohci: irq 67, io mem 0xa4428000 usb usb1: configuration #1 chosen from 1 choice hub 1-0:1.0: USB hub found hub 1-0:1.0: 2 ports detected Initializing USB Mass Storage driver... usb 1-2: new low speed USB device using sh_ohci and address 2 usb 1-2: configuration #1 chosen from 1 choice usbcore: registered new interface driver usb-storage USB Mass Storage support registered. usbcore: registered new interface driver usbtest driver sh_udc, 12 Nov 2007 mice: PS/2 mouse device common for all mice input: Logitech Optical USB Mouse as /class/input/input0 input: USB HID v1.10 Mouse [Logitech Optical USB Mouse] on usb-ohci_hcd-2 usbcore: registered new interface driver usbhid drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver heartbeat: version 0.1.0 loaded TCP cubic registered NET: Registered protocol family 1 NET: Registered protocol family 17 drivers/rtc/hctosys.c: unable to open rtc device (rtc0) kjournald starting. Commit interval 5 seconds EXT3-fs warning: maximal mount count reached, running e2fsck is recommended EXT3 FS on sda2, internal journal EXT3-fs: recovery complete. EXT3-fs: mounted filesystem with ordered data mode. VFS: Mounted root (ext3 filesystem). Freeing unused kernel memory: 72k freed (none) login: root login[722]: root login on 'ttySC0' -bash-3.2# ---------------------------------------------------------------------------- 5. How to use kernel driver 5.1 USB host 5.1.1 Connect USB device to CN12 of MS7720RP02. Note : CN11 is not used. 5.2 USB function for Mass Storage 5.2.1 The flollowing commands: modprobe g_file_storage file=/dev/ram0 5.2.2 Connect USB cable CN10 of MS7720RP02 and Host PC. 5.2.3 Input the following commands with the HostPC which connected USB to. (precondition: This USB function device name is /dev/sdb) [root@localhost ~]# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSFdisklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (2-1024, default 2): Using default value 2 Last cylinder or +size or +sizeM or +sizeK (2-1024, default 1024): Using default value 1024 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@localhost ~]# mkfs.ext2 /dev/sdb1 mke2fs 1.39 (29-May-2006) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 512 inodes, 4092 blocks 204 blocks (4.99%) reserved for the super user First data block=1 Maximum filesystem blocks=4194304 1 block group 8192 blocks per group, 8192 fragments per group 512 inodes per group Writing inode tables: done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 29 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@localhost ~]# mount -t ext2 /dev/sdb1 /media/removal/ [root@localhost ~]# 5.3 LCD 5.3.1 Connect USB mise to CN12 of MS7720RP02. 5.3.2 The flollowing commands: cd /root/microwindows-0.91 ./nano-X & ./nanowm & ./nxeyes & 6. Userland contents 6.1 Program lists /bin: addgroup df iplink mt sh adduser dmesg iproute mv sleep ash dumpkmap iprule netstat stat bash echo iptunnel nice stty busybox ed kill pidof su cat egrep linux32 ping sync catv false linux64 ping6 tar chattr fdflush ln pipe_progress touch chgrp fgrep login printenv true chmod getopt ls ps umount chown grep lsattr pwd uname cp gunzip mkdir rm uncompress cpio gzip mknod rmdir usleep date hostname mktemp rpm vi dd ip more run-parts watch delgroup ipaddr mount sed zcat deluser ipcalc mountpoint setarch /sbin: adjtimex ifup modprobe sulogin arp init nameif swapoff fdisk insmod pivot_root swapon freeramdisk klogd poweroff switch_root fsck loadkmap raidautorun sysctl fsck.minix logread reboot syslogd getty losetup rmmod udhcpc halt lsmod route vconfig hdparm makedevs runlevel watchdog hwclock mdev setconsole zcip ifconfig mkfs.minix slattach ifdown mkswap start-stop-daemon /usr: bin sbin /usr/bin: [ deallocvt hexdump nmeter seq tr [[ diff hostid nohup setkeycodes traceroute ar dirname id nslookup setsid tty arping dos2unix install od setuidgid ttysize awk du ipcrm openvt sha1sum udpsvd basename dumpleases ipcs passwd softlimit unexpand bunzip2 eject kbd_mode patch sort uniq bzcat env killall pgrep split unix2dos bzip2 envdir killall5 pkill strings unlzma cal envuidgid last printf sum unzip chpst ether-wake length pscan sv uptime chrt expand less readahead svlogd uudecode chvt expr loadfont readlink tail uuencode cksum fdformat logger realpath taskset vlock clear find logname renice tcpsvd wc cmp fold lzmacat reset tee wget comm free md5sum resize telnet which crontab ftpget mesg rpm2cpio test who cryptpw ftpput microcom runsv tftp whoami cut fuser mkfifo runsvdir time xargs dc head nc rx top yes /usr/sbin: chpasswd dhcprelay fbset rdate telnetd chroot dnsd httpd readprofile udhcpd crond fakeidentd inetd setlogcons 6.2 Supportted busybox comand list [, [[, addgroup, adduser, adjtimex, ar, arp, arping, ash, awk, basename, bunzip2, bzcat, bzip2, cal, cat, catv, chattr, chgrp, chmod, chown, chpasswd, chpst, chroot, chrt, chvt, cksum, clear, cmp, comm, cp, cpio, crond, crontab, cryptpw, cut, date, dc, dd, deallocvt, delgroup, deluser, df, dhcprelay, diff, dirname, dmesg, dnsd, dos2unix, du, dumpkmap, dumpleases, echo, ed, egrep, eject, env, envdir, envuidgid, ether-wake, expand, expr, fakeidentd, false, fbset, fdflush, fdformat, fdisk, fgrep, find, fold, free, freeramdisk, fsck, fsck.minix, ftpget, ftpput, fuser, getopt, getty, grep, gunzip, gzip, halt, hdparm, head, hexdump, hostid, hostname, httpd, hwclock, id, ifconfig, ifdown, ifup, inetd, init, insmod, install, ip, ipaddr, ipcalc, ipcrm, ipcs, iplink, iproute, iprule, iptunnel, kbd_mode, kill, killall, killall5, klogd, last, length, less, linux32, linux64, linuxrc, ln, loadfont, loadkmap, logger, login, logname, logread, losetup, ls, lsattr, lsmod, lzmacat, makedevs, md5sum, mdev, mesg, microcom, mkdir, mkfifo, mkfs.minix, mknod, mkswap, mktemp, modprobe, more, mount, mountpoint, mt, mv, nameif, nc, netstat, nice, nmeter, nohup, nslookup, od, openvt, passwd, patch, pgrep, pidof, ping, ping6, pipe_progress, pivot_root, pkill, poweroff, printenv, printf, ps, pscan, pwd, raidautorun, rdate, readahead, readlink, readprofile, realpath, reboot, renice, reset, resize, rm, rmdir, rmmod, route, rpm, rpm2cpio, run-parts, runlevel, runsv, runsvdir, rx, sed, seq, setarch, setconsole, setkeycodes, setlogcons, setsid, setuidgid, sh, sha1sum, slattach, sleep, softlimit, sort, split, start-stop-daemon, stat, strings, stty, su, sulogin, sum, sv, svlogd, swapoff, swapon, switch_root, sync, sysctl, syslogd, tail, tar, taskset, tcpsvd, tee, telnet, telnetd, test, tftp, time, top, touch, tr, traceroute, true, tty, ttysize, udhcpc, udhcpd, udpsvd, umount, uname, uncompress, unexpand, uniq, unix2dos, unlzma, unzip, uptime, usleep, uudecode, uuencode, vconfig, vi, vlock, watch, watchdog, wc, wget, which, who, whoami, xargs, yes, zcat, zcip ---------------------------------------------------------------------------- 7. GNU toolchain 7.1 Code base Based on KPIT v701 GNU toolchain codebase, we rebiuld SH-3 target GNU toolchain. And we added zlib library. 7.2 How to install 7.2.1 Extract "toolchain_sh3_gcc4.2.tar.bz2" under any directory. cp toolchain_sh3_gcc4.2.tar.bz2 /home/ms7720se/tool cd /home/ms7720se/tool tar jxf toolchain_sh3_gcc4.2.tar.bz2 export PATH=/home/ms7720se/tool/usr/share/gnush3_linux_v0701-1/bin/:$PATH 7.3 How to compile kernel 7.3.1 Extend "linux-2.6.22.11-ms7720se-20071128.tar.bz2" under any directory. cp linux-2.6.22.11-ms7720se-20071128.tar.bz2 /home/ms7720se cd /home/ms7720se tar jxf linux-2.6.22.11-ms7720se-20071128.tar.bz2 7.3.2 kernel configuration cd /home/ms7720se/linux-2.6.22.11 cp arch/sh/configs/se7720_defconfig .config make ARCH=sh CROSS_COMPILE=sh3-linux- menuconfig 7.3.3 Compile kernel If compiling is finished normally, the kernel image file (zImage) will be made under "arch/sh/boot". make ARCH=sh CROSS_COMPILE=sh3-linux- 7.4 How to compile U-boot 7.4.1 Extract "u-boot-sh-ms7720-20071128.tar.bz2" under any directory. cp u-boot-sh-ms7720-20071128.tar.bz2 /home/ms7720se cd /home/ms7720se tar jxf u-boot-sh-ms7720-20071128.tar.bz2 7.4.2 Compile bootloader If the compiling of bootloader finishes normally, "u-boot.bin" is made under "u-boot-sh". cd /home/ms7720se/u-boot.sh make ms7720se_config make CROSS_COMPILE=sh3-linux-