Friday, November 26, 2010

lenovo 3000 n100 custom bios

As one may know, Lenovo 3000 n100 has broken DSDT ACPI table, and as result it reports battery status incorrectly, i.e. BIOS says 'hey, battery status is 20%!', but actually it's 0%, and laptop will shutdown in few minutes. Lenovo engineers were stupid enought to hardcode some values instead of querying smart battery. You can easily check if your laptop is affected:

$ cat /proc/acpi/battery/BAT1/info
present: yes
design capacity: 5200 mAh
last full capacity: 5200 mAh

See? 'design capacity' and 'last full capacity' are hardcoded. Also BIOS reports incorrect values for 'present rate' and 'present voltage' in /proc/acpi/battery/BAT1/state. Here's how these values should look like:

$ cat /proc/acpi/battery/BAT1/state
present: yes
capacity state: ok
charging state: discharging
present rate: 1875 mA
remaining capacity: 4378 mAh
present voltage: 12285 mV

$ cat /proc/acpi/battery/BAT1/info
present: yes
design capacity: 5183 mAh
last full capacity: 4517 mAh

In July'09 I wrote a post how to fix it via custom DSDT, but it requires kernel patching and it's not easy/userfriendly, especially in non-source-based distros. And I pretty sure it's not possible in MS Windows (tm)

Last night I got BIOS for my laptop fixed (at last!). I've used Phoenix BIOS editor to perform modifications, main problem was PBE fails to disassemble DSDT table (ad.exe crashes), but workaround is easy - PBE unpacks bios into Program Files/Phoenix Bios Editor/TMP, just take ACPI0.aml from it, disassemble/modify/compile it via iasl, and put it back into this directory. Then just build BIOS and flash it via phlash16 from freedos liveusb :) That's it! No need in putting custom DSDT table into kernel (or initramdisk for old kernels - but it is not working anymore - patch was rejected by kernel developers).

You can take fixed bios here. It can be used with Lenovo 3000 N100 with AD codec (not suitable for laptops with realtek codec).

Disclaimer: I'm not responsible for any damage you can done to your laptop by following these instructions/flashing my custom BIOS

Monday, October 18, 2010

Migration to xubuntu

Recently I moved from kde to xfce on my laptop, but as xfce doesn't look pretty in gentoo (actually, it looks awful), I decided to move to xubuntu :) System is pretty fast now (much faster than it was in kde). Here's gtk analogs of kde apps I was used to:
  • claws-mail (instead of kmail)
  • exaile (instead of amarok)
  • tilda (instead of yakuake)
I've created ppa with some custom packages:
  • tilda with changed shortcuts for switching tabs, default ctrl+pgup/ctrl+pgdn are used in mc and vim, so I changed them to shift+arrow, however it would be better to add option in gui for changing these shortcuts
  • swt-gtk-3.5.2, it's required to fix rendering issues in tuxguitar
Btw, there's arm toolchain in ubuntu repository :) xubuntu rocks!

Monday, September 27, 2010

rx1950 will be supported by vanilla kernel 2.6.37

All HW support patches for RX1950 were merged into appropriate -next trees, so 2.6.37 will support RX1950 out-of-the-box :) The only out-of-tree part is WiFi, it's supported by acx100-mac80211 project, this driver is missing proper rfkill support for now, probably I'll find some time to implement it.

Also some H1940-related patches were merged such as: gpiolib support for latch access, improved LCD/BL/MMC power functions. Probably sound support for H1940 will be merged aswell. Missing parts of H1940 are: battery monitoring/charging support, keys support and probably LEDs (leds-h1940 is obsoleted from now).

Kernelspace part is finished, but userspace part is just started (there's no usable rootfs for these PDAs still) :(

Update: it seems H1940 sound support will be merged only into 2.6.38 due to missing dependencies in sound-2.6 tree.

Wednesday, September 1, 2010

rx1950 sound

Good news, everyone :) Sound support for rx1950 was merged into sound-2.6/for-2.6.37, so I hope we'll see sound support for rx1950 in 2.6.37 kernel.

Bad news is that some mach-rx1950.c changes are still waiting for review, Ben Dooks doesn't respond (I suppose he's on vacation), but I hope he'll find some time to review my patches before 2.6.37 merge window :)

Friday, August 20, 2010

August status.

Here's short status:

1. Audio is working, will try to get it into 2.6.36-2.6.37 mainline kernel
2. Battery driver is merged upstream, unfortunately Ben Dooks ingores my patches for some reason, and appropriate rx1950-specific part will not be merged into 2.6.36 :(
3. I got DMA working for s3cmci driver. The problem was in autoreload feature of s3c24xx DMA engine -- MCI doesn't like it for some reason. I rewrote driver to avoid usage of autoreload - and now it's working fine with s3cmci and s3c24xx-i2s drivers, tested on s3c2410 and s3c2442 SoCs

Monday, June 21, 2010

New Angstrom build for rx1950

This weekend I've uploaded new rootfs and package repo to tuxfamily. Now it includes fbreader for opie, mplayer for opie and mpd+ncmpc :)

Will work on audio driver this week to get some sound from rx1950.

Sunday, June 13, 2010

Dualboot on PDA? It's possible!

I've just got WinMo booting from u-boot. Actually, not directly, I've got WinMo bootloader booting from u-boot, but that's enought to get WinMo booting :)

It means that we can get dualbooting on h1940 and rx1950. Neat :)

Some technical details:

WinMo bootloader location in nand is 0x4000-0x44000 (for h1940 and rx1950), so backup this area to be able restore it/or boot it from u-boot.. Its load address is 0x30080000, it expects interrupts, mmu and dcache to be disabled, doesn't care about icache. Entry point is 0x30080000.

Friday, June 11, 2010

One more step closer :)

I've just flashed my h1940 with u-boot as second bl - and it works! :)
So no I have one h1940 (without screen) with u-boot as bootloader :)

Wednesday, June 9, 2010

u-boot on h1940

I've published my u-boot fork here, it contains support for rx1950 and h1940 (there was report that h1940 version works, but I didn't test it by myself). You can build and test them from haret - only usb device and nand work for now, but sd/mmc should work aswell, just need some testing :))

Later this week I'll try to flash u-boot to h1940, just need to solder jtag to its board :)

Monday, June 7, 2010

u-boot is working on rx1950!

I've just got u-boot working on rx1950 :) It was launched from haret, however I tested it with jtag - it works aswell if I replace 2nd stage bl in memory with u-boot.

I'll publish code as soon as I get time to cleanup it a bit :)

P.S. Got another h1940 with broken screen to hack on u-boot for h1940 :)

Thursday, June 3, 2010

Unbricking, step #2, jtag and friends

Finally got my rx1950 unbricked! :)
This week without my PDA was really painfull.

To unbrick rx1950 I used handmade wiggler jtag (unbuffered variant), because openmoko debug board didn't work for me (wrong levels on PDA or board?), and openocd (I'll put openocd config somewhere soon) to download my version of openmoko u-boot (Yes, I hacked u-boot to work on my rx1950 :)) to download images to RAM. And I used u-boot to download big flash image to RAM and flash it to NAND :)

On next photo you can see my PDA and JTAG cable (already unsoldered) On this photo you can see where to solder jtag cable on PDA board :)JTAG layout is same as on h1940 and h1910.

Saturday, May 29, 2010

Unbricking, still step #1 :)

Found and bought screw driver set (here it is on photo) at local market, it costs ~7.33$m and it contains T5 head, which I need to disassemble my PDA :)

Unbricking, step #1, collecting necessary tools

Got my hands on neo freerunner debug board (here's its photo), it has place for 20 pin jtag connector (I need to find one and solder it).

Thanks to max_posedon who borrowed this board to me :)

The only missing thing now is screw driver, as I have no screw driver for such small screws... I'm going to find and buy it tomorrow :)

Thursday, May 27, 2010

Another brick in the wall :)

Just bricked my rx1950 by flashing prepared kernel image instead of WinMo.

Now need to disassemble my rx1950, find out where's jtag pins, make jtag cable and restore it :)

Here's sources of tool to prepare kernel image, however don't use it, it doesn't work yet.

Wednesday, May 12, 2010

rx1950 merged upstream :)

Good news everyone :) Ben Dooks merged my patches for rx1950 support into his tree last night.

It seems that we'll see basic rx1950 support in mainline 2.6.35 kernel. Neat :) Also ~1.5 weeks ago I finished battery driver for rx1950, it's accurate enough and it can be used for h1930/h1940; however it needs some cleanup. And now I'm preparing report for LVEE, so my kernel activity is frozen for some time :)

Saturday, April 17, 2010

WiFi is working...

Good news everyone!

I've got WiFi on rx1950 working without any tricks like enabling wifi in WinMo and then boot in linux :)

I was able to connect to my WPA-protected AP, and then login to PDA via ssh over WiFi.

Some technical details:

WiFi is clocked from clkout1 pin, and clkout1 source should be FCLK (I also set clkout0 source to HCLK as WinMo does).

WiFi enabling sequence:
  • enable WiFi clock by configuring GPH10 pin function to CLKOUT1
  • enable LED by setting GPC8 and GCP9 to 1
  • enable chip select by configuring GPA15 pin function to nGCS4
  • reset pin by setting GPA14 to 0, waiting 200ms, and then setting it to 1
  • enable radio power by setting GPA11 pin to 1
WiFi disabling sequence:
  • disable radio power by setting GPA11 to 0
  • ensure that reset pin (GPA14) is set to 0
  • disable chip select by configuring GPA15 as output and setting it to 0
  • disable LED by setting GPC8 and GPC9 to 0
  • disable WiFi clock by configuring GPH10 as output and setting it to 0
acx100 base address is 0x20000000, irq is EINT16

I'll provide binary images when they'll be ready ;)

acx100-mem driver was taken here.

Saturday, April 10, 2010

Hacking on xkbd and echinus

I'm still working on rx1950 environment, and I've found a nice dwm-based WM - echinus. It supports docks (actually it supports subset of EWMH), so I hacked xkbd (on screen keyboard) to be a dock. Now I'm able to show/hide on-screen keyboard via shortcut (it will be tape recorder key on PDA). Now I need some panel with EWMH support, with ability to launch apps and display some info via text/pixmaps (dzen2?)

xkbd patch is available here.
Screenshot is available here.

Monday, March 29, 2010

Battery monitor

I'm working on kernel for rx1950 in parallel with userspace work. Since next step is improved battery driver, I've spent couple of hours to create following app. It's simple battery monitor with logging capability - I need some logs to get U,I(t) battery dependencies, as I don't believe windows driver, it seems that it displays battery level applying some heuristic - I don't see direct correlation between battery voltage/current and level displayed by windows driver.

P.S. I've sent rx1950 patches upstream on 20 of March and still no responce. I'm a bit disappointed - does it really take so long to review patch series?

Thursday, March 25, 2010

Distro and Env for rx1950

I've took a look on dwm window manager, and it impressed me a lot :) Highly configurable via config file, and so simple... It will be easy to add dwm layout for on-screen keyboard, and it will be easy to add some buttons such as on-screen keyboard show/hide button. Also I want to patch it to add support for drawing icons on its bar (yes, I heard about dzen2, but I don't want to use it).

If anyone knows on-screen keyboard that is as light as xkbd and has more functionality - please let me now, as I'm going to use xkbd, however I need to patch xkbd to make it set its window class name.

Also I've took a look on iplinux distribution - and it looks good and convenient, and it's still pretty simple. I'll use it as distro for rx1950 because I don't like openembedded complexity.

P.S. Need to test dwm-gtx...

Friday, March 19, 2010

Just fot note

Thursday, March 18, 2010

Researching for a new PDA environment

I'm still researching for a new PDA environment:
now I evaluate iplinux distribution/build system (based on debian) and EFL (enlightenment foundation libraries) . I hope 32mb is enough to run Xfbdev* with a light WM like DWM and some EFL environment. Some EFL-based apps were developed by openinkpot project, such as:
  • mpd-frontend (madaudio)
  • pdf-viewer
  • image-viewer (madeye)
And also there's efl-based browser (google for webkit-efl) developed by SHR project.

* or even xorg-server + xf86-video-fbdev, I heard that there's no difference between xorg-server and Xfbdev in recent releases, not sure if Xfbdev become too fat, or xorg-server become lighter)

Tuesday, March 16, 2010

It seems that directfb backend of gtk+ is broken in recent version. I hit 2 bugs (segfaults), first is fixed, but second is not. And according to bugzilla, directfb backend has no maintainer :(

Wednesday, March 10, 2010

DirectFB overlay

I've created repo with DirectFB-related things for Gentoo.
Emerge packages in following order:

  • linux-fusion
  • DirectFB
  • SaWMan
Thing is SaWMan is not working with SHM implementaion of Fusion :)

Call for developers :)

Does anyone want to work on new environment for PDAs based on directfb/gtk+? It seems that there's no supported environment for PDAs, especially for PDA with small resources (i.e. with 32mb of RAM :)) - opie and gpe are dead, we see only bugfix releases.

Short plan:

0. Develop directfb-based shell that will provide such functionality as app launcher/window manager/on-screen keyboard
1. Take Pimlico suit and port it to directfb (it's gtk based, so I hope it will be easy)
2. Port some mpd frontend
3. Port FBReader
4. Port some browser (midori?)

Mentioned applications cover all functionality that I need from PDA:
PIM, book reading, mp3 player, web browsing :)

All we need is people who wants to work on this idea: programmers, and, of course, designers - I'm programmer, but not designer, I can't create all these nice icons/screen designes, etc.

Any ideas? :)

P.S. Join jabber conference:


Yesterday I tested ramzswap on rx1950 :)

Shortly, it allows to use part of RAM as compressed swap. With ramzswap rx1950 is able to boot GPE environment (Xfbdev + gtk) without swap file on sd card, however GPE doesn't work smoothly.

Tuesday, March 9, 2010

Playing with Android

I've just played a bit with android emulator (to find out is it worth to build image for rx1950), and it looks like it's impossible to run android on device with 32mb RAM. But it runs smoothly on 64mb... So Google guys lie to you when they say that Android runs on 32mb :)

Anyway, I don't know any environment that runs on 32mb devices except opie. And that's sad, because opie is a bit outdated.

Friday, February 19, 2010

Here's rx1950 nand flash layout:

0x0000 - 0x1000 - First stage bootloader
0x1000 - 0x4000 - Some data, i.e. wifi mac is here
0x4000 - 0x44000 - Second stage bootloader. This block starts with 0x1000 byte header,
0x44000 - 0x-------- - WinCE image. This block starts with 0x400-byte partition table (???) followed by 0x1000 byte header (almost same as bootloader, but different addresses)

Bootloader header looks like this:
0xfe 0x03 0x00 0xea ; some magic bytes?
0x00 * 0x3c ; 0x3c zeros
0x45 0x43 0x45 0x43 ; "ECEC" - more magic bytes?
0x8c0b5dcc ; stored in little endian format, virtual address in ram where image ends
0x00035dcc ; stored in little endian format, image size
0x00 * 0xfb4 ; 0xfb4 zeros

So, bootloader will be loaded at 0x8c0b5dcc - 0x00035dcc = 0x8c080000 (virtual address)

WinCE header looks almost the same, except address is 0x8014e388 and size is 0x0014e388, so WinCE image will be loaded at 0x80000000 (virtual)

WinCE partition table is not looking interesting to me, we're not going to use WinCE-compatible FS :)

So, rx1950 will use following mtd partition table:
0x00000000-0x00004000 : "Boot0"
0x00004000-0x00044000 : "Boot1"
0x00044000-0x00344000 : "Kernel"
0x00344000-0x04000000 : "Filesystem"

If anyone interested in Boot0/Boot1/Kernel images - I can put it on tuxfamily ftp :)

P.S. I ported basic rx1950 patches to latest git kernel, and I'm going to submit it mainstream again :)

Wednesday, February 17, 2010

More bootloader stuff

I think I found a part of nand flash that wince bootloader loads to ram. This part is nk.exe, and it starts at 0x45400, whole wince partition starts at 0x44000. Bootloader loads some chunk (~1mb) at 0x80000000 (virtual address) and then jumps to 0x80000000. But that's only theory, need some practice now :)

Anyway, more interesting links:

Monday, February 8, 2010

Stuck with bootloader :\

Tried to get htc bootloader load my custom "diag" image, but it fails with "Download failed" message :(

My image consists of:
  • 1024-byte header, starting with "HTC$IBG--444", others are zeros
  • 28-byte code that fills framebuffer with some pattern (0x00ff)
It seems that I need to add some more info to header (checksums, size?) - If anyone knows _anything_ about diagnostic image for WM5-based devices with s3c24xx CPU and HTC bootloader - please let me know. Also I hope that bootloader outputs some info to UART, but unfortunately I have no usb-com adapter to check :(

And some more info: first stage bootloader seems to be nboot from smdk2440, but it does nothing except loading second stage bootloader :)

Wednesday, February 3, 2010

bootloader stuff

Still gathering info on HTC bootloader, acer n30 linux port and htc-flasher could be usefull.
It seems that there're two ways to go:
  • flash linux kernel into internal NAND flash (dangerous, I want to ensure that I can restore WM)
  • boot linux via SD card with diagnostic image
Second way seems to be complicated, as I'll need to write mmc and FAT drivers if bootloader puts diagnostic image in some unappropriated memory area. Anyway still need to figure out where bootloader puts diagnostic image, how this diagnostic image should look, etc...

Tuesday, February 2, 2010


Good news, everyone!

I've just owned iPAQ h1940, so I'm going to hack linux on it too :)

rx1950 bootloader

Just found some interesting info how to boot device with htc bootloader from sd without booting wince.
Tool is named eol (embedded OS loader) and is designed to be put on a miniSD card and loaded by the SPL (the initial loader in the flash ROM) by faking a diagnostic card signature. It's originally intended to use with HTC Tycoon. I'm going to modify it to use with rx1950 :) Can't wait getting hand on this tool ;)