ลง ScratchBox สำหรับพัฒนา Nokia N770
ครั้งก่อน ได้ลง OS 2008HE ไป แต่ไม่ปลื้ม เพราะว่า พอใช้ wireless แล้วเปิดเว็บ เกิดอาหารแฮงค์ รีบูตตัวเองบ่อยครั้ง
เลยโหลด OS2007HE มาลงเหมือนเดิม สุดท้ายก็เหลือปัญหาภาษาไทย ที่ต้องจัดการ เอาไว้เขียนตอนหน้าละกัน
เริ่มต้น ต้องลง scrachbox ซึ่งเป็น development toolkit ตัวหนึ่ง สำหรับ cross compile โปรแกรมต่าง ๆ ลงบน embeded device โดยที่ตัว Maemo และ Nokia ได้สนับสนุนการทำงานโดยมี sdk เสริมเข้ามา
เท่าที่เพิ่งลองเล่น ข้อดีอีกอย่าง คือสามารถ emulate ได้เลยทันทีก่อนไปลงเครื่อง สะดวกสบายพอสมควร
สำหรับ OS2007HE ที่ลงนั้น ใช้ Maemo 3.1 หรือ bora เครื่องที่ผมใช้เป็น Ubuntu8.10 ครับ
ไปที่ http://repository.maemo.org/stable/3.1/ เพื่อโหลดสคริปในการติดตั้งมา โดยสคริป จะดาวน์โหลดตัว gz มา แต่จริง ๆ สามารถใช้เป็น .deb ได้ แต่ที่ผมลงแล้วรู้สึกเพี้ยน ๆ เลยลงแบบ gz ดีกว่า
sake@cyberdora:~/project/Embeded/N770/maemosdk$ wget http://repository.maemo.org/stable/3.1/maemo-scratchbox-install_3.1.sh sake@cyberdora:~/project/Embeded/N770/maemosdk$ sudo ./maemo-scratchbox-install_3.1.sh -u sake -s /scratchbox This script will install Scratchbox 1.0.7 'apophis' release to your computer. Install options --------------- Install from packages=tgz Scratchbox install path=/scratchbox Scratchbox group=sbox armel compiler=cs2005q3.2-glibc-arm i386 compiler=cs2005q3.2-glibc-i386 armel devkits=perl:debian-sarge:maemo3-debian:maemo3-tools:cputransp i386 devkits=perl:debian-sarge:maemo3-debian:maemo3-tools:doctools armel CPU transparency=qemu-arm-0.8.2-sb2 Checking for prerequisites -------------------------- Running as user root... Running as user root inside fakeroot... Running outside of scratchbox... Running on Linux kernel... Running on i386 architecture... Host kernel binfmt_misc support... Host kernel VDSO support... Host kernel SELinux extensions... Host kernel local IPv4 port range... Which wget tool in path... Scratchbox install path is sane... Scratchbox installation not existing... Scratchbox user names... sake Everything seems ok. Downloading scratchbox packages ------------------------------- Removed earlier file 'scratchbox-core-1.0.7-i386.tar.gz'. Downloading 'scratchbox-core-1.0.7-i386.tar.gz'. --2009-01-01 08:23:14-- http://scratchbox.org/download/files/sbox-releases/branches/apophis/r4/tarball/scratchbox-core-1.0.7-i386.tar.gz Resolving scratchbox.org... 62.61.85.37 Connecting to scratchbox.org|62.61.85.37|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 49932823 (48M) [application/x-tar] Saving to: `/tmp/scratchbox-core-1.0.7-i386.tar.gz' 100%[======================================================================================================================================>] 49,932,823 136K/s in 5m 54s 2009-01-01 08:29:11 (138 KB/s) - `/tmp/scratchbox-core-1.0.7-i386.tar.gz' saved [49932823/49932823] Downloading 'scratchbox-devkit-cputransp-1.0.2-i386.tar.gz'. --2009-01-01 08:29:13-- http://scratchbox.org/download/files/sbox-releases/branches/apophis/r4/tarball/scratchbox-devkit-cputransp-1.0.2-i386.tar.gz Resolving scratchbox.org... 62.61.85.37 Connecting to scratchbox.org|62.61.85.37|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 14285271 (14M) [application/x-tar] Saving to: `/tmp/scratchbox-devkit-cputransp-1.0.2-i386.tar.gz' 100%[======================================================================================================================================>] 14,285,271 137K/s in 1m 42s 2009-01-01 08:30:56 (137 KB/s) - `/tmp/scratchbox-devkit-cputransp-1.0.2-i386.tar.gz' saved [14285271/14285271] Downloading 'scratchbox-devkit-debian-1.0.8-i386.tar.gz'. --2009-01-01 08:30:57-- http://scratchbox.org/download/files/sbox-releases/branches/apophis/r4/tarball/scratchbox-devkit-debian-1.0.8-i386.tar.gz Resolving scratchbox.org... 62.61.85.37 Connecting to scratchbox.org|62.61.85.37|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 9713072 (9.3M) [application/x-tar] Saving to: `/tmp/scratchbox-devkit-debian-1.0.8-i386.tar.gz' 100%[======================================================================================================================================>] 9,713,072 145K/s in 70s 2009-01-01 08:32:07 (136 KB/s) - `/tmp/scratchbox-devkit-debian-1.0.8-i386.tar.gz' saved [9713072/9713072] Downloading 'scratchbox-devkit-doctools-1.0.6-i386.tar.gz'. --2009-01-01 08:32:08-- http://scratchbox.org/download/files/sbox-releases/branches/apophis/r4/tarball/scratchbox-devkit-doctools-1.0.6-i386.tar.gz Resolving scratchbox.org... 62.61.85.37 Connecting to scratchbox.org|62.61.85.37|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 98185611 (94M) [application/x-tar] Saving to: `/tmp/scratchbox-devkit-doctools-1.0.6-i386.tar.gz' 100%[======================================================================================================================================>] 98,185,611 137K/s in 11m 34s 2009-01-01 08:43:43 (138 KB/s) - `/tmp/scratchbox-devkit-doctools-1.0.6-i386.tar.gz' saved [98185611/98185611] Downloading 'scratchbox-devkit-perl-1.0.4-i386.tar.gz'. --2009-01-01 08:43:48-- http://scratchbox.org/download/files/sbox-releases/branches/apophis/r4/tarball/scratchbox-devkit-perl-1.0.4-i386.tar.gz Resolving scratchbox.org... 62.61.85.37 Connecting to scratchbox.org|62.61.85.37|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 970158 (947K) [application/x-tar] Saving to: `/tmp/scratchbox-devkit-perl-1.0.4-i386.tar.gz' 100%[======================================================================================================================================>] 970,158 137K/s in 8.4s 2009-01-01 08:43:58 (113 KB/s) - `/tmp/scratchbox-devkit-perl-1.0.4-i386.tar.gz' saved [970158/970158] Downloading 'scratchbox-devkit-maemo3-1.0-i386.tar.gz'. --2009-01-01 08:43:58-- http://scratchbox.org/download/files/sbox-releases/branches/apophis/r4/tarball/scratchbox-devkit-maemo3-1.0-i386.tar.gz Resolving scratchbox.org... 62.61.85.37 Connecting to scratchbox.org|62.61.85.37|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 21603933 (21M) [application/x-tar] Saving to: `/tmp/scratchbox-devkit-maemo3-1.0-i386.tar.gz' 100%[======================================================================================================================================>] 21,603,933 138K/s in 2m 34s 2009-01-01 08:46:33 (137 KB/s) - `/tmp/scratchbox-devkit-maemo3-1.0-i386.tar.gz' saved [21603933/21603933] Downloading 'scratchbox-libs-1.0.7-i386.tar.gz'. --2009-01-01 08:46:34-- http://scratchbox.org/download/files/sbox-releases/branches/apophis/r4/tarball/scratchbox-libs-1.0.7-i386.tar.gz Resolving scratchbox.org... 62.61.85.37 Connecting to scratchbox.org|62.61.85.37|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 14395788 (14M) [application/x-tar] Saving to: `/tmp/scratchbox-libs-1.0.7-i386.tar.gz' 100%[======================================================================================================================================>] 14,395,788 138K/s in 1m 43s 2009-01-01 08:48:17 (137 KB/s) - `/tmp/scratchbox-libs-1.0.7-i386.tar.gz' saved [14395788/14395788] Downloading 'scratchbox-toolchain-cs2005q3.2-glibc-arm-1.0.5-i386.tar.gz'. --2009-01-01 08:48:18-- http://scratchbox.org/download/files/sbox-releases/branches/apophis/r4/tarball/scratchbox-toolchain-cs2005q3.2-glibc-arm-1.0.5-i386.tar.gz Resolving scratchbox.org... 62.61.85.37 Connecting to scratchbox.org|62.61.85.37|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 49751041 (47M) [application/x-tar] Saving to: `/tmp/scratchbox-toolchain-cs2005q3.2-glibc-arm-1.0.5-i386.tar.gz' 100%[======================================================================================================================================>] 49,751,041 141K/s in 5m 52s 2009-01-01 08:54:12 (138 KB/s) - `/tmp/scratchbox-toolchain-cs2005q3.2-glibc-arm-1.0.5-i386.tar.gz' saved [49751041/49751041] Downloading 'scratchbox-toolchain-cs2005q3.2-glibc-i386-1.0.5-i386.tar.gz'. --2009-01-01 08:54:14-- http://scratchbox.org/download/files/sbox-releases/branches/apophis/r4/tarball/scratchbox-toolchain-cs2005q3.2-glibc-i386-1.0.5-i386.tar.gz Resolving scratchbox.org... 62.61.85.37 Connecting to scratchbox.org|62.61.85.37|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 47935438 (46M) [application/x-tar] Saving to: `/tmp/scratchbox-toolchain-cs2005q3.2-glibc-i386-1.0.5-i386.tar.gz' 100%[======================================================================================================================================>] 47,935,438 139K/s in 5m 44s 2009-01-01 08:59:58 (136 KB/s) - `/tmp/scratchbox-toolchain-cs2005q3.2-glibc-i386-1.0.5-i386.tar.gz' saved [47935438/47935438] Setting up ---------- Extracting 'scratchbox-core-1.0.7-i386.tar.gz' to '/scratchbox'. Extracting 'scratchbox-devkit-cputransp-1.0.2-i386.tar.gz' to '/scratchbox'. Extracting 'scratchbox-devkit-debian-1.0.8-i386.tar.gz' to '/scratchbox'. Extracting 'scratchbox-devkit-doctools-1.0.6-i386.tar.gz' to '/scratchbox'. Extracting 'scratchbox-devkit-perl-1.0.4-i386.tar.gz' to '/scratchbox'. Extracting 'scratchbox-devkit-maemo3-1.0-i386.tar.gz' to '/scratchbox'. Extracting 'scratchbox-libs-1.0.7-i386.tar.gz' to '/scratchbox'. Extracting 'scratchbox-toolchain-cs2005q3.2-glibc-arm-1.0.5-i386.tar.gz' to '/scratchbox'. Extracting 'scratchbox-toolchain-cs2005q3.2-glibc-i386-1.0.5-i386.tar.gz' to '/scratchbox'. Running first time script. Do you want to use sudo mode? [yes/no] (no): Give the name of the scratchbox group (sbox): Stopping Scratchbox: umount, binfmt_misc. Starting Scratchbox: binfmt_misc, mount. Now you should add one or more users with /scratchbox/sbin/sbox_adduser Adding scratchbox user 'sake'. ผู้ใช้ `sake' ได้เป็นสมาชิกของกลุ่ม `sbox' นี้แล้ว Scratchbox user account for user sake added Installation was successful! ---------------------------- You now have Scratchbox 1.0.7 'apophis' release installed. Scratchbox cannot be run as user root. Instead, use your normal login user account. Add additional scratchbox users and sandboxes with the following command (outside scratchbox with root permissions): # /scratchbox/sbin/sbox_adduser USER yes Running this command will create sandbox environment for that user and add user to the 'sbox' scratchbox user group. You will need to start a new login terminal after being added to the 'sbox' group for group membership to be effective. Scratchbox service must be started for CPU transparency to be functional. Run the following command (outside scratchbox with root permissions): # /scratchbox/sbin/sbox_ctl start Add this command to e.g. /etc/rc.local file to start scratchbox service at boot time. Login to scratchbox session using the following command (as user): $ /scratchbox/login Refer to scratchbox.org documentation for more information re scratchbox: http://scratchbox.org/documentation/user/scratchbox-1.0/
จากนั้นทำการโหลด sdk maemo มาโดยใช้สคริปเช่นเดียวกัน
sake@cyberdora:~/project/Embeded/N770/maemosdk$ wget http://repository.maemo.org/stable/3.1/maemo-sdk-install_3.1.sh sake@cyberdora:~/project/Embeded/N770/maemosdk$ bash maemo-sdk-install_3.1.sh This script will install maemo SDK 3.1 'bora' release to your computer. Install options Do not download or install Nokia EUSA binaries (no) Force remove of existing targets (no) Alternative sources.list ('') Target configuration for armel (SDK_ARMEL) compiler=cs2005q3.2-glibc-arm devkits=perl:debian-sarge:maemo3-debian:maemo3-tools:cputransp cputransp=qemu-arm-0.8.2-sb2 Target configuration for i386 (SDK_X86) compiler=cs2005q3.2-glibc-i386 devkits=perl:debian-sarge:maemo3-debian:maemo3-tools:doctools Checking for prerequisites -------------------------- Which wget tool in path... Running outside of scratchbox... Script not run as user root... Scratchbox installation found... Scratchbox home directory... Scratchbox sb-conf tool... Scratchbox users bind mount... Scratchbox users /dev set up... Scratchbox home directory... Scratchbox login... Scratchbox login executable... Scratchbox sb-conf tool execute... Scratchbox version requirement... Scratchbox CPU transparency method for ARMEL is present... Scratchbox toolchains... Scratchbox required devkits... Acceptance to reset existing targets... Alternative sources.list file exists... Check for scratchbox sessions running... # โหลดโปรแกรมมายาว ๆ ตัดออกละกัน Installation was successful! ---------------------------- IMPORTANT! Please read this. You now have the maemo 3.1 'bora' installed on your computer. You can now start your maemo SDK session with /scratchbox/login and then select your target with 'sb-conf select SDK_ARMEL' for armel target or 'sb-conf select SDK_X86' for i386 target. If you have any problems with targets' package databases, you can try running 'fakeroot apt-get -f install' on your scratchbox target. This command will try to fix any problems with the package database. Even though the SDK was successfully installed, the installation process was unable to run 'apt-get update' inside the installed targets in order to update the local package database. This could be due to a error in network configuration inside scratchbox. A common causes are incorrect proxy settings and the 'hosts' line in /scratchbox/etc/nsswitch.conf. For the 'hosts' line in /scratchbox/etc/nsswitch.conf the following should usually be enough: hosts: files dns Once network connections inside scratchbox are working, you should run 'apt-get update' on both targets. Nokia EUSA binaries ------------------- The package maemo-explicit is a metapackage of Nokia EUSA licensed binaries which can be installed to scratchbox targets. It is highly recommended to install this package on both targets to ensure a fully working system. If you want to install these, login to scratchbox (see commands above) and run the command 'fakeroot apt-get install maemo-explicit' for both armel (SDK_ARMEL) and i386 (SDK_X86) targets. Happy hacking!
หลังจากนั้น เราเริ่มเข้าใช้งาน scratch box กันครับ
#/scratchbox/login Welcome to Scratchbox, the cross-compilation toolkit! Use 'sb-menu' to change your compilation target. See /scratchbox/doc/ for documentation. [sbox-SDK_X86: ~] >
เราสามารถเปลี่ยนระหว่าง host กับ target ได้ โดย
[sbox-SDK_X86: ~] > sb-conf select SDK_ARMEL [sbox-SDK_ARMEL: ~] > [sbox-SDK_ARMEL: ~] > sb-conf select SDK_X86 [sbox-SDK_X86: ~] >
ตัว sdk ของ maemo นั้น แนะนำให้อัพเกรด เป็น version ใหม่ คือ 3.2 สามารถใช้ apt ในการปรับปรุงได้เลยครับ
[sbox-SDK_X86: ~] > apt-get update Err http://repository.maemo.org bora/free Packages Could not resolve 'repository.maemo.org' Err http://repository.maemo.org bora/free Release Could not resolve 'repository.maemo.org'
เกิดปัญหาขึ้น เนื่องมาจากการค้น DNS ที่คัดลอกมาจาก /etc เราสามารแก้ไปได้โดยไปที่นอก scratchbox แล้วแก้ไฟล์ /scratchbox/etc/nsswitch.conf
แก้ให้บรรทัด
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
ให้เป็น
hosts : file dns
ลองใหม่ ผ่านแล้ว เริ่มอัพเกรดได้ ต้องทำทั้ง host และ target
[sbox-SDK_X86: ~] > apt-get update [sbox-SDK_X86: ~] > PAGER=less fakeroot apt-get dist-upgrade [sbox-SDK_X86: ~] > sb_conf select SDK_ARMEL [sbox-SDK_ARMEL: ~] > PAGER=less fakeroot apt-get dist-upgrade sb-conf select SDK_X86 ... mmap: permission denied when building dpkg: error processing /var/cache/apt/archives/maemo-af-desktop_2.9.99.25-1_armel.deb (--unpack)
เกิดปัญหาในขั้นตอนที่สอง เราสามารถแก้ไขได้ โดย ปิด vdso และ limit memory map ให้เหลือ 4096 แทนค่ามาตรฐาน 65535
[sbox-SDK_ARMEL: ~] > echo 0 | sudo tee /proc/sys/vm/vdso_enabled [sbox-SDK_ARMEL: ~] > echo 4096 | sudo tee /proc/sys/vm/mmap_min_addr
จากนั้น อัพเกรดอีกครั้ง จะพบว่า สามารถลงได้เรียบร้อย
จากนั้น เปิดเทอร์มินอลมาลง xserver-xephyr สำหรับรัน X อีกตัว และให้ scratchbox ติดต่อ และ
sake@cyberdora:~/project/Embeded/N770/maemosdk$ sudo apt-get install xserver-xephyr sake@cyberdora:~/project/Embeded/N770/maemosdk$ Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac
และเรียกสคริปที่ scratchbox ให้เริ่มทำงาน gui
[sbox-SDK_ARMEL:~] > export DISPLAY=:2 [sbox-SDK_ARMEL:~] > af-sb-init.sh start
ผลที่ได้

ในครั้งต่อไป เราจะมาติดตั้งฟอนต์และคีย์บอร์ดไทยกัน
อ้างอิง:
http://ianlawrence.info/random-stuff/maemo-3-1-bora-on-ubuntu-feisty









ความคิดเห็น
ไม่ทราบว่
ไม่ทราบว่า สงสัยตรงส่วนไหนครับ ถ้าตอบได้จะอธิบายให้ครับ
สอบถามเรื่อง nokia n770 พิมพ์ไทยอ่านไทยครับ
พอดีผมอ่านแล้ววิธีการติดตั้งแล้วยังงอยู่ครับ
แสดงความคิดเห็น