Modding Android for mini2440 & 12″ Screen

I have been playing for sometime with the FriendlyARM mini2440 development board and trying out Android on it with various touchscreens at various resolutions. However, my application demanded a 12.1″ screen and all I was doing was just fooling around with the 3.5″ screen. This post will clear up some doubts (or probably add more confusion in this regard), but it surely would get you an ‘awe’ feel. This is also not meant to be a tutorial, but intermediate level embedded guys would love to burn their boards upon reading this for sure 🙂

Note : Android performance on mini2440 is actually very poor. the touchscreen is still not calibrated, but I’m working on it. Also, the kernel and the rootFS have been modded to some extent (not by me of course)

Things you should have :

  • FriendlyARM mini2440 of course
  • 12.1″ screen, make : Sharp
  • All the necessary cabling : USB, Serial etc.
  • A Fedora/Ubuntu box
  • A net connection
  • 375ml of breezer (or a cup of coffee for the nocturnals), earplugs and patience 🙂

Things you should get :

Kernel Mod

The kernel source you downloaded has a display configured for the 3.5″ default screen. We shall be adding a new module to the Kernel and making changes to some source files to get our 12.1″ screen working perfectly.

[1] Making a new Module : In the kernel source open the file drivers/video/Kconfig and staring from line 1920, replace

#config FB_S3C2410_TFT800480
#boolean "7 inch 800x480 TFT LCD"
#depends on FB_S3C2410
#help
#7 inch 800x480 TFT LCD

with

config FB_S3C2410_TFT800600
boolean "12 inch 800x600 TFT LCD"
depends on FB_S3C2410
help
12 inch 800x600 TFT LCD

[2] Now, the driver for touchscreen is located at drivers/input/touchscreen/s3c2410_ts.c Here, the original resolution is 320×240 and we have to modify it to 800×600. Add the following after line 19

#ifdef CONFIG_FB_S3C2410_TFT800600
#define SCREEN_X 800
#define SCREEN_Y 600
#else
#define SCREEN_X 240
#define SCREEN_Y 320
#endif

Modify as follows after line 99,

//disX = disX * 1024 / 240;
//disY = disY * 1024 / 320;
disX = SCREEN_X - disX;
disX = disX * 1024 / SCREEN_X;
disY = disY * 1024 / SCREEN_Y;

[3] Some more modding is required for front and back porch settings of LCD. It varies for different LCD vendors. Refer the LCD datasheet for your reference. Considering my Sharp LCD, you can try it out on your’s too, modify the file arch/arm/mach-s3c2440/mach-mini2440.c in your kernel source as follows

#elif defined(CONFIG_FB_S3C2410_TFT800600)
#define LCD_WIDTH 800
#define LCD_HEIGHT 600
#define LCD_PIXCLOCK 40000

#define LCD_RIGHT_MARGIN 120
#define LCD_LEFT_MARGIN 40
#define LCD_HSYNC_LEN 60

#define LCD_UPPER_MARGIN 25
#define LCD_LOWER_MARGIN 20
#define LCD_VSYNC_LEN 1

Play with the right,left,upper and lower margins till you get the perfect display once compilation is over.

Kernel Compilation

make menuconfig

Save the .config file when asked to do so. Now,

cp config_mini2440 .config
make menuconfig

Now select Device Drives -> Graphic support -> Support for frame buffer devices -> S3C2410 LCD framebuffer support -> [x] 12 inch 800×600 TFT LCD

Assuming that the Cross Compiler is set and the PATH variable knows about it, bake the kernel by doing

make

The kernel can then be found at arch/arm/boot/zImage Viola! the kernel is ready!

Android Filesystem Modifications

[1]Creating the console file. Untar the Android FS and do,

cd fs/dev
sudo mknod console c 5 1

[2]Pointer Callibration file (WARNING : GREY AREA)

cd fs/system/etc/shine
echo "134 57734 -3147464 -40090 1465 35070384 65536" > pointercal

Now I have been unsuccessful in this stuff till now. Actually, the pointercal stores the calibration values for touchscreen which is automatically generated once the ts_calibrate utility runs. unfortunately, I haven’t got a clear idea on how tslib works yet.

Creating Android Filesystem Image

Untar the mkyaffs2image-128M binary to /usr/sbin or any other place of your choice. Considering the directory ‘fs’ stores your modified FS,

mkyaffs2image-128M fs 12inch_android.img

So now, you have the kernel zImage and the 12inch_android.img file system ready for you. Start the board in NOR mode and write the kernel and Android FS to the board after formatting the NAND Flash. Connect the USB and use the s3c2410_boot_USB tool (after compiling the tool itself for your host, of course) Then,

./s3c2410_boot_usb zImage

After the transfer is complete, (it gives some error, ignore it),

./s3c2410_boot_usb 12inch_android.img

Boot the board in NAND mode after the transfer is complete. Thats all. I’m sharing some pics of my trials. Feel free to suggest and/or educate me or for any other queries.

Android on mini2440+12"
Android on mini2440+12"
Android on mini2440+12"
Android on mini2440+12"

OpenARMLabs Session : Android on ARM and Kernel Compilation

Android on ARM and Linux Kernel Compilation – Open ARM Lab Session

The Open ARM Lab session for this week will be held on Sunday, 5th December 2010.

Agenda:

1) Android on ARM
2) Linux Kernel Compilation
3) What happens when an ARM based board is powered ON?

Speakers:

1) Suchakra
2) Tuxdna

Date: Sunday, 5th December 2010

Time: 11 PM to 2 PM

Venue:

DSK Digital Technologies Pvt. Ltd. “Ramashree”, 3rd Floor, 1206/30 Off J.M. Road, Shivaji Nagar,
Pune 411005 Maharashtra, India Tel No.:: 020- 25511481/ 482.

More-Info

Session : Hands on with Toolchain for Friendly Arm Board


Date: 20 Nov 2010 – Saturday
Time: 11 AM to 5 PM

Agenda: Hands on with Toolchain for Friendly Arm

Venue: Embedded Design Center, Instrumentation Department, COEP, Pune.
Venue Map: http://bit.ly/9UMAiF

Day long session on this Saturday 11AM to 5 PM

  1. Host and Target OS blueprint.
  2. Install and configure toolchain for Friendly Arm on Host.
  3. Build Linux OS for target device.
  4. Develop a few apps for Friendly arm board.
  5. Document & publish the build process.

Visit http://openarmlab.org