Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.94 KB | None | 0 0
  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,utf8 /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. SQUASH=1
  110. else
  111. losetup /dev/block/loop1 $card/system.img
  112. [ $? -eq 0 ] || fail "Failed to find system.img on SD Card"
  113. mount -t cramfs -o ro,relatime /dev/block/loop1 /system
  114. [ $? -eq 0 ] || fail "Failed to mount /system"
  115. fi
  116. fi
  117. fi
  118.  
  119. if [ -f "$card/update.zip" ] && [ ! -f "/sdcard/cache/recovery/intent" ] && [ -z "$SQUASH" ]
  120. then
  121. RECOVERYCARD=$(echo $card | sed -e 's:/sdcard/:SDCARD\::')
  122.  
  123. echo "STARTING OTA UPDATE SYSTEM"
  124. cp /init.cfg/init.recovery.rc /etc/init.rc
  125. mkdir /cache/recovery
  126. echo "--update_package=${RECOVERYCARD}/update.zip" >/cache/recovery/command
  127. echo "--send_intent=complete" >>/cache/recovery/command
  128. exec /init.android
  129. fi
  130.  
  131. # If not updating, ensure old recovery.intent and update.zip files are removed so we can update again later.
  132. rm -f /sdcard/cache/recovery/intent
  133. rm -f $card/update.zip
  134.  
  135. if [ -d $card/AndroidApps ] ; then
  136. echo Copying Applications
  137. if [ ! -d /data/app ] ; then
  138. mkdir -m 0771 /data/app
  139. fi
  140. /bin/cp $card/AndroidApps/* /data/app
  141. chown -R 1000:1000 /data/app
  142. fi
  143.  
  144. if [ ! -d $card/media ] ; then
  145. echo You have no media folder, please extract the resources to your SD card android folder
  146. fi
  147.  
  148. /bin/rm -rf /data/etc
  149. /bin/mkdir -m 0755 /data/etc
  150. /bin/mkdir -p -m 0700 /data/mnt/secure
  151. /bin/mkdir -p -m 0700 /data/mnt/asec
  152. mount --bind /data/mnt/secure /mnt/secure
  153. mount --bind /data/mnt/asec /mnt/asec
  154. mount /data/etc /etc
  155. cp -a /system/etc/* /etc
  156. cp -ar /init.etc/* /etc/
  157.  
  158. LCDDENSITY=`/bin/grep -o "lcd.density=.*" /proc/cmdline | /bin/sed -e "s/.*lcd.density=//g" -e "s/ .*//g"`
  159.  
  160. if [ "$LCDDENSITY" != "" ] ; then
  161. echo "ro.sf.lcd_density=$LCDDENSITY" >> /etc/default.prop
  162. echo Setting ro.sf.lcd_density=$LCDDENSITY
  163. fi
  164.  
  165. if [ ! -d /data/shared_prefs ] ; then
  166. mkdir -m 0770 /data/shared_prefs
  167. fi
  168. chmod 0770 /data/shared_prefs
  169. chown 1000:1000 /data/shared_prefs
  170. mount /data/shared_prefs /shared_prefs
  171.  
  172. mount /sdcard/cache /tmp
  173.  
  174. cp /system/build.prop /tmp/build.prop
  175. KAISER=0
  176. DIAMOND=0
  177. WIFI_TI=0
  178. WIFI_BCM=0
  179. XPERIA=0
  180. WVGA=0
  181. ### Is this a Kaiser?
  182. if cat /proc/cpuinfo|grep -q Kaiser ; then
  183. echo "KAISER detected"
  184. KAISER=1
  185. WIFI_TI=1
  186. elif cat /proc/cpuinfo|grep -q Polaris ; then
  187. echo "POLARIS detected"
  188. KAISER=1
  189. WIFI_TI=1
  190. elif cat /proc/cpuinfo|grep -q Diamond ; then
  191. echo "DIAMOND detected"
  192. DIAMOND=1
  193. WIFI_TI=1
  194. elif cat /proc/cpuinfo|grep -q Raphael ; then
  195. echo "RAPHAEL detected"
  196. DIAMOND=1
  197. WIFI_TI=1
  198. elif cat /proc/cpuinfo|grep -q blackstone ; then
  199. echo "BLACKSTONE detected"
  200. DIAMOND=1
  201. WIFI_TI=1
  202. WVGA=1
  203. elif cat /proc/cpuinfo|grep -q Topaz ; then
  204. echo "TOPAZ detected"
  205. DIAMOND=1
  206. WIFI_TI=1
  207. WVGA=1
  208. elif cat /proc/cpuinfo|grep -q Kovsky ; then
  209. echo "XPERIA detected"
  210. XPERIA=1
  211. WIFI_TI=1
  212. WVGA=1
  213. elif cat /proc/cpuinfo|grep -q Rhodium ; then
  214. echo "RHODIUM detected"
  215. DIAMOND=1
  216. WIFI_BCM=1
  217. WVGA=1
  218. else
  219. echo "VOGUE detected"
  220. sed -i s/^wifi/#wifi/ /tmp/build.prop
  221. fi
  222.  
  223. ### Fix su on some builds...
  224. mount --bind /bin/su /system/bin/su 2> /dev/null
  225. mount --bind /bin/su /system/xbin/su 2> /dev/null
  226.  
  227. RCSCRIPT=""
  228. RCCONFIG=""
  229.  
  230. echo "Checking for build type..."
  231. if [ -f /system/hero.build ] ; then
  232. echo "Hero build detected"
  233. RCSCRIPT="hero"
  234. RCCONFIG="hero"
  235. ln /data/app_s /system/app
  236.  
  237. elif [ -f /system/eclairhero.build ] ; then
  238. echo "HERO 2.1 BUILD DETECTED -- ECLAIR"
  239. RCSCRIPT="eclairhero"
  240. RCCONFIG="eclairhero"
  241. mount --bind /lib/eclair/hw /system/lib/hw
  242.  
  243. elif [ -f /system/eclair.build ] ; then
  244. echo "Eclair build detected"
  245. RCSCRIPT="eclair"
  246. RCCONFIG="eclair"
  247. mount --bind /lib/eclair/hw /system/lib/hw
  248.  
  249. elif [ -f /system/froyo.build ] ; then
  250. echo "Froyo build detected"
  251. RCSCRIPT="froyo"
  252. RCCONFIG="froyo"
  253. mount --bind /lib/froyo/hw /system/lib/hw
  254.  
  255. # vold: Fix sdcard device location for CDMA boards (thanks paalsteek)
  256. if [ -d /sys/devices/platform/msm_sdcc.3 ]; then
  257. /bin/sed -i -e 's:/devices/platform/msm_sdcc\.2:/devices/platform/msm_sdcc.3:g' /etc/vold.fstab
  258. fi
  259.  
  260. elif [ -f /system/gingerbread.build ] ; then
  261. echo "Gingerbread build detected"
  262. RCSCRIPT="gingerbread"
  263. RCCONFIG="gingerbread"
  264.  
  265. # vold: Fix sdcard device location for CDMA boards (thanks paalsteek)
  266. if [ -d /sys/devices/platform/msm_sdcc.3 ]; then
  267. /bin/sed -i -e 's:/devices/platform/msm_sdcc\.2:/devices/platform/msm_sdcc.3:g' /etc/vold.fstab
  268. fi
  269.  
  270. elif [ -f /system/tattoo.build ] ; then
  271. echo "Tattoo build detected"
  272. RCSCRIPT="tattoo"
  273. RCCONFIG="tattoo"
  274.  
  275. elif [ -f /system/donut.build ] ; then
  276. echo "Donut build detected"
  277. RCSCRIPT="donut"
  278. RCCONFIG="donut"
  279. mount --bind /lib/donut/hw /system/lib/hw
  280.  
  281. elif [ -d /system/lib/donut ] ; then
  282. echo "Donut build detected"
  283. RCSCRIPT="donut"
  284. RCCONFIG="donut"
  285.  
  286. elif [ -f /system/xrom.build ] ; then
  287. echo "xROM build detected"
  288. RCSCRIPT="xrom"
  289. RCCONFIG="xrom"
  290.  
  291. elif [ -f /system/rogers.build ] ; then
  292. echo "Rogers build detected"
  293. RCSCRIPT="rogers"
  294. RCCONFIG="rogers"
  295.  
  296. elif [ -f /system/cyanogen.build ] ; then
  297. echo "cyanogen experimental detected.....eating donuts"
  298. RCSCRIPT="cyanogen"
  299. RCCONFIG="cyanogen"
  300.  
  301. elif [ -f /system/custom.build ] ; then
  302. echo "Custom init.rc detected"
  303. cp /system/sysinit.rc /build.cfg/init.sysinit.rc
  304. RCCONFIG="hero"
  305. RCSCRIPT="sysinit"
  306.  
  307. else
  308. echo "Unknown Android build. Assuming Ion variant"
  309. RCSCRIPT="ion"
  310. RCCONFIG="ion"
  311.  
  312. # for the fake sensors library
  313. mount /lib/hw /system/lib/hw -o loop
  314. chmod 666 /dev/input/event0
  315.  
  316. if [ $DIAMOND -eq 1 ] ; then
  317. RCCONFIG="ion.diamond"
  318. fi
  319. fi
  320.  
  321. if [ $KAISER -eq 1 ] ; then
  322. RCSCRIPT="$RCSCRIPT.kaiser"
  323. fi
  324.  
  325. if [ $XPERIA -eq 1 ] ; then
  326. echo "ro.sf.hwrotation=180" >> /etc/default.prop
  327. fi
  328. echo "using /init.$RCSCRIPT.rc as init.rc"
  329. echo "using $card/conf/$RCCONFIG.user.conf"
  330.  
  331. cp "/init.cfg/init.$RCSCRIPT.rc" /etc/init.rc
  332.  
  333. #Assume this rootfs.img will be used only on "good" devices
  334. #Meaning raph/diam/blac/
  335.  
  336. # echo /dev/block/mmcblk0p2 > /sys/devices/platform/usb_mass_storage/lun0/file
  337. ifconfig usb0 192.168.20.1 up
  338. busybox telnetd -b 192.168.20.1 -l /bin/sh
  339. #chmod 4755 /bin/su
  340. #mkdir -m 0777 /smodem
  341. mknod /dev/urandom c 1 9
  342. if [ -d /data/dropbear/ ] ; then
  343. echo "Starting SSH"
  344. mknod /dev/random c 1 8
  345. /bin/dropbear -r /data/dropbear/dropbear_rsa_host_key -s
  346. fi
  347.  
  348. if [ "$WIFI_TI" = "1" ] || [ "$WIFI_BCM" = "1" ];then
  349. if [ -e "$card/modules-$(uname -r).tar.gz" ] && ! `strings /data/modules/wlan.ko 2>/dev/null | grep -q "vermagic=$(uname -r)"`; then
  350. echo "Installing $card/modules-$(uname -r).tar.gz"
  351. if [ ! -d "/data/modules" ] ; then
  352. mkdir /data/modules
  353. fi
  354. tar xzf $card/modules-$(uname -r).tar.gz -C /data/modules
  355. ln -s /data/modules /data/modules/`uname -r`
  356. else
  357. echo "Modules already unpacked for this kernel version -- skipping installation of $card/modules-$(uname -r).tar.gz"
  358. fi
  359.  
  360. mount --bind /data/modules /lib/modules
  361. mount --bind /data/modules /system/lib/modules
  362.  
  363. cp -R /etc/wifi/* /data/modules/
  364. depmod
  365.  
  366. [ -f /etc/wifi/wlan.ko ] && rm /etc/wifi/wlan.ko
  367.  
  368. sed -i s/^#wifi/wifi/ /tmp/build.prop
  369. fi
  370.  
  371. if [ -f /system/eclair.build ]
  372. then
  373. mount --bind /lib/eclair/libhardware_legacy.so /system/lib/libhardware_legacy.so
  374. elif [ -f /system/froyo.build ]
  375. then
  376. mount --bind /lib/froyo/libhardware_legacy.so /system/lib/libhardware_legacy.so
  377. fi
  378.  
  379. if [ "$WIFI_TI" = "1" ];then
  380. if [ "`grep -c ^wifi /tmp/build.prop`" != "2" ]; then
  381. echo "wifi.interface = tiwlan0" >> /tmp/build.prop
  382. echo "wifi.supplicant_scan_interval = 45" >> /tmp/build.prop
  383. fi
  384. fi
  385.  
  386. if [ "$WIFI_BCM" = "1" ] ;then
  387. if [ "`grep -c ^wifi /tmp/build.prop`" != "2" ]; then
  388. echo "wifi.interface = eth0" >> /tmp/build.prop
  389. echo "wifi.supplicant_scan_interval = 45" >> /tmp/build.prop
  390. fi
  391.  
  392. # fyi: firmware is loaded from /etc/wifi/bcm432x/bcm4325-rtecdc.bin, nvram from /data/wifi-nvram.txt
  393.  
  394. mount --bind /etc/wifi/bcm432x/dhcpcd.conf /system/etc/dhcpcd/dhcpcd.conf
  395. mount --bind /etc/wifi/bcm432x/wpa_supplicant.conf /system/etc/wifi/wpa_supplicant.conf
  396.  
  397. # init.rc: fix wpa_supplicant service
  398. sed -i s/-itiwlan0/-ieth0/ /etc/init.rc
  399. sed -i s/-Dtiwlan0/-Dwext/ /etc/init.rc
  400.  
  401. # init.rc: fix dhcpcd service, wifi.interface, and wpa_supplicant service socket
  402. sed -i s/tiwlan0/eth0/ /etc/init.rc
  403.  
  404. # init.rc:
  405. sed -i s/user\ wifi/#user\ wifi/ /etc/init.rc
  406. sed -i s/group\ wifi/#group\ wifi/ /etc/init.rc
  407.  
  408. # extract nvram (todo: clean this up/integrate with TI calibration)
  409. if [ ! -e /data/wifi-nvram.txt ]; then
  410. for SKIP in 5744 4736;do
  411. insmod /lib/modules/mtdchar.ko
  412. mknod /dev/mtd0ro c 90 1
  413. mkdir /lib/modules/$(uname -r)
  414.  
  415. dd if=/dev/mtd0ro of=/tmp/tempcal bs=8192 count=1 skip=$SKIP
  416. rm /dev/mtd0ro
  417. rmmod mtdchar
  418. rmdir /lib/modules/$(uname -r)
  419. dd if=/tmp/tempcal of=/data/wifi-nvram.txt bs=1 count=466
  420. rm /tmp/tempcal
  421.  
  422. if grep nocrc= /data/wifi-nvram.txt 2>&1 > /dev/null;then
  423. break
  424. fi;
  425. done
  426. if [ "$SKIP" = "5744" ];then
  427. echo "CDMA Rhodium detected"
  428. fi;
  429. if [ "$SKIP" = "4736" ];then
  430. echo "GSM Rhodium detected"
  431. fi;
  432.  
  433. fi
  434. fi
  435.  
  436. mount --bind /tmp/build.prop /system/build.prop
  437.  
  438. if [ -f "$card/conf/$RCCONFIG.user.conf" ]; then
  439. /bin/userinit.sh -c "$card/conf/$RCCONFIG.user.conf"
  440. else
  441. echo "No user config files ($RCCONFIG) found on sdcard"
  442. fi
  443.  
  444. mount -tdebugfs none /dbgfs
  445. #Activate baclight control
  446. echo 3 > /sys/class/htc_hw/test
  447. #Smooth scroll
  448. echo 40 >/sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
  449. #Activate full charging
  450. echo 2 > /dbgfs/htc_battery/charger_state
  451.  
  452. echo 1024 > /dbgfs/micropklt_dbg/sleep_leds
  453.  
  454. if /bin/grep -c 'physkeyboard=fuze' /proc/cmdline >/dev/null ; then
  455. echo "USING RAPH110|FUZE LAYOUT"
  456. cp -f /init.etc/keymaps/fuze_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  457. cp -f /init.etc/keymaps/fuze_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  458. cp -f /init.etc/keymaps/fuze_raph_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  459. elif /bin/grep -c 'physkeyboard=raph' /proc/cmdline >/dev/null ; then
  460. echo "USING NEW RAPH LAYOUT"
  461. cp -f /init.etc/keymaps/raphfix_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  462. elif /bin/grep -c 'physkeyboard=nordic_raph' /proc/cmdline >/dev/null ; then
  463. echo "USING NEW NORDIC RAPH LAYOUT"
  464. cp -f /init.etc/keymaps/raphfix_microp-keypad-swedish.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  465. elif /bin/grep -c 'physkeyboard=german_raph' /proc/cmdline >/dev/null ; then
  466. echo "USING NEW GERMAN RAPH LAYOUT"
  467. cp -f /init.etc/keymaps/microp-german.keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  468. elif /bin/grep -c 'physkeyboard=swiss_raph' /proc/cmdline >/dev/null ; then
  469. echo "USING NEW SWISS RAPH LAYOUT"
  470. cp -f /init.etc/keymaps/microp-swiss.keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  471. elif /bin/grep -c 'physkeyboard=tilt2' /proc/cmdline >/dev/null ; then
  472. echo "USING EXPERIMENTAL TILT2 LAYOUT"
  473. cp -f /init.etc/keymaps/tilt2_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  474. cp -f /init.etc/keymaps/tilt2_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  475. cp -f /init.etc/keymaps/tilt2_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  476. elif /bin/grep -c 'physkeyboard=rhod210' /proc/cmdline >/dev/null ; then
  477. echo "USING EXPERIMENTAL RHOD210 LAYOUT"
  478. cp -f /init.etc/keymaps/rhod210_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  479. cp -f /init.etc/keymaps/rhod210_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  480. cp -f /init.etc/keymaps/rhod210_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  481. elif /bin/grep -c 'physkeyboard=rhod100_de' /proc/cmdline >/dev/null ; then
  482. echo "USING RHOD100 DE LAYOUT"
  483. cp -f /init.etc/keymaps/rhod100_de_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  484. cp -f /init.etc/keymaps/rhod100_de_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  485. cp -f /init.etc/keymaps/rhod100_de_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  486. elif /bin/grep -c 'physkeyboard=rhod100_fr' /proc/cmdline >/dev/null ; then
  487. echo "USING RHOD100 FR LAYOUT"
  488. cp -f /init.etc/keymaps/rhod100_fr_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  489. cp -f /init.etc/keymaps/rhod100_fr_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  490. cp -f /init.etc/keymaps/rhod100_fr_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  491. elif /bin/grep -c 'physkeyboard=rhod100_it' /proc/cmdline >/dev/null ; then
  492. echo "USING RHOD100 IT LAYOUT"
  493. cp -f /init.etc/keymaps/rhod100_it_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  494. cp -f /init.etc/keymaps/rhod100_it_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  495. cp -f /init.etc/keymaps/rhod100_it_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  496. elif /bin/grep -c 'physkeyboard=rhod100_uk' /proc/cmdline >/dev/null ; then
  497. echo "USING RHOD100 UK LAYOUT"
  498. cp -f /init.etc/keymaps/rhod100_uk_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  499. cp -f /init.etc/keymaps/rhod100_uk_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  500. cp -f /init.etc/keymaps/rhod100_uk_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  501. elif /bin/grep -c 'physkeyboard=rhod100_nordic' /proc/cmdline >/dev/null ; then
  502. echo "USING RHOD100 NORDIC LAYOUT"
  503. cp -f /init.etc/keymaps/rhod100_nordic_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  504. cp -f /init.etc/keymaps/rhod100_nordic_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  505. cp -f /init.etc/keymaps/rhod100_nordic_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  506. elif /bin/grep -c 'physkeyboard=rhod400' /proc/cmdline >/dev/null ; then
  507. echo "USING EXPERIMENTAL RHOD400 LAYOUT"
  508. cp -f /init.etc/keymaps/rhod400_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  509. cp -f /init.etc/keymaps/rhod400_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  510. cp -f /init.etc/keymaps/rhod400_navi_pad.kl /etc/keymaps/raph_navi_pad.kl #does not exist, just following example
  511. elif /bin/grep -c 'physkeyboard=rhod500' /proc/cmdline >/dev/null ; then
  512. echo "USING EXPERIMENTAL RHOD500 LAYOUT"
  513. cp -f /init.etc/keymaps/rhod500_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  514. cp -f /init.etc/keymaps/rhod500_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  515. cp -f /init.etc/keymaps/rhod500_navi_pad.kl /etc/keymaps/raph_navi_pad.kl #does not exist, just following example
  516. elif /bin/grep -c 'physkeyboard=kovsq' /proc/cmdline >/dev/null ; then
  517. echo "USING KOVSKY QWERTY LAYOUT"
  518. cp -f /init.etc/keymaps/kovsky-qwerty.kl /etc/keymaps/microp-keypad.kl
  519. cp -f /init.etc/keymaps/kovsky-qwerty.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  520. elif /bin/grep -c 'physkeyboard=kovsa' /proc/cmdline >/dev/null; then
  521. echo "USING KOVSKY AZERTY LAYOUT"
  522. cp -f /init.etc/keymaps/kovsky-azerty.kl /etc/keymaps/microp-keypad.kl
  523. cp -f /init.etc/keymaps/kovsky-azerty.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  524. else
  525. echo "USING OLD KEYMAP"
  526. cp -f /init.etc/keymaps/oldqwerty_microp-keypad.kcm.bin /etc/keymaps/microp-keypad.kcm.bin
  527. cp -f /init.etc/keymaps/oldqwerty_microp-keypad.kl /etc/keymaps/microp-keypad.kl
  528. cp -f /init.etc/keymaps/oldqwerty_raph_navi_pad.kl /etc/keymaps/raph_navi_pad.kl
  529. fi
  530.  
  531. cp -af /init.etc/keymaps/qwerty.kcm.bin /init.etc/keymaps/qwerty.kl /etc/keymaps/
  532. mount --bind /etc/keymaps /system/usr/keychars
  533. mount --bind /etc/keymaps /system/usr/keylayout
  534.  
  535. for i in /sys/class/input/input* ; do
  536. if [ "`cat $i/name`" = "tssc-manager" ] ; then
  537. touchscreendir=$i
  538. echo "Touchscreen device directory is $i"
  539. fi
  540. done
  541.  
  542. if [ -f $card/ts-calibration ] ; then
  543. echo "Using Saved Touchscreen Calibration"
  544. echo 128,128,1903,128,128,1907,1903,1907,1024,1024 > $touchscreendir/calibration_screen
  545. cat $card/ts-calibration > $touchscreendir/calibration_points
  546. else
  547. mkdir /dev/graphics
  548. mknod /dev/graphics/fb0 c 29 0
  549. clear
  550. echo; echo; echo; echo; echo; echo; echo; echo "Calibrating Touchscreen:"
  551. echo "Click the Five Targets in order -- Top Left, Top Right, Middle, Bottom Left, Bottom Right"
  552. echo "(Tap lightly. The screen is quite sensitive.)"
  553. tssc-calibrate
  554. 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
  555. if [ $? -eq 0 ] ; then
  556. echo "Touchscreen Calibration Failed"
  557. else
  558. echo "Touchscreen Calibration Successful; Saving..."
  559. cat $touchscreendir/calibration_points > $card/ts-calibration
  560. fi
  561. fi
  562.  
  563. mkdir /dev/msm_camera
  564. dev=$(cat /sys/class/msm_camera/control0/dev | sed -e "s/:/ /g")
  565. mknod /dev/msm_camera/control0 c $dev
  566. dev=$(cat /sys/class/msm_camera/config0/dev | sed -e "s/:/ /g")
  567. mknod /dev/msm_camera/config0 c $dev
  568. dev=$(cat /sys/class/msm_camera/frame0/dev | sed -e "s/:/ /g")
  569. mknod /dev/msm_camera/frame0 c $dev
  570.  
  571. dev=$(cat /sys/class/scbs/0/dev | sed -e "s/:/ /g")
  572. mknod /dev/scbs0 c $dev
  573.  
  574. mkdir /dev/log
  575. mknod /dev/log/main c 10 58
  576.  
  577. scbs -d -co /sdcard/scbs.conf
  578.  
  579. chmod a+s /bin/pppd
  580.  
  581. # Generate a "serial number" for the Android system to identify the device.
  582. # Put it in /data so it survives reboots. Won't survive a factory reset, though.
  583. [ -f "/data/serialno" ] || echo -e `cat /dev/urandom | tr -dc 'A-Z0-9' | fold -w 12 | head -n 1` >/data/serialno
  584.  
  585. SERIALNO=$(cat /data/serialno)
  586. cp /proc/cmdline /tmp/cmdline
  587. sed -i -e "s:$: androidboot.serialno=${SERIALNO}:" /tmp/cmdline
  588. mount --bind /tmp/cmdline /proc/cmdline
  589.  
  590. #strace /system/bin/bootanimation
  591. logcat > /sdcard/mylog &
  592. #strace init.android
  593. /init.android
  594. #logcat -d -t > /sdcard/mylogexit
  595. #logcat -d
  596. strace --help
  597. sync
  598. echo "everything failed"
  599. exec /bin/sh
  600. sleep 100
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement