V210 Linux Building CF Card

From ASULUG AirPanel Wiki

Jump to: navigation, search

Preparing V210 Linux CF Card

V210_linux_ubuntu

Many ways of doing this.

Contents

Building CF card using the v210

Requirements

Booting miniv210 linux

  • Extract from miniv210linux-a0.zip the miniv210linux-a0.exe and copy over to your v210 WinCE \Permanent Storage area - what ever method you have available. (Active Sync - usb etc...)
  • Hook up usb keyboard and startup the miniv210linux-a0.exe and click OK.
  • Should have a login prompt - Log in as root and the password is toor.
  • Insert PCMCIA CF Card.
  • Load modules - Mini V210 linux - does not auto load modules Follow the below steps.

modprobe rtc-sa1100

 (The kernel doesn't yet know how to pick up the rtc time from unit - so set manually.
   Format is MMDDhhmmCCYY - For Nov, 18th 2009 at 4:07PM 111816072009)
  (note that my compile uclibc build root seems to display weird with date - kernel headers??)

date 111816072009
hwclock -w
hwclock

 (backlight stuff or will look weird when blanks)
modprobe pwm_bl

 (pcmcia/cf card support routines)
modprobe pxa2xx_vs_v210
modprobe pata_pcmcia

 (look at end of dmesg - should report cf card device)

dmesg
......
sd 0:0:0:0: [sda] 7847280 512-byte hardware sectors: (4.01 GB/3.74 GiB)         
sd 0:0:0:0: [sda] Write Protect is off                                          
sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00                                       
sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DA
 sda: sda1                                                                      
sd 0:0:0:0: [sda] Attached SCSI removable disk  

Partitioning CF Card

Use fdisk to remove any existing partitions and create our three partitions.

Pay attention to what is being asked for.

Common fdisk commands.

  • p Print existing tables
  • d Remove partition
  • n Create partition
  • t Change partition type

Will want to end up with the following partitions.

  • sda1 600M of type b (W95 FAT32)
  • sda2 150M of type 82 (Linux Swap)
  • sda3 The rest of type 83 (Linux)

fdisk /dev/sda

 (remove any existing partitions and then create our desired partitions like below)

Command (m for help): p                                                         
                                                                                
Disk /dev/sda: 4017 MB, 4017807360 bytes                                        
128 heads, 63 sectors/track, 973 cylinders                                      
Units = cylinders of 8064 * 512 = 4128768 bytes                                 
                                                                                
   Device Boot      Start         End      Blocks  Id System                    
/dev/sda1   *           1         973     3923104+  b Win95 FAT32               
                                                                                
Command (m for help): d                                                         
Selected partition 1                                                            
                                                                                
Command (m for help): n                                                         
Command action                                                                  
   e   extended                                                                 
   p   primary partition (1-4)                                                  
p                                                                               
Partition number (1-4): 1                                                       
First cylinder (1-488, default 1): Using default value 1                        
Last cylinder or +size or +sizeM or +sizeK (1-488, default 488): +600M          
                                                                                
Command (m for help): t                                                         
Selected partition 1                                                            
Hex code (type L to list codes): b                                              
Changed system type of partition 1 to b (Win95 FAT32)                           
                                                                                
Command (m for help): n                                                         
Command action                                                                  
   e   extended                                                                 
   p   primary partition (1-4)                                                  
p                                                                               
Partition number (1-4): 2                                                       
First cylinder (75-488, default 75): Using default value 75                     
Last cylinder or +size or +sizeM or +sizeK (75-488, default 488): +150M         
                                                                                
Command (m for help): t                                                         
Partition number (1-4): 2                                                       
Hex code (type L to list codes): 82                                             
Changed system type of partition 2 to 82 (Linux swap)                           
                                                                                
Command (m for help): n                                                         
Command action                                                                  
   e   extended                                                                 
   p   primary partition (1-4)                                                  
p                                                                               
Partition number (1-4): 3                                                       
First cylinder (94-488, default 94): Using default value 94                     
Last cylinder or +size or +sizeM or +sizeK (94-488, default 488): Using default 
value 488                                                                       
                                                                                
Command (m for help): p                                                         
                                                                                
Disk /dev/sda: 4017 MB, 4017807360 bytes                                        
255 heads, 63 sectors/track, 488 cylinders                                      
Units = cylinders of 16065 * 512 = 8225280 bytes                                
                                                                                
   Device Boot      Start         End      Blocks  Id System                    
/dev/sda1               1          74      594373+  b Win95 FAT32               
/dev/sda2              75          93      152617+ 82 Linux swap                
/dev/sda3              94         488     3172837+ 83 Linux                     
                                                                                
Command (m for help): w                                                         
The partition table has been altered!                                           
                                                                                
Calling ioctl() to re-read partition table                                      
 sda: sda1 sda2 sda3                          

Create File Systems

Create the file system and swap.

Unless I'm certain that there are no bad blocks on the media - I usually use -c for check blocks when I can. Will take longer.


 (Make dos file system on partition 1)
mkdosfs -n v210part1 -F 32 -c /dev/sda1

 (Make swap on partition 2 - busybox version does not have a -c option with mkswap)
mkswap /dev/sda2

 (Make ext2 file system on partition 3 - the -c will take a while)
mke2fs -L v210root -c /dev/sda3

 (Don't worry about the % complete.  Divide it by 100 would be correct - finish at 1000%)

 (Disable the automatic checks - Please do this as the v210 time is always messed 
  up on boot - until the network is up.  You don't want it checking the file system
  every time you boot.)

tune2fs -c 0 -i 0 /dev/sda3

! Don't mount anything yet !

Transfer files to CF card partition 1

There is room on the partition 1 v210part1 vfat for the download files. Can turn the V210 into a Mass storage device to hook up to either Windows or Linux usb port.

Here is how by using the g_file_storage gadget driver, and is about twice as fast as trying to do the same thing with MS Active Sync on the V210.

*** Make sure no file system is mounted from the flash card.  
*** The gadget file storage driver can not share the device.

mount    (make sure no sda mounts come up).

modprobe g_file_storage file=/dev/sda stall=0

** Connect the usb cable (small end in the V210) to either Win XP, Linux.
** Windows will show one Drive, linux will likely mount both (v210part1 and v210root)

Copy the two tgz files along with their md5 part to the v210 mass storage drive v210part1.

v210_test_boot_20091118_a0.md5
v210_test_boot_20091118_a0.tgz
v210_test_rootfs_ubuntu9.04_20091118_a0.md5
v210_test_rootfs_ubuntu9.04_20091118_a0.tgz

Should take about 30 minutes.

Once finished with the copy - do the normal Safely remove device (Windows) or umount both  v210part1 and v210root (linux)!!!
After that is finished - disconnect setup/transfer cable and unload the g_file_storage module)

rmmod g_file_storage    (closes block device).


Extracting the files

*** You did unload the g_file_storage - If not do so!! ***

mount /dev/sda1 /mnt/sda1
mount /dev/sda3 /mnt/sda3

 (Verify the file checksums - assuming the file names have not been changed as reported by the md5 files)
cd /mnt/sda1
cat *.md5 | md5sum -c

 (should show the below - If so, Continue.)
v210_test_boot_20091118_a0.tgz: OK                                              
v210_test_rootfs_ubuntu9.04_20091118_a0.tgz: OK     

 
cd  (make sure in default directory)

   (Verify that your mounts look correct to adjust the tar extract commands)
df  
   (mine looks like this)
# df                                                                            
Filesystem                Size      Used Available Use% Mounted on              
tmpfs                    62.0M     40.0K     62.0M   0% /tmp                    
/dev/sda1               579.3M    458.6M    120.7M  79% /mnt/sda1               
/dev/sda3                 3.0G     68.6M      2.8G   2% /mnt/sda3       

 (Extract the boot files back on to /mnt/sda1)

gunzip -c /mnt/sda1/v210_test_booot_20091118_a0.tgz | tar xvC /mnt/sda1

 (Extract the root files to /mnt/sda3 or what ever you mount point is for partition 3)

gunzip -c /mnt/sda1/v210_test_rootfs_ubuntu9.04_20091118_a0.tgz | tar xvC /mnt/sda3

 (This should take a little over 20 minutes)

 (At a later time after everything is working can clean off the two large tgz files)

 (Unmount the partitions)

sync
cd
umount /mnt/sda1
umount /mnt/sda3

reboot

*** note you might have to pull the CF card out when ViewSonic splash 
*** is shown - or could hang going into WINCE.

Building CF card using a Linux Desktop

Requirements

Partitioning CF Card

Use dmesg to determine what device was used for your inserted 4G flash card.

sd 4:0:0:0: [sdc] 7847280 512-byte hardware sectors (4018 MB)
sd 4:0:0:0: [sdc] Write Protect is off
sd 4:0:0:0: [sdc] Mode Sense: 03 00 00 00
sd 4:0:0:0: [sdc] Assuming drive cache: write through
 sdc: sdc1

(so sdc is the device in my example - and has one partition currently)

Also if auto-mounting - unmount the partition - use mount to check.

mount
....
/dev/sdc1 on /media/KINGSTON type vfat (rw,nosuid,nodev,uhelper=hal,shortname=lower,uid=501)

 (unmount the path - like the above /media/KINGSTON)
sudo /sbin/umount /media/KINGSTON    (or what ever your favorite method is)

Use fdisk or you favorite partition editor to remove any existing partitions and create the three partitions.

Pay attention to what is being asked for.

Common fdisk commands.

  • p Print existing tables
  • d Remove partition
  • n Create partition
  • t Change partition type

Will want to end up with the following partitions.

  • sdX1 +600M of type b (W95 FAT32)
  • sdX2 +150M of type 82 (Linux Swap)
  • sdX3 The rest of type 83 (Linux)

Fdisk p looks similar to this when finished

Command (m for help): p

Disk /dev/sdc: 4017 MB, 4017807360 bytes
128 heads, 63 sectors/track, 973 cylinders
Units = cylinders of 8064 * 512 = 4128768 bytes
Disk identifier: 0x001c2022

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         146      588640+   b  W95 FAT32
/dev/sdc2             147         183      149184   82  Linux swap / Solaris
/dev/sdc3             184         973     3185280   83  Linux


Be sure you are using sudo /sbin/fdisk or sudo gpartedit on the right device (you don't want to wipe out your hard disk!!!) Use dmesg to locate where the card was inserted - in my case was /dev/sdc

When you save the partition changes, auto mount will likely remount the /media/KINGSTON or what ever. Check with mount and umount again.

mount
....
/dev/sdc1 on /media/KINGSTON type vfat (rw,nosuid,nodev,uhelper=hal,shortname=lower,uid=501)

 (unmount the path - like the above /media/KINGSTON)
sudo /sbin/umount /media/KINGSTON    (or what ever your favorite method is)

Create File Systems

Create the file system and swap.

Unless I'm certain that there are no bad blocks on the media - I usually use -c for check blocks when I can. Will take longer.

(Substitute X in sdXn for the correct one as determined with dmesg and above)

 (Make dos file system on partition 1)
sudo /sbin/mkdosfs -n v210part1 -F 32 -c /dev/sdX1

 (Make swap on partition 2)
sudo /sbin/mkswap -c /dev/sdX2

 (Make ext2 file system on partition 3 - the -c will take a while)
sudo /sbin/mke2fs -L v210root -c /dev/sdX3

 (Disable the automatic checks - Please do this as the v210 time is always messed 
  up on boot - until the network is up.  You don't want it checking the file system
  every time you boot.)

sudo /sbin/tune2fs -c 0 -i 0 /dev/sdX3

! Don't mount anything yet !
 Disconnect the card and reconnect the card.

If auto mount - mount should show two mounted partitions.
<pre>
mount
...
/dev/sdc1 on /media/v210part1 type vfat (rw,nosuid,nodev,uhelper=hal,shortname=lower,uid=501)
/dev/sdc3 on /media/v210root type ext2 (rw,nosuid,nodev,uhelper=hal)

 (if not you may need to create mount points and mount manually)

Extracting the files


 (Verify the file checksums if you have md5sum installed- assuming the file names have not been changed as reported by the md5 files)
( assuming you are in folder containing the downloaded files)

cat *.md5 | md5sum -c

 (should show the below - If so, Continue.)
v210_test_boot_20091118_a0.tgz: OK                                              
v210_test_rootfs_ubuntu9.04_20091118_a0.tgz: OK     

 
   (Verify that you mounts look correct to adjust the tar extract commands)
  
   (mine looks like this (actually after a load - not before)
df                                                                            
Filesystem                Size      Used Available Use% Mounted on              
....
/dev/sdc1               587476     17344    570132   3% /media/v210part1
/dev/sdc3              3135232   1198964   1777004  41% /media/v210root
              
Please adjust the below to match your mount points!!

 (Extract the boot files back to /media/v210part1)

sudo tar xvzCf /media/v210part1 v210_test_boot_20091118_a0.tgz 

 (ignore the cannot change ownership warnings - its a vfat partition - we don't care)


 (Extract the root files to /mnt/sda3 or what ever you mount point is for partition 3)

sudo tar xvzCf /media/v210root v210_test_rootfs_ubuntu9.04_20091118_a0.tgz

 (At a later time after everything is working can clean off the two large tgz files)

 (Unmount the partitions)

sync

sudo umount /media/v210part1
sudo umount /media/v210root

Creating Permanent Linux Desktop Shortcut for WinCE

This is not needed - just handy.

Also note that the copyMenu.cmd file in boot\wince\Menu should be edited to look like the below: The original is missing quotes on the del command line.

cd \Permanent Storage\menu
copy *.lnk \Windows\Desktop
del "\Permanent Storage\Startup\vshell.log"
Insert linux prepared CF card into already booted WinCE v210.

Start->Programs->Windows Explorer and browse to \External Storage\boot\wince
 Showing the folders linux, Menu, Startup and tools.
 
Edit->Select All
Edit->Copy

Browse to \Permanent Storage
Edit->Paste

Ending up in \Permanent Storage\ the following folders.
linux
Menu
Startup
Tools

Reopen/browse to \External Storage\boot and copy the cfv210linux.a0.exe to \Permanent Storage\linux

 (In Startup is a batch script shortcut to copy the Short cut linux Launcher to the desktop when booted)

Run \Permanent Storage\tools\pregedit.exe to set the Startup folder to \Permanent Storage.
 Locate
 HKEY_LOCAL_MACHINE\Explorer\Shell Folders.
   Click on Shell Folders
   Double tap on StartUp
   Change from \Windows\StartUp
     to
   \Permanent Storage\Startup


   Click OK
   Close pregedit.
   Power Off unit and Power back on - this will post the registry.

  Reboot or Remove Power or Reset to give it a try.
 Should have a desktop icon for:
 Ubuntu CF v210linux a0

 Double click/tap and should start up.

You just need to make sure the CF card is in place before hitting the OK.

Click OK

Will take about 2 minutes to linux desktop.

First Boot Things to do

  • Calibrate the touch screen. Use the panel mouse to select the menu.

menu -> System Tools -> 01-Calibrate Touch Screen

  • Set up wireless - This can be a bit of a pain if Auto doesn't work try setting up wireless configuration manually. (right click on wireless strength icon and edit connections.)
  • Configure FBReader for the proper paths.

Maybe Book Path of: ~/FBooks:~/Books:/media/v210part1/Books Directory for Downloaded Books: ~/Books When needing the keyboard - might need to maximize the application so the keyboard/app don't hide each other.

  • Play around. Keep in mind that running a full desktop OS on a 400MHZ/128M ram unit - so patience and only expect to run the light weight apps.
  • Note that date time is set from internet - once the network is up. Likely you will know the date time got set because the screen will blank - use panel mouse to waken.
Personal tools