There are quite many limitations using old kernel for Agestar, one of them is you can not install the latest Linux distribution. I am eager to make the new Linux kernel to work on the agestar hardware. So since my last post, mainly I am just hacking at the kernel and not at the userspace stuff. As of today, I managed to boot the new kernel, and wrote a serial driver for it (you can see the boot messages at the end of this post). My next target is to port the USB and/or NIC driver.
As you may have read from my earlier posts, there are no documentations available for the STR 9100 hardware, so I based my work on the source code of the earlier kernel (I can’t believe so many things have changed since the 2.4.36). The initial work is quite easy if you are an experienced kernel developer. Because I am not experienced, I need to study quite many things before reaching the current state.
Because I don’t have any documentation about the FA526 CPU, I took the CPU specific code from the Icy Box. They provide the source code for Kernel 2.6. The SoC uses the same Processor, but completely different hardware for the rest (well, something is better than nothing). For the serial port, I realized that the serial port used is "High-speed 16C550-compliant UART serial channel" http://www.starsemi.com/vChn/Prods/str9104.php, so I studied the source code for 8250.c and added a small code to specify the the UART speed, register mapping, and memory location for the UART IO. This creates a much cleaner code than the original serial_str9100.c source code. The serial_str9100.c was 3799 lines of code, mine was about 100 lines of code (70 lines of code in a separate file, and the rest is adding register mapping to 8250.c).
My next plan is to work on the network driver. This should be not so difficult, at least I have higher hope to make this work compared to the USB part. The old network driver have some conditional compilation that indicates it can be compiled in kernel 2.6. I have tried to compile it, and there were many errors and warnings. I will try removing many codes that was not meant for the Agestar configuration (the kernel was from the WAP2000 router, so it contains router specific codes such as to acess hardware NAT).
The USB part is very important, without it then all of my work would be useless. The problem with the old source code was that it modifies directly some of the "core" USB stuff, instead of creating separate modules. The good news is it seems it doesn’t modify the source codes too much, but I still need to fully understand the code. I hope after this weekend, I can make the network and or the USB to work.
Here is my current boot message up until the user mode (many error messages because the network code was not compiled):
Linux version 22.214.171.124 (yohanes@koala) (gcc version 3.4.4) #235 Wed Jun 4 22:27:35 ICT 2008 CPU: FA526id(wb)  revision 1 (ARMv4), cr=0000397f Machine: STAR_STR9100 Memory policy: ECC disabled, Data cache writeback BUG: not creating mapping for 0x10000000 at 0x10000000 in user region CPU0: D VIVT write-back cache CPU0: I cache: 16384 bytes, associativity 2, 16 byte lines, 512 sets CPU0: D cache: 16384 bytes, associativity 2, 16 byte lines, 512 sets Built 1 zonelists in Zone order, mobility grouping on. Total pages: 8128 Kernel command line: console=ttyS0,38400 root=/dev/ram0 PID hash table entries: 128 (order: 7, 512 bytes) STR9100 CPU Clock: 200 MHz IRQ Timer1 at interrupt number 0x0 and clock 100000000(Hz) Dentry cache hash table entries: 4096 (order: 2, 16384 bytes) Inode-cache hash table entries: 2048 (order: 1, 8192 bytes) Memory: 32MB = 32MB total Memory: 25612KB available (988K code, 133K data, 76K init) Mount-cache hash table entries: 512 CPU: Testing write buffer coherency: ok Exporting ATAGs: not enough memory checking if image is initramfs...it isn't (no cpio magic); looks like an initrd Freeing initrd memory: 5586K NetWinder Floating Point Emulator V0.97 (double precision) io scheduler noop registered io scheduler anticipatory registered io scheduler deadline registered io scheduler cfq registered (default) nvram: can't create /proc/driver/nvram Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled serial8250.10: ttyS0 at MMIO 0xf7800000 (irq = 10) is a 16550A console [ttyS0] enabled brd: module loaded loop: module loaded RAMDISK: Compressed image found at block 0 VFS: Mounted root (ext2 filesystem) readonly. Freeing init memory: 76K Mon Jan 1 00:00:00 UTC 2007 Mounting root fs rw ... Load x1205 rtc driver ... insmod: /lib/modules/126.96.36.199: No such file or directory Using /lib/modules/2.4.27-star/x1205-rtc.o insmod: Not configured to support old kernels Synchronize system date & time ... hwclock: Could not access RTC: No such file or directory Mounting other filesystems ... mount: Mounting none on /proc failed: No such device ifconfig: socket: Function not implemented route: socket: Function not implemented ifconfig: socket: Function not implemented System initialization begin! open file error Load configuration file OK! (none) Time zone setting OK! Load nt_sev OK! socket: Function not implemented ifconfig: socket: Function not implemented Network setting OK! System time setting OK! sh: �t@L������: not found Http & Ftp OK! Load automount OK! Load button driver OK! Load bittorrent job control deamon OK! Load upnp av finished! Load check disk full finished! System initialization end! Load printerd ... printerd wakened Sysinit done telnetd: socket: Function not implemented BusyBox v1.00-rc2 (2007.08.16-07:29+0000) Built-in shell (ash) Enter 'help' for a list of built-in commands. # # ls bin lib lost+found sbin var dev libexec mnt tmp web etc linuxrc proc usr # ls /dev console mkdev ram0 sda7 sdc2 sdf sdh3 dsp mtd0 ram1 sda8 sdc3 sdf1 sdh4 fb0 mtd1 ram2 sdb sdc4 sdf2 tty hda mtd2 ram3 sdb1 sdd sdf3 tty0 hda1 mtd3 root sdb2 sdd1 sdf4 ttyS0 hda2 mtdblock0 rtc sdb3 sdd2 sdg ttyS1 hdb mtdblock1 sda sdb4 sdd3 sdg1 urandom hdb1 mtdblock2 sda1 sdb5 sdd4 sdg2 usb hdb2 mtdblock3 sda2 sdb6 sde sdg3 zero kmem null sda3 sdb7 sde1 sdg4 md0 ppp sda4 sdb8 sde2 sdh md1 ptmx sda5 sdc sde3 sdh1 mem pts sda6 sdc1 sde4 sdh2 # ls -l drwxr-xr-x 2 root root 1024 Dec 7 2007 bin drwxr-xr-x 4 root root 2048 Nov 6 07:03 dev drwxr-xr-x 7 root root 1024 Jan 1 00:00 etc drwxr-xr-x 4 root root 2048 Dec 7 2007 lib drwxr-xr-x 3 root root 1024 Dec 7 2007 libexec lrwxrwxrwx 1 root root 11 Dec 7 2007 linuxrc -> bin/busybox drwx------ 2 root root 12288 Dec 7 2007 lost+found drwxr-xr-x 2 root root 1024 Mar 13 2006 mnt drwxr-xr-x 2 root root 1024 Sep 1 2005 proc drwxr-xr-x 2 root root 1024 Dec 7 2007 sbin drwxrwxrwt 2 root root 1024 Jan 1 00:00 tmp drwxr-xr-x 6 root root 1024 Sep 1 2005 usr drwxr-xr-x 6 root root 1024 Sep 1 2005 var drwxr-xr-x 4 root root 1024 Dec 7 2007 web # echo hello| gzip|gunzip hello # uname -a Linux (none) 188.8.131.52 #235 Wed Jun 4 22:27:35 ICT 2008 armv4l unknown #