-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_archlinux_cubox.sh
executable file
·63 lines (49 loc) · 1.19 KB
/
install_archlinux_cubox.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
57
58
59
60
61
62
63
#!/bin/bash
device=$1
image="ArchLinuxARM-imx6-cubox-latest.tar.gz"
if [ -z "${device}" ]; then
echo "Please define device name"
echo "Usage:"
echo " $0 <device>"
echo
echo "Example:"
echo " $0 sdb"
exit 1
fi
echo
echo "Going to install ArchLinux (CuBox-i) on device '/dev/${device}'"
echo
fdisk -l /dev/${device}
echo
echo "All data on this device will be lost!"
echo -n "Do you want to continue? (y/N): "
read confirm
if [ ! "${confirm}" = "y" ]; then
echo "-- interrupted --"
exit 2
fi
echo
if [ ! -f "${image}" ]; then
echo "Downloading latest CuBox image..."
wget http://os.archlinuxarm.org/os/${image}
fi
echo "Preparing device..."
umount /dev/${device}1
dd if=/dev/zero of=/dev/${device} bs=1M count=4
echo
echo
echo "Manually perform following steps:"
echo " 1. Type 'n', and press ENTER, accepting default values."
echo " 2. Type 'w' to write changes and exit."
fdisk /dev/${device}
mkfs.ext4 /dev/${device}1
mkdir -p root
mount /dev/${device}1 root
bsdtar -xpf ${image} -C root
echo "Installing U-Boot bootloader..."
dd if=root/boot/SPL of=/dev/${device} bs=1K seek=1
dd if=root/boot/u-boot.img of=/dev/${device} bs=1K seek=69
echo "Syncing..."
sync
umount root
echo "Done!"