I have prepared a firmware and tutorial to Install Debian here, this time without the need for serial port. I have tested this, and it seems that everything works. But of course I will not be responsible if anything happens. If you think there are some missing, unclear or inaccurate steps, or if you doubt about something, then don’t install it. If you have anything to ask just email to yohanes [at] gmail.com, or just post your questions as comments.
My wife agrees that I can buy another Agestar to hack and use the other one for our network storage. With this new Agestar I can continue my hacks. Currently I am working on building a firmware that can be used to install Debian without serial port. On the first stage, I will build a generic firmware without automatic installer, so the user still needs to do some manual steps to install Debian. So it is something like the manual Debian install on NSLU2 (http://www.cyrius.com/debian/nslu2/unpack.html). Actually because this is generic command line, you would be able to install Gentoo or something else. The next step would be to make an automatic installer like in NSLU2(http://www.cyrius.com/debian/nslu2/install.html).
The main reason why I started with manual installer is because I am not yet familiar with the Debian installer. Currently the manual installer is almost complete, I just need to test it thoroughly to make sure that this will really works without serial port. I hope I can release this in the next few days (or this weekend at the latest).
I have spent many hours to work on the RTC part, and I decided to give up for now. I have been able to activate the clock, set the clock, and make it run. But the RTC is not useful. First, it is not battery backed, so when you turn off your device, it will not keep the time. Second, it can store only the seconds, minutes, hours, and day of month. The problem of not having a documentation is sometimes you get stuck, and don’t know what to try next.
There is one feature that is supposed to be useful if I can make it work: the alarm capability. With alarm some cron-like applications can set to be notified when a particular time comes (it will ease the CPU burden). As far as I know the cron daemon doesn’t use this feature, so it is not a great loss.
There is one thing that still puzzles me. The original firmware uses X1205 through I2C bus. From my understanding the X1205 have different abilities compared to the STR9100 RTC. So I don’t know whether there is actually another RTC on the board.
Since the RTC is not very useful. I will let go hacking this part, until I find other clues.
Here is the output of the original firmware.
X1205: I2C based RTC driver.
i2c-core.o: driver X1205 registered.
X1205: found X1205 on STR9100 I2C Adapter
ccr_write_enable: verify SR failed
i2c-core.o: client [X1205] registered to adapter [STR9100 I2C Adapter](pos. 0).
X1205: i2c_add_driver RTC driver.
X1205: misc_register RTC driver.
I was very tired lately because I have to do many other things beside hacking the agestar kernel. So when I have time this morning, I decided to work on the easiest part on my list: LED driver. Agestar NCB3AST only have one controllable led, inside the casing, so I don’t know how useful this is (I think you can peek a little bit when the casing is closed). The LED and LCD display front is actually controlled by different unit, not controllable by CPU. Because this part is not important, I decided to upload the patch later.
Right now I am starting to look at the RTC driver. Hopefully this one will be more useful.
I ported STAR 9100 network driver without a documentation, I just blindly use the old driver and modify it to fit with all of the changes in the networking stuff since kernel 2.4.27. The driver claims to support scatter/gather I/O, but there is no implementation of scatter gather I/O in the hard_start_xmit function. I don’t know whether this device supports it or not, so I just change this line:
dev->features |= NETIF_F_SG|NETIF_F_IP_CSUM
to this:
dev->features |= NETIF_F_IP_CSUM
http://tinyhack.com/agestar/patch-2.6.25.4-for-agestar-20080622.bz2
And now the sendfile function works (although it would be faster if the driver supports scatter/gather IO).
I have concluded the source of failure for many applications is that the sendfile syscall on my port doesn’t work. To be precise, sendfile sends garbage data to the other side. I have an USB to Ethernet adapter, and using that adapter, the problem disappears. So the conclusion is that my network driver is buggy.
Applications that might be affected are: network servers that sends file (http servers, file servers, etc), distcc.
I will try to fix this tomorrow.
First the bad news: the network driver in the new kernel is not performing very well, if i remember correctly, this is about twice slower than the original kernel. The maximum speed is around 2.75 mb/s for FTP , 1.4-1.50 mb/s for SAMBA, and 618 kb/s for SSHFS. I have tried implementing NAPI (I will upload the patch soon), but it doesn’t help very much. I have tried to optimize the kernel settings, but no luck so far.
Now, the good news: I have been able to install Debian Etch for ARM in my Agestar using the instruction in here: http://wiki.dns323.info/howto:install_debian. Of course there are differences in booting, and configuring stuff, but the steps to produce the root file system are the same. I have also managed to write new kernel to the flash (by using dd if=bootpImage of=/dev/mtdblock1), so now my agestar will go directly to Debian when i turned it on.
I will clean up the code, and write the instruction on how to install Debian this weekend.
It seems I can get the useland working fine with the latest uClibc snapshot. So far I have been able to boot the kernel using TFTP, and uses root image from NFS and USB, tonight i think I will try to flash the kernel using the mtd driver (for those of you who wants to try before me, flash /dev/mtd1 and use bootpImage for that mtd partition).
Here is the latest patch against 2.6.25.4 (with mtd driver):
patch-2.6.25.4-for-agestar-20080618.bz2
Config file for booting with USB root file system. I am using external USB stick (/dev/sdb1) change it to /dev/sdaX to use the hard disk inside Agestar.
Config file for booting NFS root file system. Don’t forget to change the client IP address (mine is 192.168.1.244), server IP address (mine is 192.168.1.150) and the mount path (mine is /opt/boot).
I finally managed to complete the OHCI part of the driver. Right now some of the most important parts of the kernel is ready: Networking and USB. It means that with the new kernel I will be able to make my Agestar to function as NAS. But of course this is not ready to use yet for most of the people.
Next parts that needs to be done are:
- MTD access –> so we can update the flash with the new kernel easily
- RTC (Real Time Clock) –> Not so important if the device is always connected to the internet (we can synchronize the time with NTP every few hours)
- Button –> Not so important (so we can assign the USB_EXIT button to do something when it is pressed)
I am not sure if I can do more work this weekend, so I am publishing the current patch that I have with the config file.
the patch for kernel 2.6.25.4:
http://tinyhack.com/patch-2.6.25.4-for-agestar.bz2
The config file:
http://tinyhack.com/config-2.6.25.4
STR9100 has two Host Controller Interface, EHCI and OHCI. Enhanced Host Controller Interface (EHCI) is used for high speed USB, while Open Host Controller Interface (OHCI) is used for full and low speed devices. I think I have completed the EHCI part (it can detect my USB disk and the internal hard disk), but I haven’t tested this extensively. The OHCI part may not seem important if we only use high speed devices, but it is. When I tried plugging in low speed device, the port becomes unusable (even when I unplug the device and insert a new USB 2.0 device).
I will try to complete the OHCI part, and I hope I can post the source code this weekend after cleaning up the debugging part. I also plan to support the MTD device access so we can update the firmware easily. Updating from the old kernel to the new one will be easy with the web interface, but it is important that we can update the new one also (currently I am still booting from tftp server).