-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·56 lines (43 loc) · 1.27 KB
/
build.sh
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
#!/bin/bash
#### Root check
if (( $EUID != 0 )); then
echo "Please run build process as root!"
exit
fi
#### Building core filesystem
rm -rf rfs
debootstrap --arch=armhf --foreign --variant=minbase --include=console-setup,keyboard-configuration trusty rfs
cd rfs
cp /usr/bin/qemu-arm-static usr/bin
chroot . /debootstrap/debootstrap --second-stage
#### Configuring APT for low-storage device
cat <<'EOF' > etc/apt/sources.list
deb http://ports.ubuntu.com/ubuntu-ports trusty main universe
deb http://ports.ubuntu.com/ubuntu-ports trusty-updates main universe
deb http://ports.ubuntu.com/ubuntu-ports trusty-security main universe
EOF
#### Preparing for changing environment
mount -t proc proc proc
mount -t sysfs sysfs sys
mount --bind /dev dev
cp -av ../patch tmp/
cp ../linux-image-3.0.27-1-ac100_3.0.27-1.1_armhf.deb tmp/
cp ../third-stage.sh tmp/third-stage.sh
chmod +x tmp/third-stage.sh
chroot . /tmp/third-stage.sh
#### Housekeeping
umount -l proc
umount -l sys
umount -l dev
rm -rf var/lib/apt/lists/*
rm -rf tmp/*
rm -rf usr/bin/qemu-arm-static
rm -rf root/.bash_history
#### Creating final package
rm -rf ../rootfs.tgz
tar -czvpf ../rootfs.tgz .
echo "Done."
cd ..
rm -rf rfs
exit
#### Now boot SOS environment, erase part 4 and 7, extract filesystem and flash kernel image