ThinLinx Hot-e and CNS21XX

I am still fixing the Cavium Econa CNS11XX network driver with the guide from Pyun YongHyeon. He is guiding to make the network driver more robust. Unfortunately, we still don’t know why the driver is slower than the Linux version. The port is currently accessible through FreeBSD CVS at:

http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/arm/econa/

I asked in the freebsd-arm mailing list if anyone would like to donate me a CNS21XX device, and Stefan Bethke immediately offered me to buy one for me. I bought the device from dealextreme with the money donated to me. It took 9 days until it arrived.

Meanwhile John Nicolls from ThinkLinx sent me a Hot-e, a device based on AT91SAM9G20. I told him that I have received mr Stefan offer, but he said I can work on it anytime I want it. Since the Hot-e arrived earlier, I have managed to get it to boot. At first i was going to use the work from Sylvestre Gallon on at91sam9621(mailing list archive), but it turns out that it is not usable yet.

I have fixed the clock computation in at91_pmc.c, and currently writing a new timer driver (at91_pit.c), because the system timer device (at91_st.c) no longer exists in AT91SAM9G20. Currently the timer device is still not working properly, but I think I will be able to get it work this week.

When the CNS211XX LAN device finally arrived, I stopped the work for Hot-e for a while to test the new device. I bought a CA-42 cable to connect to it, but I can’t send anything to the device. I thought that the device was faulty, but turns out that the cable is faulty. I was disappointed because usually I used that type of cable (it is cheap only 132 baht or 4 usd). Fortunately I still have one MAX3232, and I can make my own cable.

I think porting CNS21XX will not be so difficult. I made some small adjustment for the serial port driver to make it show something. Memory mapping is different compared to CNS11XX, but that can easily be adjusted. The Interrupt controller is different, so I need to rewrite some parts. After it works, EHCI/OHCI was working fine. The network driver will need major adjustment (may be I will just write a new driver for this one), and the device doesn’t use CFI for Flash, it uses SPI, so I will need to write a driver for SPI bus.

For CNS11XX and CNS21XX You can see my progress in this wiki page:
http://wiki.freebsd.org/FreeBSDcns11xx

CNS11XX FreeBSD port completed

It has been a long time since I started this project, and even though I am making a good progress at the beginning, my progress was getting slower lately. Today I decided to take a day off from work to finish some remaining task: network driver, automatic memory detection, and flash device support.

Pyun YongHyeon have helped me a lot with the network driver. The speed is still not good, but he have helped to make the network driver to more correct (better, more reliable). I will still need to ask him to check for the final version, but I believe I have fixed most errors he pointed out.

My agestar, which also uses CNS11XX devices comes with 32Mb memory, while the Emprex NSD-100 have 64mb of memory. I have added a code to autodetect the memory size. So one binary file should work on both devices.

The flash device in Emprex NSD-100 complies with CFI, and it was very easy to use with the existing CFI driver. I just need to write several lines of code. The next step is to boot freebsd directly from the flash (with the root filesystem on USB). Unlike in Linux, the flash device can not be accessed as partitions (not yet).

First, we need to write the kernel.bin to cfi0, because the first 132 kb is used by boot loader, we need to skip to somewhere > 132kb. To make it easy, i just skip 1 megabyte from beginning of flash.

dd if=kernel.bin seek=1 bs=1m of=/dev/cfi0

be very very very careful with the dd command. Without correct seek and bs, you may overwrite the bootloader. The command will take quite a long time to finish (3 minutes).

Next step is to set the initial boot command. In the boot loader, setup bootcmd to copy the data in ram to 0x1000000 from 0x10100000, then boot the device:

setenv bootcmd cp.l 0x10100000 0x1000000 0x1a0000\;go 0x1000000
saveenv

Now when we boot the device, we should go directly to freebsd.

I won’t provide binaries, but the latest source code is in:

http://p4db.freebsd.org/depotTreeBrowser.cgi?FSPC=//depot/projects/str91xx/src/sys/arm/econa&HIDEDEL=NO

CNX11XX/STR91XX FreeBSD Progress

Last weekend I continued my work on FreeBSD port. I am concentrating on the network speed improvement, and I made a good progress with it. The network speed is now about 2.1 Mbps (FTP upload from device), this is still slower than the Linux version but i think it already reach a usable state (I think I should be able to stream some DivX files through HTTP from it). I will ask around in the freebsd-arm/freebsd-net mailing list so I can do more improvement on the driver.

I am still a bit worried playing around with the Flash, since I don’t have anything to restore it back in case I made a mistake. So I think I will leave this part for a while.

For everyone who have NSD-100 with Serial Port attached to it, you can try a precompiled binary thah I have prepared, or you can compile from source. To use the binary version, you will need a USB disk (at least 2GB in size), and a TFTP server. Actually you only need about 256 megabyte if you prepare your own disk instead of using my image.

Here are the steps for the binary version:

  1. Download the disk image from here
  2. Decompress (bunzip) the disk image, use dd to write to your USB disk
  3. Since there is no boot menu, entering single or multi user mode is done by booting different kernel. Download the multi user kernel or single user kernel and put it in your tftpserver
  4. Boot the kernel

To boot the kernel, you need to access your device using serial port. I think You need to hold the reset button to enter the boot prompt (mine always goes to the boot prompt because Bruce did something with the configuration area). You should see

STR9100>

prompt.

setenv serverip 192.168.1.1
(you can also 'saveenv' to save the TFTP server address permanently)
tftpboot 0x1000000 name-of-kernel.bin
go 0x1000000

To build your own disk image, make an empty disk.img with the size that you want. Goto /usr/src and then (modified from instruction to make i386 image by Warner Losh)

export TARGET_ARCH=arm
make buildworld
mdconfig -a -t vnode -f disk.img
fdisk -I md0
fdisk -B md0
bsdlabel -w md0s1 auto
bsdlabel -B md0s1
newfs /dev/md0s1a
mount /dev/md0s1a /mnt/
make installworld DESTDIR=/mnt
make distrib-dirs DESTDIR=/mnt
make distribution DESTDIR=/mnt
echo /dev/da0s1a / ufs rw 1 1 > /mnt/etc/fstab
echo ifconfig_DEFAULT=DHCP > /mnt/etc/rc.conf
echo hostname=demo >> /mnt/etc/rc.conf

To compare your boot experience here is is the bootlog for the multi user mode, and the single user mode.

For the latest kernel source, you can see the perforce depot at:

http://p4db.freebsd.org/depotTreeBrowser.cgi?FSPC=//depot/projects/str91xx&HIDEDEL=NO

SmartQ7

I just got my SmartQ 7 few days ago. In this post I want to share some technical thing (not a full review, you can find it somewhere else). Before giving my opinion about this device, I want to give quick update: I haven’t done much progress on the STR9104 FreeBSD port except to keep it up to date with FreeBSD Current. I am planning to start to work on it again this week. Andrew Certain have added joystick support for AppleWii. See the Google Code for latest version.

I bought this device from DealExtreme for 206.1 USD , this is the first expensive thing that I bought from DealExtreme (I only bought small things from then, usually my total is less than 20 USD). The thing shipped in about 10 days, but I need to get the thing from the post office, because I need to pay extra tax 350 baht (~11 USD).
Continue reading “SmartQ7”

Hostmonster 50000 files limit

I have been using Hostmonster for more than 2 years, and I was quite satisfied until now. When I registered in 2006, Hostmonster gives more than enough disk space, and bandwidth for me. Few months ago, I decided to extend my registration for another 3 years, I am doing this because the uptime of the server is excellent, and they are responsive to questions and requests (such as adding DNS record, or resolving some problem with CPanel).

Three days ago, I got an email from abuse department, it says that I have been storing to many files. I have about 300 thousands files, and their limit (that they just set on May) is 50 thousands file. You may think that 50 thousands file is a lot, but in reality it is not. Many software uses thousands of small files, for example there are more than 1800 files on gallery2 (typical install, english only), there are more than 1000 files for wordpress. Joomla with virtuemart will use more than 6000 files. I think this new limit has something to do with their new UNLIMITED HOSTING offer.

That is only the default install. Many web applications uses more files. For example, gallery2 will cache the resized sizes (thumnail, normal view, full view, etc) so if you upload 1000 pictures, it may end up becoming 3000 files or more. I got quite many blog entries (because I have been blogging in my Indonesian blog for 3 years), so I need to install wp-cache to speed things up. The cache is file based, so in just one of my blog, I use about around 4000 files.

The worst part is Hostmonster also counts their configuration files, empty directories, log files, and emails in the total. So if you have several email account, and you haven’t pop your email for a while, your file count will be high. If you use IMAP, then you can not have many messages, because every message is a file.

After cleaning up my files, removing my photos, uninstalling gallery, I finally lowered down my file count to around 44000. Now I only use about 1.7 GB of the disk space. So much for unlimited space hosting 🙁

Agestar/CNS11XX Freebsd progress

I’m still working on the Freebsd port, and haven’t tried to fix the network driver problem in Linux (it only happens on samba 3 which I don’t use daily). The reason to focus my work on the FreeBSD port is because I want to understand more about the network driver. The current Linux network driver was not written from scratch but from modifying existing source. The source was full of things that I don’t understand, which proves to be unnecessary after I gain understanding when writing the Freebsd network driver.

Here is the current FreeBSD port status:

  1. Timer is now working, previously the timer tick works, but the time counter was too fast.
  2. EHCI and OHCI is working, but there is still some caching problem, so i need to modify usb_busdma.c, this modification is not clean. I can access USB disks, and USB network adapter.
  3. Network driver works, but it is still very slow . I am still trying to understand better the DMA handling in FreeBSD. There is still one bug: you can not stop the interface and start it again. The stopping part works, ifconfig ece0 down, but the starting again part doesn’t.
  4. Multi user works. I can also activate network services, such as sshd.

I am still waiting for my perforce account. But anyone willing to test it can contact me. I still don’t know the best method to release a patch against CURRENT for people to try, because changes happens very quickly.

Here is the latest boot log: bsd-24-may-2009.txt

STR9104/CNS1104 FreeBSD Port Progress

Returning from Indonesia, I continued my Freebsd porting attempt to the Emprex NSD-100. So far it’s going quite well. I took the FA526 CPU support from NetBSD, I use the 8250 driver for the UART, and default EHCI driver. I got stuck for a while on the EHCI part until Hans Petter Selasky pointed me that there might a problem in the busdma/cache handling. With the EHCI part fixed, I can get to the userland, booting from USB stick.

The remaining drivers that needs to be written are the OHCI and network. The OHCI shouldn’t take too much time, but I think the network will take quite a long time.

I was planning to clean up, and release the code today, but I was busy with something else, so may be I will release the code in the next few days. For those of you who are curious about the boot log, here it is:
Continue reading “STR9104/CNS1104 FreeBSD Port Progress”

Too many things to do

There are so many things to do lately, but so little time. Plus i have so many dental problems lately, three of my molar teeth has been pulled out in the last 2 months, and going to have the fourth taken next month. Going to dentist and waiting for the recovery always takes away my free time.

My wife just bought Nokia 5800, a Nokia series 60 5th edition phone. It means that i need to finish my SymbianBible port for 5th edition (mostly done, beta version is on symbianbible google groups). My wife also asked me to port MultiCounter to her new phone (done, not yet uploaded).

I have cleaned up the 2.6.29 port of STR9104 Soc, but i will need to clean up again, because of the new documentation from www.cnusers.org. I have also started the freebsd port, but the progress is not much yet.
Continue reading “Too many things to do”

STAR9104: Linux Kernel 2.6.29 and Starting FreeBSD port

I’ve finally updated my patch to 2.6.29, the patch can be downloaded from:
http://tinyhack.com/agestar/patch-2.6.29-star.gz

and the config file:

http://tinyhack.com/agestar/config-2.6.29-star

or if you want the image that i already compiled and test (image is compiled with 32 MB memory). This is NOT a FIRMWARE

http://tinyhack.com/agestar/zImage-2.6.29

when i have the time, i will work on creating a new firmware image.

Some changes:

  • The machine ID is now registered in http://www.arm.linux.org.uk/developer/machines/
  • The network problem instability has now been fixed
  • Added new configuration option to select memory size based on your board memory (16, 32, or 64 mb). Note: selecting values larger than the supported size will cause crash.

The other news is that Bruce M Simpson has donated me an Emprex NSD 100 for porting FreeBSD to it. I have started my work, but the progress will be slower from the Linux at the beginning, because:

  1. I am more familiar with Linux kernel compared to FreeBSD kernel
  2. Currently FreeBSD kernel itself doesn’t support many ARM devices yet, so to find an exmple of something I need to look at NetBSD, (and it helps, for example the Faraday 526 processor support is already in NetBSD).
  3. I am rather busy this and coming month (planning to go to Indonesia for about 10 days)

Optimizing Asus EEE 900A

I just got back from my vacation around Thailand, so I will start to update things (Wii homebrew, Symbian apps, blogs, etc) again. Well, may be starting next week, I have a dental surgery this weekend and may need to rest. Anyway, this time I want to post about optimizing EEE 900A.

My wife was happy with her Asus EEE 701, but she would like something better with the same size. We sold the old Asus 701 to my brother, and she bought Asus EEE 900A. Compared to EE PC 701, the EEE PC 900A has a faster processor (Intel Atom 1.6 ghz vs the 900 Mhz EEE), more memory (1 gb vs 512 mb), bigger disk space (16 gb vs 4 gb), higher resolution (1024 x 600 vs 840×400), and better graphic processors (Intel GMA 950 vs Intel GMA 900). The only problem is the 16 GB SSD is much slower than the EEE 701 4 GB SSD. You can really feel it when running almost any applications, especially the firefox browser.

My wife uses Windows XP on the new Asus. After reading several blog posts and many forums, the conclusion is: to make everything faster, try to reduce the number of disk access. Here is how to reduce the disk access in Windows XP:

Continue reading “Optimizing Asus EEE 900A”