-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (88 loc) · 3.58 KB
/
Makefile
File metadata and controls
99 lines (88 loc) · 3.58 KB
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
help:
@echo "make setup"
@echo " installs ubuntu-image"
@echo "make red"
@echo " build tinyos.red.img for tinybox red"
@echo "make green"
@echo " build tinyos.green.img for tinybox green"
@echo "make core"
@echo " build tinyos.core.img for tinybox core"
@echo "make all"
@echo " build all images"
@echo "make red-dev"
@echo " build tinyos.red.img development image for tinybox red"
@echo "make green-dev"
@echo " build tinyos.green.img development image for tinybox green"
@echo "make core-dev"
@echo " build tinyos.core.img development image for tinybox core"
@echo "make clean"
@echo " clean up"
setup:
sudo snap install ubuntu-image --classic --edge
clean:
rm -f tinyos.yaml build/tinybox-release
sudo umount -f result/chroot/sys/firmware/efi/efivars || true
sudo umount -f result/chroot/proc result/chroot/sys result/chroot/dev/pts result/chroot/dev || true
# ensure that nothing is still mounted when we do this
(mount | grep result/chroot) && echo "ERROR: something is still mounted" && exit 1 || true
sudo rm -rf result
red: setup
sed 's/<|ARTIFACT_NAME|>/tinyos.red.img/g' tinyos.template.yaml > tinyos.yaml
sed -i 's/<|UBUNTU_SERIES|>/noble/g' tinyos.yaml
sed -i 's/<|UBUNTU_VERSION|>/24.04/g' tinyos.yaml
echo "TINYBOX_COLOR=red" | tee --append build/tinybox-release
time make image
green: setup
sed 's/<|ARTIFACT_NAME|>/tinyos.green.img/g' tinyos.template.yaml > tinyos.yaml
sed -i 's/<|UBUNTU_SERIES|>/noble/g' tinyos.yaml
sed -i 's/<|UBUNTU_VERSION|>/24.04/g' tinyos.yaml
echo "TINYBOX_COLOR=green" | tee --append build/tinybox-release
time make image
core: setup
sed 's/<|ARTIFACT_NAME|>/tinyos.core.img/g' tinyos.template.yaml > tinyos.yaml
sed -i 's/<|UBUNTU_SERIES|>/noble/g' tinyos.yaml
sed -i 's/<|UBUNTU_VERSION|>/24.04/g' tinyos.yaml
echo "TINYBOX_COLOR=core" | tee --append build/tinybox-release
echo "TINYBOX_CORE=1" | tee --append build/tinybox-release
time make image
all:
mkdir -p outputs
make red
cp result/tinyos.red.img outputs/tinyos.red.img
make clean
make green
cp result/tinyos.green.img outputs/tinyos.green.img
make clean
make core
cp result/tinyos.core.img outputs/tinyos.core.img
make clean
red-dev: setup
echo "TINYBOX_DEV=1" | tee --append build/tinybox-release
make red
green-dev: setup
echo "TINYBOX_DEV=1" | tee --append build/tinybox-release
make green
core-dev: setup
echo "TINYBOX_DEV=1" | tee --append build/tinybox-release
make core
image:
sed -i 's/<|CURRENT_DIR|>/$(shell pwd | sed 's/\//\\\//g')/g' tinyos.yaml
# build up till manual customization
sudo ubuntu-image classic --debug -w result -u perform_manual_customization tinyos.yaml
# we want to do manual customization but in a more unrestricted way
# so we want more things to be available inside the chroot
sudo mkdir -p result/chroot/proc result/chroot/sys result/chroot/dev/pts
sudo mount -t proc none result/chroot/proc
sudo mount -t sysfs none result/chroot/sys
sudo mount -o bind /dev result/chroot/dev
sudo mount -t devpts none result/chroot/dev/pts
# now we can do manual customization
sudo ubuntu-image classic --debug -w result -r -t perform_manual_customization tinyos.yaml
# cleanup so that ubuntu-image can unchroot cleanly
sudo umount -f result/chroot/sys/firmware/efi/efivars
sudo umount -f result/chroot/proc result/chroot/sys result/chroot/dev/pts result/chroot/dev
# now we can let ubuntu-image finish the image build
sudo ubuntu-image classic --debug -w result -r tinyos.yaml
# final cleanup
rm -f tinyos.yaml build/tinybox-release
.PHONY: setup clean red green core all red-dev green-dev core-dev image