forked from ivandavidov/minimal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
145 lines (135 loc) · 4.38 KB
/
Makefile
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# This is very simple Makefile which encapsulates the build
# process of 'Minimal Linux Live'. Type the following command
# for additional information:
#
# make help
.DEFAULT_GOAL := help
all: clean
@{ \
echo "Launching the main build script." ; \
/usr/bin/time -f "\n Elapsed time: %E" ./build_minimal_linux_live.sh 2>&1 | tee minimal_linux_live.log ; \
echo "" ; \
}
clean:
@{ \
echo "Removing generated work artifacts." ; \
rm -rf work ; \
echo "Removing generated build artifacts." ; \
rm -f minimal_linux_live.iso ; \
rm -f mll_image.tgz ; \
USE_PREDEFINED_KERNEL_CONFIG=`grep -i ^USE_PREDEFINED_KERNEL_CONFIG= .config | cut -f2- -d'=' | xargs` ; \
if [ ! "$$USE_PREDEFINED_KERNEL_CONFIG" = "true" ] ; then \
echo "Removing predefined Linux kernel config file." ; \
rm -rf minimal_overlay/kernel.config ; \
else \
echo "Local Linux kernel config file is preserved." ; \
fi ; \
USE_PREDEFINED_BUSYBOX_CONFIG=`grep -i ^USE_PREDEFINED_BUSYBOX_CONFIG= .config | cut -f2- -d'=' | xargs` ; \
if [ ! "$$USE_PREDEFINED_BUSYBOX_CONFIG" = "true" ] ; then \
echo "Removing predefined Busybox config file." ; \
rm -rf minimal_overlay/busybox.config ; \
else \
echo "Local Busybox config file is preserved." ; \
fi ; \
echo "Removing source level overlay software." ; \
mv -f minimal_overlay/rootfs/README /tmp/mll_overlay_readme ; \
cd minimal_overlay/rootfs ; \
rm -rf * ; \
cd ../.. ; \
mv -f /tmp/mll_overlay_readme minimal_overlay/rootfs/README ; \
echo "Removing build log file." ; \
rm -f minimal_linux_live.log ; \
USE_LOCAL_SOURCE=`grep -i ^USE_LOCAL_SOURCE= .config | cut -f2- -d'=' | xargs` ; \
if [ ! "$$USE_LOCAL_SOURCE" = "true" ] ; then \
echo "Removing local source files." ; \
rm -rf source ; \
else \
echo "Local sources are preserved." ; \
fi ; \
}
qemu-bios:
@{ \
if [ ! -f ./minimal_linux_live.iso ] ; then \
echo "" ; \
echo " ERROR: ISO image 'minimal_linux_live.iso' not found." ; \
echo "" ; \
exit 1 ; \
fi ; \
echo "Launching QEMU in BIOS mode." ; \
./qemu-bios.sh ; \
}
qemu-uefi:
@{ \
if [ ! -f ./minimal_linux_live.iso ] ; then \
echo "" ; \
echo " ERROR: ISO image 'minimal_linux_live.iso' not found." ; \
echo "" ; \
exit 1 ; \
fi ; \
echo "Launching QEMU in UEFI mode." ; \
./qemu-uefi.sh ; \
}
src:
@{ \
echo "Generating source archive." ; \
rm -f minimal_linux_live_*_src.tar.xz ; \
cd minimal_overlay ; \
./overlay_build.sh mll_source 1>/dev/null ; \
cd .. ; \
cp work/overlay/mll_source/*.tar.xz . ; \
echo "Source archive is '`ls minimal_linux_live_*_src.tar.xz`'." ; \
}
release: src
@{ \
echo "Removing old work artifacts." ; \
rm -rf /tmp/mll_release ; \
mkdir -p /tmp/mll_release ; \
echo "Preparing MLL source tree." ; \
cp minimal_linux_live_*_src.tar.xz /tmp/mll_release ; \
cd /tmp/mll_release ; \
tar -xf minimal_linux_live_*_src.tar.xz ; \
cd /tmp/mll_release/minimal_linux_live_*/ ; \
echo "Launching the main build script." ; \
/usr/bin/time -f "\n Elapsed time: %E" ./build_minimal_linux_live.sh 2>&1 | tee minimal_linux_live.log ; \
echo "" ; \
echo " Check the directory '/tmp/mll_release'." ; \
echo "" ; \
}
release2:
@{ \
echo "Removing old work artifacts." ; \
rm -rf /tmp/mll_release2 ; \
mkdir -p /tmp/mll_release2 ; \
cd /tmp/mll_release2 ; \
echo "Cloning the project repository." ; \
git clone http://github.com/ivandavidov/minimal ; \
cd minimal/src ; \
echo "Ready to generate release." ; \
make release ; \
}
test:
@{ \
echo "" ; \
echo " This target is reserved for local tests." ; \
echo "" ; \
}
help:
@{ \
echo "" ; \
echo " make all - clean the workspace and then generate 'minimal_linux_live.iso'." ; \
echo "" ; \
echo " make clean - remove all generated files." ; \
echo "" ; \
echo " make help - this is the default target." ; \
echo "" ; \
echo " make release - generate clean source tree in '/tmp/mll_release' and build MLL there." ; \
echo "" ; \
echo " make release2 - clone the project repository and execute 'make release' from it." ; \
echo "" ; \
echo " make src - generate 'tar.xz' source archive." ; \
echo "" ; \
echo " make qemu-bios - run 'Minimal Linux Live' in QEMU with legacy BIOS compatibility." ; \
echo "" ; \
echo " make qemu-uefi - run 'Minimal Linux Live' in QEMU with UEFI compatibility." ; \
echo "" ; \
}