Share Pastebin
Guest
Public paste!

Woz

By: a guest | Sep 4th, 2010 | Syntax: None | Size: 19.74 KB | Hits: 21 | Expires: Never
Copy text to clipboard
  1. #!/bin/sh
  2. fail() {
  3.         /bin/echo "Failed"
  4.                 /bin/echo "$1"
  5.                 exec /bin/sh
  6. }
  7.  
  8. /bin/mount -o remount,rw / /
  9.  
  10. PATH=/sbin:/system/sbin:/bin:/system/bin:/system/xbin:/system/xbin/bb:/data/local/bin
  11.  
  12. /bin/echo "Rootfs loaded."
  13.  
  14. /bin/mount -t proc proc /proc
  15. /bin/mount -t sysfs sys /sys
  16.  
  17. /bin/mount | grep mtd
  18. notnand=$?
  19.  
  20. if [ $notnand = "0" ] ; then
  21.   echo "running from NAND"
  22.   /bin/mount -t yaffs2 /dev/block/mtdblock2 /system
  23.   /bin/mount -t yaffs2 /dev/block/mtdblock3 /data
  24. fi
  25.  
  26.  
  27. partition=mmcblk0p1
  28.  
  29. # Try unpartitioned card
  30. if [ ! -d /sys/block/mmcblk0/$partition ] ; then
  31.         partition=mmcblk0
  32. fi
  33.  
  34. if [ -f /sys/class/vogue_hw/gsmphone ] ; then
  35.         echo "GSM phone found"
  36. fi
  37.  
  38. #mkdir -m 0777 /sdcard
  39. #fsck already done in initrd
  40. mount -t vfat -o fmask=0000,dmask=0000,rw,flush,relatime /dev/block/$partition /sdcard
  41. [ $? -eq 0 ] || fail "Failed to mount the SD card. Cannot continue."
  42.  
  43. if [ ! -d /sdcard/cache ] ; then
  44.         mkdir /sdcard/cache
  45. fi
  46.  
  47. #mkdir -m 0777 /cache
  48. mount /sdcard/cache /cache
  49.  
  50. CARD_PATH=`/bin/grep -o "rel_path=.*" /proc/cmdline | /bin/sed -e "s/.*rel_path=//g" -e "s/ .*//g"`
  51. if [ "$CARD_PATH" = "" ];then
  52.         CARD_PATH="andboot"
  53. fi;
  54. if [ -d /sdcard/$CARD_PATH ] ; then
  55.         card=/sdcard/$CARD_PATH
  56. else
  57.         card=/sdcard
  58. fi
  59.  
  60.  
  61. if [ $notnand = "1" ] ; then
  62.    
  63.     if [ -f $card/data.gz ] ; then
  64.             echo "Please wait... extracting Data Image"
  65.             if [ -f $card/data.img ] ; then
  66.                     rm $card/data.img
  67.             fi
  68.             gzip -df $card/data.gz
  69.             [ $? -eq 0 ] || fail "Failed to extract Data Image"
  70.             mv $card/data $card/data.img
  71.             echo "done"
  72.     fi
  73.    
  74.     if [ -d /sys/block/mmcblk0/mmcblk0p4 ] && /bin/grep -q -v no_partitions /proc/cmdline ; then
  75.             echo "Using partitioned system"
  76.             /bin/e2fsck -y /dev/block/mmcblk0p3
  77.             mount -t ext2 -o ro,relatime /dev/block/mmcblk0p3 /system
  78.             /bin/e2fsck -y /dev/block/mmcblk0p4
  79.             mount -t ext2 -o relatime /dev/block/mmcblk0p4 /data
  80.     else
  81.             echo "Using loopback filesystems"
  82.             if [ ! -f $card/data.img ] ; then
  83.                     echo "Creating a new Data store"
  84.                     dd if=/dev/zero of=$card/data.img bs=1048576 count=256
  85.                     [ $? -eq 0 ] || fail "Failed to allocate the storage"
  86.                     mke2fs -F $card/data.img
  87.                     [ $? -eq 0 ] || fail "Failed to format the storage"
  88.             fi
  89.  
  90.             losetup /dev/block/loop0 $card/data.img
  91.             [ $? -eq 0 ] || fail "Failed to find data.img on SD Card"
  92.             e2fsck -y /dev/block/loop0
  93.             mount -t ext2 -o relatime /dev/block/loop0 /data
  94.  
  95.             if      [ -f $card/system.ext2 ] ; then
  96.                     echo "Using uncompressed system"
  97.                     losetup /dev/block/loop1 $card/system.ext2
  98.                     [ $? -eq 0 ] || fail "Failed to reach system.ext2 on SD Card"
  99.                     e2fsck -y /dev/block/loop1
  100.                     mount -t ext2 -o relatime /dev/block/loop1 /system
  101.                     [ $? -eq 0 ] || fail "Failed to mount /system"
  102.             elif    
  103.                     [ -f $card/system.sqsh ] ; then
  104.                     echo "Using SquashFS system"
  105.                     losetup /dev/block/loop1 $card/system.sqsh
  106.                     [ $? -eq 0 ] || fail "Failed to find system.sqsh on SD Card"
  107.                     mount -t squashfs -o ro,relatime /dev/block/loop1 /system
  108.                     [ $? -eq 0 ] || fail "Failed to mount /system"
  109.             else
  110.                     losetup /dev/block/loop1 $card/system.img
  111.                     [ $? -eq 0 ] || fail "Failed to find system.img on SD Card"
  112.                     mount -t cramfs -o ro,relatime /dev/block/loop1 /system
  113.                     [ $? -eq 0 ] || fail "Failed to mount /system"
  114.             fi
  115.     fi
  116. fi
  117.  
  118. if [ -d $card/AndroidApps ] ; then
  119.         echo Copying Applications
  120.         if [ ! -d /data/app ] ; then
  121.                 mkdir -m 0771 /data/app
  122.         fi
  123.         /bin/cp $card/AndroidApps/* /data/app
  124.         chown -R 1000:1000 /data/app
  125. fi
  126.  
  127. if [ ! -d $card/media ] ; then
  128.         echo You have no media folder, please extract the resources to your SD card android folder
  129. fi
  130.  
  131. /bin/rm -rf /data/etc
  132. /bin/mkdir -m 0755 /data/etc
  133. /bin/mkdir -p -m 0700 /data/mnt/secure
  134. /bin/mkdir -p -m 0700 /data/mnt/asec
  135. mount --bind /data/mnt/secure /mnt/secure
  136. mount --bind /data/mnt/asec /mnt/asec
  137. mount /data/etc /etc
  138. cp -a /system/etc/* /etc
  139. cp -ar /init.etc/* /etc/
  140.  
  141. LCDDENSITY=`/bin/grep -o "lcd.density=.*" /proc/cmdline | /bin/sed -e "s/.*lcd.density=//g" -e "s/ .*//g"`
  142.  
  143. if [ "$LCDDENSITY" != "" ] ; then
  144.         echo "ro.sf.lcd_density=$LCDDENSITY" >> /etc/default.prop
  145.         echo Setting ro.sf.lcd_density=$LCDDENSITY
  146. fi
  147.  
  148. if [ ! -d /data/shared_prefs ] ; then
  149.         mkdir -m 0770 /data/shared_prefs
  150. fi
  151. chmod 0770 /data/shared_prefs
  152. chown 1000:1000 /data/shared_prefs
  153. mount /data/shared_prefs /shared_prefs
  154.  
  155. mount /sdcard/cache /tmp
  156.  
  157. cp /system/build.prop /tmp/build.prop
  158. KAISER=0
  159. DIAMOND=0
  160. WIFI_TI=0
  161. WIFI_BCM=0
  162. XPERIA=0
  163. WVGA=0
  164. ### Is this a Kaiser?
  165. if cat /proc/cpuinfo|grep -q Kaiser ; then
  166.         echo "KAISER detected"
  167.         KAISER=1
  168.         WIFI_TI=1
  169. elif cat /proc/cpuinfo|grep -q Polaris ; then
  170.         echo "POLARIS detected"
  171.         KAISER=1
  172.         WIFI_TI=1
  173. elif cat /proc/cpuinfo|grep -q Diamond ; then
  174.         echo "DIAMOND detected"
  175.         DIAMOND=1
  176.         WIFI_TI=1
  177. elif cat /proc/cpuinfo|grep -q Raphael ; then
  178.         echo "RAPHAEL detected"
  179.         DIAMOND=1
  180.         WIFI_TI=1
  181. elif cat /proc/cpuinfo|grep -q blackstone ; then
  182.         echo "BLACKSTONE detected"
  183.         DIAMOND=1
  184.         WIFI_TI=1
  185.         WVGA=1
  186. elif cat /proc/cpuinfo|grep -q Topaz ; then
  187.         echo "TOPAZ detected"
  188.         DIAMOND=1
  189.         WIFI_TI=1
  190.         WVGA=1
  191. elif cat /proc/cpuinfo|grep -q Kovsky ; then
  192.         echo "XPERIA detected"
  193.         XPERIA=1
  194.         WIFI_TI=1
  195.         WVGA=1
  196. elif cat /proc/cpuinfo|grep -q Rhodium ; then
  197.         echo "RHODIUM detected"
  198.         DIAMOND=1
  199.         WIFI_BCM=1
  200.         WVGA=1
  201. else
  202.         echo "VOGUE detected"
  203.         sed -i s/^wifi/#wifi/ /tmp/build.prop
  204. fi
  205.  
  206. ### Fix su on some builds...
  207. mount --bind /bin/su /system/bin/su 2> /dev/null
  208. mount --bind /bin/su /system/xbin/su 2> /dev/null
  209.  
  210. RCSCRIPT=""
  211. RCCONFIG=""
  212.  
  213. echo "Checking for build type..."
  214. if [ -f /system/hero.build ] ; then
  215.         echo "Hero build detected"
  216.         RCSCRIPT="hero"
  217.         RCCONFIG="hero"
  218.         ln /data/app_s /system/app
  219.  
  220. elif [ -f /system/eclairhero.build ] ; then
  221.         echo "HERO 2.1 BUILD DETECTED -- ECLAIR"
  222.         RCSCRIPT="eclairhero"
  223.         RCCONFIG="eclairhero"
  224.         mount --bind /lib/eclair/hw /system/lib/hw
  225.  
  226. elif [ -f /system/eclair.build ] ; then
  227.         echo "Eclair build detected"
  228.         RCSCRIPT="eclair"
  229.         RCCONFIG="eclair"
  230.         mount --bind /lib/eclair/hw /system/lib/hw
  231.  
  232. elif [ -f /system/froyo.build ] ; then
  233.         echo "Froyo build detected"
  234.         RCSCRIPT="froyo"
  235.         RCCONFIG="froyo"
  236.         mount --bind /lib/froyo/hw /system/lib/hw
  237.  
  238.         # vold: Fix sdcard device location for CDMA boards (thanks paalsteek)
  239.         if [ -d /sys/devices/platform/msm_sdcc.3 ]; then
  240.                 /bin/sed -i -e 's:/devices/platform/msm_sdcc\.2:/devices/platform/msm_sdcc.3:g' /etc/vold.fstab
  241.         fi
  242.  
  243. elif [ -f /system/tattoo.build ] ; then
  244.         echo "Tattoo build detected"
  245.         RCSCRIPT="tattoo"
  246.         RCCONFIG="tattoo"
  247.  
  248. elif [ -f /system/donut.build ] ; then
  249.         echo "Donut build detected"
  250.         RCSCRIPT="donut"
  251.         RCCONFIG="donut"
  252.         mount --bind /lib/donut/hw /system/lib/hw
  253.  
  254. elif [ -d /system/lib/donut ] ; then
  255.         echo "Donut build detected"
  256.         RCSCRIPT="donut"
  257.         RCCONFIG="donut"
  258.  
  259. elif [ -f /system/xrom.build ] ; then
  260.         echo "xROM build detected"
  261.         RCSCRIPT="xrom"
  262.         RCCONFIG="xrom"
  263.  
  264. elif [ -f /system/rogers.build ] ; then
  265.         echo "Rogers build detected"
  266.         RCSCRIPT="rogers"
  267.         RCCONFIG="rogers"
  268.  
  269. elif [ -f /system/cyanogen.build ] ; then
  270.         echo "cyanogen experimental detected.....eating donuts"
  271.         RCSCRIPT="cyanogen"
  272.         RCCONFIG="cyanogen"
  273.  
  274. elif [ -f /system/custom.build ] ; then
  275.         echo "Custom init.rc detected"
  276.         cp /system/sysinit.rc /build.cfg/init.sysinit.rc
  277.         RCCONFIG="hero"
  278.         RCSCRIPT="sysinit"
  279.        
  280. else
  281.         echo "Unknown Android build. Assuming Ion variant"
  282.         RCSCRIPT="ion"
  283.         RCCONFIG="ion"
  284.  
  285.         # for the fake sensors library
  286.         mount /lib/hw /system/lib/hw -o loop
  287.         chmod 666 /dev/input/event0
  288.  
  289.         if [ $DIAMOND -eq 1 ] ; then
  290.                 RCCONFIG="ion.diamond"
  291.         fi
  292. fi
  293.  
  294. if [ $KAISER -eq 1 ] ; then
  295.         RCSCRIPT="$RCSCRIPT.kaiser"
  296. fi
  297.  
  298. if [ $XPERIA -eq 1 ] ; then
  299.         echo "ro.sf.hwrotation=180" >> /etc/default.prop
  300. fi
  301. echo "using /init.$RCSCRIPT.rc as init.rc"
  302. echo "using $card/conf/$RCCONFIG.user.conf"
  303.  
  304. cp "/init.cfg/init.$RCSCRIPT.rc" /etc/init.rc
  305.  
  306. #Assume this rootfs.img will be used only on "good" devices
  307. #Meaning raph/diam/blac/
  308.  
  309. # echo /dev/block/mmcblk0p2 > /sys/devices/platform/usb_mass_storage/lun0/file
  310. ifconfig usb0 192.168.20.1 up
  311. busybox telnetd -b 192.168.20.1 -l /bin/sh
  312. #chmod 4755 /bin/su
  313. #mkdir -m 0777 /smodem
  314. mknod /dev/urandom c 1 9
  315. if [ -d /data/dropbear/ ] ; then
  316.         echo "Starting SSH"
  317.         mknod /dev/random c 1 8
  318.         /bin/dropbear -r /data/dropbear/dropbear_rsa_host_key -s
  319. fi
  320.  
  321. #Only froyo atm
  322. if [ "$WVGA" = "1" ] && [ "$RCSCRIPT" = "froyo" ];then
  323.         mount --bind /lib/froyo/hw/gralloc.msm7k_wvga.so /lib/froyo/hw/gralloc.msm7k.so
  324.         mount --bind /lib/froyo/hw/gralloc.msm7k_wvga.so /system/lib/hw/gralloc.msm7k.so
  325. fi
  326.  
  327. if [ "$WIFI_TI" = "1" ] || [ "$WIFI_BCM" = "1" ];then
  328.         if [ -e "$card/modules-$(uname -r).tar.gz" ] && ! `strings /data/modules/wlan.ko 2>/dev/null | grep -q "vermagic=$(uname -r)"`; then
  329.                 echo "Installing $card/modules-$(uname -r).tar.gz"
  330.                 if [ ! -d "/data/modules" ] ; then
  331.                         mkdir /data/modules
  332.                 fi
  333.                 tar xzf $card/modules-$(uname -r).tar.gz -C /data/modules
  334.                 ln -s /data/modules /data/modules/`uname -r`
  335.  
  336.                 [ -f /etc/wifi/wlan.ko ] && rm /etc/wifi/wlan.ko
  337.                 cp -R /etc/wifi/* /data/modules/
  338.                 depmod
  339.         else
  340.                 echo "Modules already unpacked for this kernel version -- skipping installation of $card/modules-$(uname -r).tar.gz"
  341.         fi
  342.         mount --bind /data/modules /lib/modules
  343.         mount --bind /data/modules /system/lib/modules
  344.         sed -i s/^#wifi/wifi/ /tmp/build.prop
  345. fi
  346.  
  347. if [ -f /system/eclair.build ]
  348. then
  349.         mount --bind /lib/eclair/libhardware_legacy.so /system/lib/libhardware_legacy.so
  350. elif [ -f /system/froyo.build ]
  351. then
  352.         mount --bind /lib/froyo/libhardware_legacy.so /system/lib/libhardware_legacy.so
  353. fi
  354.  
  355. if [ "$WIFI_TI" = "1" ];then
  356.         if [ "`grep -c ^wifi /tmp/build.prop`" != "2" ]; then
  357.                 echo "wifi.interface = tiwlan0" >> /tmp/build.prop
  358.                 echo "wifi.supplicant_scan_interval = 45" >> /tmp/build.prop
  359.         fi
  360. fi
  361.  
  362. if [ "$WIFI_BCM" = "1" ] ;then
  363.         if [ "`grep -c ^wifi /tmp/build.prop`" != "2" ]; then
  364.                 echo "wifi.interface = eth0" >> /tmp/build.prop
  365.                 echo "wifi.supplicant_scan_interval = 45" >> /tmp/build.prop
  366.         fi
  367.  
  368.         # fyi: firmware is loaded from /etc/wifi/bcm432x/bcm4325-rtecdc.bin, nvram from /data/wifi-nvram.txt
  369.  
  370.         mount --bind /etc/wifi/bcm432x/dhcpcd.conf /system/etc/dhcpcd/dhcpcd.conf
  371.         mount --bind /etc/wifi/bcm432x/wpa_supplicant.conf /system/etc/wifi/wpa_supplicant.conf
  372.  
  373.         # init.rc: fix wpa_supplicant service
  374.         sed -i s/-itiwlan0/-ieth0/ /etc/init.rc
  375.         sed -i s/-Dtiwlan0/-Dwext/ /etc/init.rc
  376.  
  377.         # init.rc: fix dhcpcd service, wifi.interface, and wpa_supplicant service socket
  378.         sed -i s/tiwlan0/eth0/ /etc/init.rc
  379.  
  380.         # init.rc:
  381.         sed -i s/user\ wifi/#user\ wifi/ /etc/init.rc
  382.         sed -i s/group\ wifi/#group\ wifi/ /etc/init.rc
  383.  
  384.         # extract nvram (todo: clean this up/integrate with TI calibration)
  385.         if [ ! -e /data/wifi-nvram.txt ]; then
  386.                 for SKIP in 5744 4736;do
  387.                         insmod /lib/modules/mtdchar.ko
  388.                         mknod /dev/mtd0ro c 90 1
  389.                         mkdir /lib/modules/$(uname -r)
  390.  
  391.                         dd if=/dev/mtd0ro of=/tmp/tempcal bs=8192 count=1 skip=$SKIP
  392.                         rm /dev/mtd0ro
  393.                         rmmod mtdchar
  394.                         rmdir /lib/modules/$(uname -r)
  395.                         dd if=/tmp/tempcal of=/data/wifi-nvram.txt bs=1 count=466
  396.                         rm /tmp/tempcal
  397.                
  398.                         if grep nocrc= /data/wifi-nvram.txt 2>&1 > /dev/null;then
  399.                                 break
  400.                         fi;
  401.                 done
  402.                 if [ "$SKIP" = "5744" ];then
  403.                         echo "CDMA Rhodium detected"
  404.                 fi;
  405.                 if [ "$SKIP" = "4736" ];then
  406.                         echo "GSM Rhodium detected"
  407.                 fi;
  408.  
  409.         fi
  410. fi
  411.  
  412. mount --bind /tmp/build.prop /system/build.prop
  413.  
  414. if [ -f "$card/conf/$RCCONFIG.user.conf" ]; then
  415.         /bin/userinit.sh -c "$card/conf/$RCCONFIG.user.conf"
  416. else
  417.         echo "No user config files ($RCCONFIG) found on sdcard"
  418. fi
  419.  
  420. mount -tdebugfs none /dbgfs
  421. #Activate baclight control
  422. echo 3 > /sys/class/htc_hw/test
  423. #Smooth scroll
  424. echo 40 >/sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
  425. #Activate full charging
  426. echo 2 > /dbgfs/htc_battery/charger_state
  427.  
  428. echo 1024 > /dbgfs/micropklt_dbg/sleep_leds
  429.  
  430. if /bin/grep -c 'physkeyboard=fuze' /proc/cmdline >/dev/null ; then
  431.         echo "USING RAPH110|FUZE LAYOUT"
  432.         cp -f /init.etc/keymaps/fuze_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  433.         cp -f /init.etc/keymaps/fuze_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  434.         cp -f /init.etc/keymaps/fuze_raph_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  435. elif /bin/grep -c 'physkeyboard=raph' /proc/cmdline >/dev/null ; then
  436.         echo "USING NEW RAPH LAYOUT"
  437.         cp -f /init.etc/keymaps/raphfix_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  438. elif /bin/grep -c 'physkeyboard=nordic_raph' /proc/cmdline >/dev/null ; then
  439.         echo "USING NEW NORDIC RAPH LAYOUT"
  440.         cp -f /init.etc/keymaps/raphfix_microp-keypad-swedish.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  441. elif /bin/grep -c 'physkeyboard=german_raph' /proc/cmdline >/dev/null ; then
  442.         echo "USING NEW GERMAN RAPH LAYOUT"
  443.         cp -f /init.etc/keymaps/microp-german.keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  444. elif /bin/grep -c 'physkeyboard=swiss_raph' /proc/cmdline >/dev/null ; then
  445.         echo "USING NEW SWISS RAPH LAYOUT"
  446.         cp -f /init.etc/keymaps/microp-swiss.keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  447. elif /bin/grep -c 'physkeyboard=tilt2' /proc/cmdline >/dev/null ; then
  448.         echo "USING EXPERIMENTAL TILT2 LAYOUT"
  449.         cp -f /init.etc/keymaps/tilt2_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  450.         cp -f /init.etc/keymaps/tilt2_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  451.         cp -f /init.etc/keymaps/tilt2_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  452. elif /bin/grep -c 'physkeyboard=rhod210' /proc/cmdline >/dev/null ; then
  453.         echo "USING EXPERIMENTAL RHOD210 LAYOUT"
  454.         cp -f /init.etc/keymaps/rhod210_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  455.         cp -f /init.etc/keymaps/rhod210_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  456.         cp -f /init.etc/keymaps/rhod210_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  457. elif /bin/grep -c 'physkeyboard=rhod100_de' /proc/cmdline >/dev/null ; then
  458.         echo "USING RHOD100 DE LAYOUT"
  459.         cp -f /init.etc/keymaps/rhod100_de_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  460.         cp -f /init.etc/keymaps/rhod100_de_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  461.         cp -f /init.etc/keymaps/rhod100_de_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  462. elif /bin/grep -c 'physkeyboard=rhod100_fr' /proc/cmdline >/dev/null ; then
  463.         echo "USING RHOD100 FR LAYOUT"
  464.         cp -f /init.etc/keymaps/rhod100_fr_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  465.         cp -f /init.etc/keymaps/rhod100_fr_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  466.         cp -f /init.etc/keymaps/rhod100_fr_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  467. elif /bin/grep -c 'physkeyboard=rhod100_it' /proc/cmdline >/dev/null ; then
  468.         echo "USING RHOD100 IT LAYOUT"
  469.         cp -f /init.etc/keymaps/rhod100_it_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  470.         cp -f /init.etc/keymaps/rhod100_it_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  471.         cp -f /init.etc/keymaps/rhod100_it_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  472. elif /bin/grep -c 'physkeyboard=rhod100_uk' /proc/cmdline >/dev/null ; then
  473.         echo "USING RHOD100 UK LAYOUT"
  474.         cp -f /init.etc/keymaps/rhod100_uk_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  475.         cp -f /init.etc/keymaps/rhod100_uk_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  476.         cp -f /init.etc/keymaps/rhod100_uk_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  477. elif /bin/grep -c 'physkeyboard=rhod100_nordic' /proc/cmdline >/dev/null ; then
  478.         echo "USING RHOD100 NORDIC LAYOUT"
  479.         cp -f /init.etc/keymaps/rhod100_nordic_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  480.         cp -f /init.etc/keymaps/rhod100_nordic_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  481.         cp -f /init.etc/keymaps/rhod100_nordic_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  482. elif /bin/grep -c 'physkeyboard=rhod400' /proc/cmdline >/dev/null ; then
  483.         echo "USING EXPERIMENTAL RHOD400 LAYOUT"
  484.         cp -f /init.etc/keymaps/rhod400_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  485.         cp -f /init.etc/keymaps/rhod400_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  486.         cp -f /init.etc/keymaps/rhod400_navi_pad.kl /etc/keymaps/raph_navi_pad.kl #does not exist, just following example
  487. elif /bin/grep -c 'physkeyboard=rhod500' /proc/cmdline >/dev/null ; then
  488.         echo "USING EXPERIMENTAL RHOD500 LAYOUT"
  489.         cp -f /init.etc/keymaps/rhod500_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  490.         cp -f /init.etc/keymaps/rhod500_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  491.         cp -f /init.etc/keymaps/rhod500_navi_pad.kl /etc/keymaps/raph_navi_pad.kl #does not exist, just following example
  492. elif /bin/grep -c 'physkeyboard=kovsq' /proc/cmdline >/dev/null ; then
  493.         echo "USING KOVSKY QWERTY LAYOUT"
  494.         cp -f /init.etc/keymaps/kovsky-qwerty.kl /etc/keymaps/microp-keypad.kl
  495.         cp -f /init.etc/keymaps/kovsky-qwerty.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  496. elif /bin/grep -c 'physkeyboard=kovsa' /proc/cmdline >/dev/null; then
  497.         echo "USING KOVSKY AZERTY LAYOUT"
  498.         cp -f /init.etc/keymaps/kovsky-azerty.kl /etc/keymaps/microp-keypad.kl
  499.         cp -f /init.etc/keymaps/kovsky-azerty.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  500. else
  501.         echo "USING OLD KEYMAP"
  502.         cp -f /init.etc/keymaps/oldqwerty_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  503.         cp -f /init.etc/keymaps/oldqwerty_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  504.         cp -f /init.etc/keymaps/oldqwerty_raph_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  505. fi
  506.  
  507. cp -af /init.etc/keymaps/qwerty.kcm.bin /init.etc/keymaps/qwerty.kl /etc/keymaps/
  508. mount --bind /etc/keymaps /system/usr/keychars
  509. mount --bind /etc/keymaps /system/usr/keylayout
  510.  
  511. for i in /sys/class/input/input* ; do
  512.         if [ "`cat $i/name`" = "tssc-manager" ] ; then
  513.                 touchscreendir=$i
  514.                 echo "Touchscreen device directory is $i"
  515.         fi
  516. done
  517.  
  518. if [ -f $card/ts-calibration ] ; then
  519.         echo "Using Saved Touchscreen Calibration"
  520.         echo 128,128,1903,128,128,1907,1903,1907,1024,1024 > $touchscreendir/calibration_screen
  521.         cat $card/ts-calibration > $touchscreendir/calibration_points
  522. else
  523.         mkdir /dev/graphics
  524.         mknod /dev/graphics/fb0 c 29 0
  525.         clear
  526.         echo; echo; echo; echo; echo; echo; echo; echo "Calibrating Touchscreen:"
  527.         echo "Click the Five Targets in order -- Top Left, Top Right, Middle, Bottom Left, Bottom Right"
  528.         echo "(Tap lightly. The screen is quite sensitive.)"
  529.         tssc-calibrate
  530.         echo 0,0,0,0,0,0,0,0,0,0 | cmp -s $touchscreendir/calibration_points # determine if calibration is still null -- means failed calibration
  531.         if [ $? -eq 0 ] ; then
  532.                 echo "Touchscreen Calibration Failed"
  533.         else
  534.                 echo "Touchscreen Calibration Successful; Saving..."
  535.                 cat $touchscreendir/calibration_points > $card/ts-calibration
  536.         fi
  537. fi
  538.  
  539. mkdir /dev/msm_camera
  540. mknod /dev/msm_camera/control0 c 250 0
  541. mknod /dev/msm_camera/config0 c 250 1
  542. mknod /dev/msm_camera/frame0 c 250 2
  543. chmod a+s /bin/pppd
  544.  
  545. # Generate a "serial number" for the Android system to identify the device.
  546. # Put it in /data so it survives reboots. Won't survive a factory reset, though.
  547. [ -f "/data/serialno" ] || echo -e `cat /dev/urandom | tr -dc 'A-Z0-9' | fold -w 12 | head -n 1` >/data/serialno
  548.  
  549. SERIALNO=$(cat /data/serialno)
  550. cp /proc/cmdline /tmp/cmdline
  551. sed -i -e "s:$: androidboot.serialno=${SERIALNO}:" /tmp/cmdline
  552. mount --bind /tmp/cmdline /proc/cmdline
  553.  
  554. #enable sound
  555. mknod /dev/chardev c 254 0
  556. echo 1 > /dev/chardev
  557.  
  558. exec /init.android