forked from Maccraft123/Cadmium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-all
executable file
·63 lines (43 loc) · 1.33 KB
/
build-all
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
CADMIUMROOT=$(dirname $(realpath $0))
. $CADMIUMROOT/config
. $CADMIUMROOT/board/$TARGET/boardinfo
. $CADMIUMROOT/baseboard/$BASEBOARD/boardinfo
set -e
sleep 1 # let's give user time if they commit a typo
# Usage:
# build-all <device>
# build-all <file> <size>
[ -z "$1" ] && exit 1
[ $IN_RAM = true -a -z "$2" ] && exit 2
if [ -n "$2" ]; then
echo "Warning,"
echo "Running $0 like that is not recommended"
echo "Consider $0 /dev/sdX"
sleep 2
fi
umount $CADMIUMROOT/tmp 2>/dev/null || true
if [ $IN_RAM = true ]; then
mount -t tmpfs tmpfs $CADMIUMROOT/tmp
fi
# it deals with env vars
source $CADMIUMROOT/bootfw/$BOOTFW/prepare_parts
# build, package and write kernel
$CADMIUMROOT/kernel/build
# write filesystem
$CADMIUMROOT/fs/build $ROOTPART
$CADMIUMROOT/bootfw/$BOOTFW/package $DEVICE $ROOTPART
dd if=$CADMIUMROOT/tmp/linux-$BASEBOARD/vmlinux.kpart of=$KERNPART
# can't be done in fs/build
if [ $B_OXIDE = 1 ]; then
cp $CADMIUMROOT/tmp/oxide.kpart $CADMIUMROOT/tmp/root/
fi
# install modules
make -C $CADMIUMROOT/tmp/linux-$BASEBOARD INSTALL_MOD_PATH=$CADMIUMROOT/tmp/root modules_install
# we don't umount it in fs/build
umount $CADMIUMROOT/tmp/root
# yes, this fails when device is pendrive or sth
losetup -d $DEVICE 2>/dev/null || true
sync
echo "Done!"
[ $IN_RAM = true ] && echo "Don't forget to umount $CADMIUMROOT/tmp"