| 331 | | More to come... |
| | 331 | |
| | 332 | == 11) Startup script == |
| | 333 | |
| | 334 | We are going to make a startup script to automate some of the tasks and to be able to use some modules from archos android. |
| | 335 | The script will be started from rc.local, in the future it is probably better to use a /etc/init.d script, but for now it will do. |
| | 336 | Edit the script and then use chmod to make it executable. |
| | 337 | |
| | 338 | {{{ |
| | 339 | sudo gedit ./debianlxdefinal/etc/rc.local |
| | 340 | sudo chmod +x ./debianlxdefinal/etc/rc.local |
| | 341 | }}} |
| | 342 | |
| | 343 | {{{ |
| | 344 | #!sh |
| | 345 | #!/bin/sh |
| | 346 | # |
| | 347 | # rc.local |
| | 348 | # |
| | 349 | # This script is executed at the end of each multiuser runlevel. |
| | 350 | # Make sure that the script will "exit 0" on success or any other |
| | 351 | # value on error. |
| | 352 | # |
| | 353 | # In order to enable or disable this script just change the execution |
| | 354 | # bits. |
| | 355 | # |
| | 356 | # By default this script does nothing. |
| | 357 | |
| | 358 | # Start loading script and log it |
| | 359 | /etc/startup.sh 1> /var/log/startup.log 2>&1 |
| | 360 | exit 0 |
| | 361 | |
| | 362 | }}} |
| | 363 | |
| | 364 | I also added a log file which will appear in /var/log/ as startup.log, so we can see if something goes wrong. |
| | 365 | |
| | 366 | Now the actual startup.sh |
| | 367 | |
| | 368 | {{{ |
| | 369 | #!sh |
| | 370 | #!/bin/sh |
| | 371 | # |
| | 372 | # startup.sh |
| | 373 | # |
| | 374 | ###################################################### |
| | 375 | # Script to do get some stuff done before logging in.# |
| | 376 | ###################################################### |
| | 377 | |
| | 378 | |
| | 379 | echo "mount /dev/mmcblk0p2 on /media/" |
| | 380 | mount /dev/mmcblk0p2 /media/ |
| | 381 | echo "Mount the android squashfs to steal some modules and other stuff :)" |
| | 382 | if [ -d "/android" ]; then |
| | 383 | echo "android exists" |
| | 384 | else |
| | 385 | mkdir /android |
| | 386 | fi |
| | 387 | mount -o loop,offset=256 /media/androidmerged.squashfs.secure /android |
| | 388 | if [ -d "/media/data" ]; then |
| | 389 | echo "/media/data exists" |
| | 390 | else |
| | 391 | mkdir /media/data |
| | 392 | fi |
| | 393 | |
| | 394 | echo "mount /dev/mmcblk0p4 on /media/data" |
| | 395 | mount /dev/mmcblk0p4 /media/data |
| | 396 | echo "copy the ini file and calibration file needed for wifi" |
| | 397 | if [ -f "/wifi/wlanconf.nvs" ]; then |
| | 398 | echo "/wifi/wlanconf.nvs exists" |
| | 399 | else |
| | 400 | cp /media/data/misc/wifi/wlanconf.nvs /wifi |
| | 401 | fi |
| | 402 | if [ -f "/wifi/tiwlan.ini" ]; then |
| | 403 | echo "/wifi/tiwlan.ini exists" |
| | 404 | else |
| | 405 | cp /media/data/misc/wifi/tiwlan.ini /wifi |
| | 406 | fi |
| | 407 | |
| | 408 | echo "Make a symlink system in root because batteryd must be run from /system/bin, because archos probably used hardlinks in it" |
| | 409 | if [ -L "/system" ]; then |
| | 410 | echo "system exists" |
| | 411 | else |
| | 412 | ln -s /android/system /system |
| | 413 | fi |
| | 414 | |
| | 415 | echo "run battery daemon at 10 seconds interval" |
| | 416 | /system/bin/batteryd -i 10 & |
| | 417 | |
| | 418 | echo "load the module and firmware for wifi" |
| | 419 | insmod /wifi/tiwlan_drv.ko |
| | 420 | /wifi/tiwlan_loader -i /wifi/tiwlan.ini -f /wifi/firmware.bin -e /wifi/wlanconf.nvs |
| | 421 | echo "End this script :)" |
| | 422 | |
| | 423 | }}} |
| | 424 | |
| | 425 | Still not finished yet... |
| | 426 | |
| | 427 | |
| | 428 | |
| | 429 | |
| | 430 | |