1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
#!/bin/sh -e
function error_not_inside_sb2()
{
echo "SB2: This script can only be used from inside"
echo "the scratchbox 2'ed environment"
exit 1
}
if [ -z "$SBOX_SESSION_DIR" ]
then
error_not_inside_sb2
fi
. $SBOX_SESSION_DIR/sb2-session.conf
. ~/.scratchbox2/config
[ ! -z "$sbox_target" ] || sbox_target=$DEFAULT_TARGET
. ~/.scratchbox2/$sbox_target/sb2.config
# ------------
# FIXME: / LTA 2008-09-18:
# Export variables from sb2.config; These used to be exported from sb2.config,
# but the export statements were moved out from the config file.
# I'm not sure how many of these are really needed by this script.
export SBOX_CONFIG_VERSION
export DEB_BUILD_ARCH
export DEB_BUILD_ARCH_CPU
export DEB_BUILD_ARCH_ABI
export DEB_BUILD_GNU_CPU
export DEB_BUILD_GNU_TYPE
export DEB_BUILD_GNU_SYSTEM
export DEB_HOST_ARCH
export DEB_HOST_ARCH_OS
export DEB_HOST_ARCH_CPU
export DEB_HOST_GNU_CPU
export DEB_HOST_GNU_TYPE
export DEB_HOST_GNU_SYSTEM
export LD_LIBRARY_PATH
# ------------
export COMPILER=$SBOX_CROSS_GCC_DIR/$SBOX_CROSS_GCC_SUBST_PREFIX
# uh evil hack sb2 need --copy-clibrary
for linker in $(find $SBOX_CROSS_GCC_DIR/.. -name 'ld-linux.so*'); do
export LIBCDIR=`dirname $linker`
done
if [ -z "$LIBCDIR" ]; then
echo "could not find libc!"
exit 2;
fi
[ ! -z "$K_COMPILER" ] || export K_COMPILER=$COMPILER
rm -rf builddir/*
mkdir -p builddir/.downloads
cd builddir/.downloads
[ -r busybox-1.9.0.tar.bz2 ] || wget http://www.busybox.net/downloads/busybox-1.9.0.tar.bz2
[ -r linux-2.6.23.13.tar.bz2 ] || wget http://ftp.fi.kernel.org/pub/linux/kernel/v2.6/linux-2.6.23.13.tar.bz2
[ -r sbrsh_7.6.tar.gz ] || wget http://ftp.fi.debian.org/debian/pool/main/s/sbrsh/sbrsh_7.6.tar.gz
cd ..
tar xjf .downloads/busybox-1.9.0.tar.bz2
tar xjf .downloads/linux-2.6.23.13.tar.bz2
tar xzf .downloads/sbrsh_7.6.tar.gz
cd linux-2.6*
if [ -r ../.downloads/.config ]; then
cp ../.downloads/.config .
ARCH=arm CROSS_COMPILE=$K_COMPILER make oldconfig
else
ARCH=arm CROSS_COMPILE=$K_COMPILER make realview_defconfig
echo make sure you have initrd support
echo add eabi support
echo add tmpfs support
echo add loopback mount support
echo ok? - press enter to continue
read
ARCH=arm CROSS_COMPILE=$K_COMPILER make menuconfig
cp .config ../.downloads/
fi
ARCH=arm CROSS_COMPILE=$K_COMPILER make
cp arch/arm/boot/zImage ..
cd ..
cd busybox-*
ARCH=arm CROSS_COMPILE=$COMPILER make defconfig
ARCH=arm CROSS_COMPILE=$COMPILER make
ARCH=arm CROSS_COMPILE=$COMPILER make install
cp -a _install/ ../initramfs
cd ..
cd sbrsh-*
make CC=${COMPILER}gcc
cd ..
mkdir -p initramfs/{boot,etc,proc,sys,mnt,sbin,dev,lib,usr/bin,tmp}
cp $LIBCDIR/* initramfs/lib/
cp sbrsh-7.6/optimize/bin/sbrshd initramfs/sbin/
echo '*' > initramfs/etc/sbrshd.conf
cat > initramfs/init <<EOF
#!/bin/sh
echo "Loading, please wait..."
mount -t proc proc /proc
mount -t sysfs sysfs /sys
ifconfig eth0 10.0.2.15 netmask 255.255.255.0 up
ifconfig lo 127.0.0.1 netmask 255.0.0.0 up
route add default gw 10.0.2.2
# The daily WTF: qemu enables networking only after guest
# communicates to you
ping -c 3 10.0.2.2
# The daily WTF #2: binmounts fail if mount source dir
# is initramfs
cp -a /dev /dev2
mount -t ramfs ramfs /dev
mv /dev2/* /dev
mount -t devpts devpts /dev/pts
mount -t sysfs sysfs /sys
mount -t ramfs ramfs /tmp
chmod a+rwx /tmp
/sbin/sbrshd
/bin/sh </dev/console >/dev/console
EOF
chmod a+x initramfs/init
chmod a+x initramfs/lib/ld-linux*
fakeroot sb2-mkinitramfs initramfs initramfs.gz
echo Add following in your /etc/exports
echo
echo "$HOME 127.0.0.1(rw,all_squash,anonuid=$UID,anongid=$UID,sync,insecure)"
echo
echo for sbox target config:
echo
echo "sb2-init -sn -r 127.0.0.1 -l 10.0.2.2 -c sbrsh MAEMO $COMPILER"
|