-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (70 loc) · 2.43 KB
/
Makefile
File metadata and controls
88 lines (70 loc) · 2.43 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
# Makefile for bananian (installer)
OUTPUTS = initrd.img boot.img debroot debroot.tar
# Pass USE_QEMU=1 to the make command to bootstrap on the build machine
USE_QEMU = 0
ifeq ($(USE_QEMU),1)
ONDEV_BOOTSTRAP_CMD =
USE_QEMU_INSTALL = qemu-install
else
ONDEV_BOOTSTRAP_CMD = adb shell /data/bootstrap-debian.sh
USE_QEMU_INSTALL =
endif
DEFAULT_PACKAGES = openssh-server,vim,wpasupplicant,man-db,busybox,sudo,$(EXTRA_PACKAGES)
all: check $(OUTPUTS)
VERSION=$(shell git describe --tags --abbrev=0)
export VERSION
DEBS = bananui-base_$(VERSION)_armhf.deb device-startup_$(VERSION)_all.deb
getversion:
@echo "$(VERSION)"
check::
@scripts/check packages bananui-base device-startup
@scripts/check root
@scripts/check deps
@scripts/check gcc
bananui-base_$(VERSION)_armhf.deb: bananui-base
echo "$(VERSION)" > bananui-base/.version
(cd bananui-base; debuild --no-lintian -us -uc -aarmhf)
device-startup_$(VERSION)_all.deb: device-startup
(cd device-startup; debuild --no-lintian -us -uc -aarmhf)
package-%: %
(cd $^; debuild --no-lintian -us -uc -aarmhf)
initrd.img: ramdisk
rm -f $@
scripts/pack-initrd $@ $<
boot.img: initrd.img zImage bootimg.cfg
abootimg --create $@ -f bootimg.cfg -k zImage -r $<
debroot:
rm -rf debroot
debootstrap --include=$(DEFAULT_PACKAGES) --arch armhf --foreign \
buster debroot/ $(MIRROR) || rm -rf debroot
copy-files: $(DEBS) modules
[ ! -f debroot/etc/wpa_supplicant.conf ] && \
echo 'network={' >> debroot/etc/wpa_supplicant.conf && \
echo ' ssid="SSID"' >> debroot/etc/wpa_supplicant.conf && \
echo ' psk="PSK"' >> debroot/etc/wpa_supplicant.conf && \
echo '}' >> debroot/etc/wpa_supplicant.conf
editor debroot/etc/wpa_supplicant.conf
mkdir -p debroot/lib/modules/
rm -rf debroot/lib/modules/3.10.49-bananian+
cp -rf modules debroot/lib/modules/3.10.49-bananian+
cp -f $(DEBS) debroot/var/cache
ifeq ($(USE_QEMU),1)
qemu-install: debroot copy-files
scripts/qemubootstrap
endif
debroot.tar: debroot copy-files $(USE_QEMU_INSTALL)
rm -f $@
(cd debroot; tar cvf ../$@ --exclude=.gitignore *)
@echo "Now you can execute the commands from README.md."
install-to-device: all
adb wait-for-device
adb push debroot.tar /data
adb push boot.img /data
adb push on-device-scripts/*.sh /data
adb shell /data/install-bootimage.sh
adb shell /data/unpack-debian.sh
$(ONDEV_BOOTSTRAP_CMD)
adb shell rm /data/install-bootimage.sh /data/unpack-debian.sh \
/data/bootstrap-debian.sh
clean:
rm -rf *.deb $(OUTPUTS)