掌機 - Pandora(1GHz) - Debian(Mark2) - 架設ScratchBox環境



製作方式就是從SuperZaxxon系統複製檔案,然後再進行客制化,步驟如下:

$ su
# apt-get install mtd-utils
# ubiattach -m 4 -d 0
# mount -t ubifs /dev/ubi0_0 /mnt
# ubiattach -m 3 -d 1
# mount -t ubifs /dev/ubi1_0 /mnt/boot
# cp -a /mnt /sbox
# chown xxx:xxx /sbox
# ubidetach -m 3
# ubidetach -m 4
# umount /mnt/boot
# umount /mnt

P.S. xxx是使用者名字

/sbox/login.sh

#!/bin/sh
if [ `whoami` != "root" ];then
    echo "Run me as root"
    exit 1
fi

MYPATH=`dirname $0`
mount -o bind /proc "$MYPATH/proc"
mount -o bind /sys "$MYPATH/sys"
mount -o bind /dev "$MYPATH/dev"
mount -o bind /dev/pts "$MYPATH/dev/pts"
chroot "$MYPATH" /bin/bash -c 'su - xxx'
umount "$MYPATH/dev/pts"
umount "$MYPATH/dev"
umount "$MYPATH/sys"
umount "$MYPATH/proc"

P.S. xxx是使用者名字

接著就可以login並開始安裝套件,打照一個簡單的開發環境

$ sudo /sbox/login
sbox:~$ sudo vim /etc/resolv.conf
  nameserver 8.8.8.8

sbox:~$ sudo opkg update
sbox:~$ sudo opkg install gcc gcc-symlinks make binutils-dev cpp cpp-symlinks 
sbox:~$ sudo opkg install g++ g++-symlinks libstdc++-dev git u-boot-mkimage
sbox:~$ sudo opkg install libsdl-1.2-dev libsdl-image-1.2-dev libsdl-gfx-dev libsdl-net-1.2-dev libsdl-ttf-2.0-dev libgles-omap3-dev