forked from usbarmory/usbarmory-debian-base_image
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
292 lines (264 loc) · 16.3 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
SHELL = /bin/bash
JOBS=2
LINUX_VER=5.4.31
LINUX_VER_MAJOR=${shell echo ${LINUX_VER} | cut -d '.' -f1,2}
KBUILD_BUILD_USER=usbarmory
KBUILD_BUILD_HOST=f-secure-foundry
LOCALVERSION=-0
UBOOT_VER=2019.07
ARMORYCTL_VER=1.0
APT_GPG_KEY=CEADE0CF01939B21
USBARMORY_REPO=https://raw.githubusercontent.com/f-secure-foundry/usbarmory/master
ARMORYCTL_REPO=https://github.com/f-secure-foundry/armoryctl
MXC_SCC2_REPO=https://github.com/f-secure-foundry/mxc-scc2
MXS_DCP_REPO=https://github.com/f-secure-foundry/mxs-dcp
CAAM_KEYBLOB_REPO=https://github.com/f-secure-foundry/caam-keyblob
IMG_VERSION=${V}-globaleaks-$(shell /bin/date -u "+%Y%m%d")
LOSETUP_DEV=$(shell /sbin/losetup -f)
.DEFAULT_GOAL := all
V ?= mark-two
BOOT ?= uSD
check_version:
@if test "${V}" = "mark-one"; then \
if test "${BOOT}" != "uSD"; then \
echo "invalid target, mark-one BOOT options are: uSD"; \
exit 1; \
elif test "${IMX}" != "imx53"; then \
echo "invalid target, mark-one IMX options are: imx53"; \
exit 1; \
fi \
elif test "${V}" = "mark-two"; then \
if test "${BOOT}" != "uSD" && test "${BOOT}" != eMMC; then \
echo "invalid target, mark-two BOOT options are: uSD, eMMC"; \
exit 1; \
elif test "${IMX}" != "imx6ul" && test "${IMX}" != "imx6ulz"; then \
echo "invalid target, mark-two IMX options are: imx6ul, imx6ulz"; \
exit 1; \
fi \
else \
echo "invalid target - V options are: mark-one, mark-two"; \
exit 1; \
fi
@echo "target: USB armory V=${V} IMX=${IMX} BOOT=${BOOT}"
usbarmory-${IMG_VERSION}.raw:
truncate -s 3500MiB usbarmory-${IMG_VERSION}.raw
sudo /sbin/parted usbarmory-${IMG_VERSION}.raw --script mklabel msdos
sudo /sbin/parted usbarmory-${IMG_VERSION}.raw --script mkpart primary ext4 5M 100%
debian: check_version usbarmory-${IMG_VERSION}.raw
sudo /sbin/losetup $(LOSETUP_DEV) usbarmory-${IMG_VERSION}.raw -o 5242880 --sizelimit 3500MiB
sudo /sbin/mkfs.ext4 -F $(LOSETUP_DEV)
sudo /sbin/losetup -d $(LOSETUP_DEV)
mkdir -p rootfs
sudo mount -o loop,offset=5242880 -t ext4 usbarmory-${IMG_VERSION}.raw rootfs/
sudo update-binfmts --enable qemu-arm
sudo qemu-debootstrap \
--include=ssh,sudo,ntpdate,fake-hwclock,openssl,vim,nano,cryptsetup,lvm2,locales,less,cpufrequtils,isc-dhcp-server,haveged,rng-tools,whois,iw,wpasupplicant,dbus,apt-transport-https,dirmngr,ca-certificates,u-boot-tools,mmc-utils,gnupg \
--arch=armhf buster rootfs http://ftp.debian.org/debian/
sudo install -m 755 -o root -g root conf/rc.local rootfs/etc/rc.local
sudo install -m 644 -o root -g root conf/sources.list rootfs/etc/apt/sources.list
sudo install -m 644 -o root -g root conf/dhcpd.conf rootfs/etc/dhcp/dhcpd.conf
sudo install -m 644 -o root -g root conf/usbarmory.conf rootfs/etc/modprobe.d/usbarmory.conf
sudo sed -i -e 's/INTERFACESv4=""/INTERFACESv4="usb0"/' rootfs/etc/default/isc-dhcp-server
echo "tmpfs /tmp tmpfs defaults 0 0" | sudo tee rootfs/etc/fstab
echo -e "\nUseDNS no" | sudo tee -a rootfs/etc/ssh/sshd_config
echo "nameserver 8.8.8.8" | sudo tee rootfs/etc/resolv.conf
sudo chroot rootfs systemctl mask getty-static.service
sudo chroot rootfs systemctl mask display-manager.service
sudo chroot rootfs systemctl mask hwclock-save.service
@if test "${V}" = "mark-one"; then \
sudo chroot rootfs systemctl mask rng-tools.service; \
fi
@if test "${V}" = "mark-two"; then \
sudo chroot rootfs systemctl mask haveged.service; \
fi
sudo wget https://keys.inversepath.com/gpg-andrej.asc -O rootfs/tmp/gpg-andrej.asc
sudo wget https://keys.inversepath.com/gpg-andrea.asc -O rootfs/tmp/gpg-andrea.asc
sudo wget https://deb.globaleaks.org/globaleaks.asc -O rootfs/tmp/gpg-globaleaks.asc
sudo chroot rootfs apt-key add /tmp/gpg-andrej.asc
sudo chroot rootfs apt-key add /tmp/gpg-andrea.asc
sudo chroot rootfs apt-key add /tmp/gpg-globaleaks.asc
echo "ledtrig_heartbeat" | sudo tee -a rootfs/etc/modules
echo "ci_hdrc_imx" | sudo tee -a rootfs/etc/modules
echo "g_ether" | sudo tee -a rootfs/etc/modules
echo "i2c-dev" | sudo tee -a rootfs/etc/modules
echo -e 'auto usb0\nallow-hotplug usb0\niface usb0 inet static\n address 10.0.0.1\n netmask 255.255.255.0\n gateway 10.0.0.2'| sudo tee -a rootfs/etc/network/interfaces
echo "usbarmory" | sudo tee rootfs/etc/hostname
echo "usbarmory ALL=(ALL) NOPASSWD: ALL" | sudo tee -a rootfs/etc/sudoers
echo -e "127.0.1.1\tusbarmory" | sudo tee -a rootfs/etc/hosts
sudo chroot rootfs /usr/sbin/useradd -s /bin/bash -p `sudo chroot rootfs mkpasswd -m sha-512 usbarmory` -m usbarmory
sudo rm rootfs/etc/ssh/ssh_host_*
sudo cp linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf.deb rootfs/tmp/
sudo chroot rootfs /usr/bin/dpkg -i /tmp/linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf.deb
sudo rm rootfs/tmp/linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf.deb
@if test "${V}" = "mark-two"; then \
sudo cp armoryctl_${ARMORYCTL_VER}_armhf.deb rootfs/tmp/; \
sudo chroot rootfs /usr/bin/dpkg -i /tmp/armoryctl_${ARMORYCTL_VER}_armhf.deb; \
sudo rm rootfs/tmp/armoryctl_${ARMORYCTL_VER}_armhf.deb; \
if test "${BOOT}" = "uSD"; then \
echo "/dev/mmcblk0 0x100000 0x2000 0x2000" | sudo tee rootfs/etc/fw_env.config; \
else \
echo "/dev/mmcblk1 0x100000 0x2000 0x2000" | sudo tee rootfs/etc/fw_env.config; \
fi \
fi
sudo chroot rootfs apt-get update
sudo chroot rootfs apt-get install globaleaks
sudo chroot rootfs apt-get clean
sudo chroot rootfs fake-hwclock
sudo rm rootfs/usr/bin/qemu-arm-static
sudo umount rootfs
linux-${LINUX_VER}.tar.xz:
wget https://www.kernel.org/pub/linux/kernel/v5.x/linux-${LINUX_VER}.tar.xz -O linux-${LINUX_VER}.tar.xz
wget https://www.kernel.org/pub/linux/kernel/v5.x/linux-${LINUX_VER}.tar.sign -O linux-${LINUX_VER}.tar.sign
u-boot-${UBOOT_VER}.tar.bz2:
wget ftp://ftp.denx.de/pub/u-boot/u-boot-${UBOOT_VER}.tar.bz2 -O u-boot-${UBOOT_VER}.tar.bz2
wget ftp://ftp.denx.de/pub/u-boot/u-boot-${UBOOT_VER}.tar.bz2.sig -O u-boot-${UBOOT_VER}.tar.bz2.sig
linux-${LINUX_VER}/arch/arm/boot/zImage: check_version linux-${LINUX_VER}.tar.xz
@if [ ! -d "linux-${LINUX_VER}" ]; then \
unxz --keep linux-${LINUX_VER}.tar.xz; \
gpg --verify linux-${LINUX_VER}.tar.sign; \
tar xf linux-${LINUX_VER}.tar && cd linux-${LINUX_VER}; \
fi
wget ${USBARMORY_REPO}/software/kernel_conf/${V}/usbarmory_linux-${LINUX_VER_MAJOR}.config -O linux-${LINUX_VER}/.config
if test "${V}" = "mark-two"; then \
wget ${USBARMORY_REPO}/software/kernel_conf/${V}/${IMX}-usbarmory.dts -O linux-${LINUX_VER}/arch/arm/boot/dts/${IMX}-usbarmory.dts; \
fi
cd linux-${LINUX_VER} && \
KBUILD_BUILD_USER=${KBUILD_BUILD_USER} \
KBUILD_BUILD_HOST=${KBUILD_BUILD_HOST} \
LOCALVERSION=${LOCALVERSION} \
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- \
make -j${JOBS} zImage modules ${IMX}-usbarmory.dtb
u-boot-${UBOOT_VER}/u-boot.bin: check_version u-boot-${UBOOT_VER}.tar.bz2
gpg --verify u-boot-${UBOOT_VER}.tar.bz2.sig
tar xf u-boot-${UBOOT_VER}.tar.bz2
cd u-boot-${UBOOT_VER} && make distclean
@if test "${V}" = "mark-one"; then \
cd u-boot-${UBOOT_VER} && make usbarmory_config; \
elif test "${V}" = "mark-two"; then \
cd u-boot-${UBOOT_VER} && \
wget ${USBARMORY_REPO}/software/u-boot/0001-ARM-mx6-add-support-for-USB-armory-Mk-II-board.patch && \
wget ${USBARMORY_REPO}/software/u-boot/0001-Drop-linker-generated-array-creation-when-CONFIG_CMD.patch && \
patch -p1 < 0001-ARM-mx6-add-support-for-USB-armory-Mk-II-board.patch && \
patch -p1 < 0001-Drop-linker-generated-array-creation-when-CONFIG_CMD.patch && \
make usbarmory-mark-two_defconfig; \
if test "${BOOT}" = "eMMC"; then \
sed -i -e 's/CONFIG_SYS_BOOT_DEV_MICROSD=y/# CONFIG_SYS_BOOT_DEV_MICROSD is not set/' .config; \
sed -i -e 's/# CONFIG_SYS_BOOT_DEV_EMMC is not set/CONFIG_SYS_BOOT_DEV_EMMC=y/' .config; \
fi \
fi
cd u-boot-${UBOOT_VER} && CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm make -j${JOBS}
mxc-scc2-master.zip: check_version
@if test "${IMX}" = "imx53"; then \
wget ${MXC_SCC2_REPO}/archive/master.zip -O mxc-scc2-master.zip && \
unzip -o mxc-scc2-master; \
fi
mxs-dcp-master.zip: check_version
@if test "${IMX}" = "imx6ulz"; then \
wget ${MXS_DCP_REPO}/archive/master.zip -O mxs-dcp-master.zip && \
unzip -o mxs-dcp-master; \
fi
caam-keyblob-master.zip: check_version
@if test "${IMX}" = "imx6ul"; then \
wget ${CAAM_KEYBLOB_REPO}/archive/master.zip -O caam-keyblob-master.zip && \
unzip -o caam-keyblob-master; \
fi
armoryctl-${ARMORYCTL_VER}.zip: check_version
@if test "${V}" = "mark-two"; then \
wget ${ARMORYCTL_REPO}/archive/v${ARMORYCTL_VER}.zip -O armoryctl-v${ARMORYCTL_VER}.zip && \
unzip -o armoryctl-v${ARMORYCTL_VER}.zip; \
fi
linux: linux-${LINUX_VER}/arch/arm/boot/zImage
mxc-scc2: mxc-scc2-master.zip linux
@if test "${IMX}" = "imx53"; then \
cd mxc-scc2-master && make KBUILD_BUILD_USER=${KBUILD_BUILD_USER} KBUILD_BUILD_HOST=${KBUILD_BUILD_HOST} ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- KERNEL_SRC=../linux-${LINUX_VER} -j${JOBS} all; \
fi
mxs-dcp: mxs-dcp-master.zip linux
@if test "${IMX}" = "imx6ulz"; then \
cd mxs-dcp-master && make KBUILD_BUILD_USER=${KBUILD_BUILD_USER} KBUILD_BUILD_HOST=${KBUILD_BUILD_HOST} ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- KERNEL_SRC=../linux-${LINUX_VER} -j${JOBS} all; \
fi
caam-keyblob: caam-keyblob-master.zip linux
@if test "${IMX}" = "imx6ul"; then \
cd caam-keyblob-master && make KBUILD_BUILD_USER=${KBUILD_BUILD_USER} KBUILD_BUILD_HOST=${KBUILD_BUILD_HOST} ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- KERNEL_SRC=../linux-${LINUX_VER} -j${JOBS} all; \
fi
armoryctl: armoryctl-${ARMORYCTL_VER}.zip
@if test "${V}" = "mark-two"; then \
cd armoryctl-${ARMORYCTL_VER} && GOPATH=/tmp/go GOARCH=arm make; \
fi
extra-dtb: check_version linux
@if test "${V}" = "mark-one"; then \
wget ${USBARMORY_REPO}/software/kernel_conf/${V}/usbarmory_linux-${LINUX_VER_MAJOR}.config -O linux-${LINUX_VER}/.config; \
wget ${USBARMORY_REPO}/software/kernel_conf/${V}/${IMX}-usbarmory-host.dts -O linux-${LINUX_VER}/arch/arm/boot/dts/${IMX}-usbarmory-host.dts; \
wget ${USBARMORY_REPO}/software/kernel_conf/${V}/${IMX}-usbarmory-gpio.dts -O linux-${LINUX_VER}/arch/arm/boot/dts/${IMX}-usbarmory-gpio.dts; \
wget ${USBARMORY_REPO}/software/kernel_conf/${V}/${IMX}-usbarmory-spi.dts -O linux-${LINUX_VER}/arch/arm/boot/dts/${IMX}-usbarmory-spi.dts; \
wget ${USBARMORY_REPO}/software/kernel_conf/${V}/${IMX}-usbarmory-i2c.dts -O linux-${LINUX_VER}/arch/arm/boot/dts/${IMX}-usbarmory-i2c.dts; \
wget ${USBARMORY_REPO}/software/kernel_conf/${V}/${IMX}-usbarmory-scc2.dts -O linux-${LINUX_VER}/arch/arm/boot/dts/${IMX}-usbarmory-scc2.dts; \
cd linux-${LINUX_VER} && KBUILD_BUILD_USER=${KBUILD_BUILD_USER} KBUILD_BUILD_HOST=${KBUILD_BUILD_HOST} LOCALVERSION=${LOCALVERSION} ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make -j${JOBS} ${IMX}-usbarmory-host.dtb ${IMX}-usbarmory-gpio.dtb ${IMX}-usbarmory-spi.dtb ${IMX}-usbarmory-i2c.dtb ${IMX}-usbarmory-scc2.dtb; \
fi
linux-deb: check_version linux extra-dtb mxc-scc2 mxs-dcp caam-keyblob
mkdir -p linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf/{DEBIAN,boot,lib/modules}
cat control_template_linux | \
sed -e 's/XXXX/${LINUX_VER_MAJOR}/' | \
sed -e 's/YYYY/${LINUX_VER}${LOCALVERSION}/' | \
sed -e 's/USB armory/USB armory ${V}/' \
> linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf/DEBIAN/control
@if test "${V}" = "mark-two"; then \
sed -i -e 's/${LINUX_VER_MAJOR}-usbarmory/${LINUX_VER_MAJOR}-usbarmory-mark-two/' \
linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf/DEBIAN/control; \
fi
cp -r linux-${LINUX_VER}/arch/arm/boot/zImage linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf/boot/zImage-${LINUX_VER}${LOCALVERSION}-usbarmory
cp -r linux-${LINUX_VER}/.config linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf/boot/config-${LINUX_VER}${LOCALVERSION}-usbarmory
cp -r linux-${LINUX_VER}/System.map linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf/boot/System.map-${LINUX_VER}${LOCALVERSION}-usbarmory
cd linux-${LINUX_VER} && make INSTALL_MOD_PATH=../linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf ARCH=arm modules_install
cp -r linux-${LINUX_VER}/arch/arm/boot/dts/${IMX}-usbarmory.dtb linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf/boot/${IMX}-usbarmory-default-${LINUX_VER}${LOCALVERSION}.dtb
@if test "${IMX}" = "imx53"; then \
cp -r linux-${LINUX_VER}/arch/arm/boot/dts/${IMX}-usbarmory-host.dtb linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf/boot/${IMX}-usbarmory-host-${LINUX_VER}${LOCALVERSION}.dtb; \
cp -r linux-${LINUX_VER}/arch/arm/boot/dts/${IMX}-usbarmory-spi.dtb linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf/boot/${IMX}-usbarmory-spi-${LINUX_VER}${LOCALVERSION}.dtb; \
cp -r linux-${LINUX_VER}/arch/arm/boot/dts/${IMX}-usbarmory-gpio.dtb linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf/boot/${IMX}-usbarmory-gpio-${LINUX_VER}${LOCALVERSION}.dtb; \
cp -r linux-${LINUX_VER}/arch/arm/boot/dts/${IMX}-usbarmory-i2c.dtb linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf/boot/${IMX}-usbarmory-i2c-${LINUX_VER}${LOCALVERSION}.dtb; \
cp -r linux-${LINUX_VER}/arch/arm/boot/dts/${IMX}-usbarmory-scc2.dtb linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf/boot/${IMX}-usbarmory-scc2-${LINUX_VER}${LOCALVERSION}.dtb; \
cd mxc-scc2-master && make INSTALL_MOD_PATH=../linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf ARCH=arm KERNEL_SRC=../linux-${LINUX_VER} modules_install; \
fi
@if test "${IMX}" = "imx6ulz"; then \
cd mxs-dcp-master && make INSTALL_MOD_PATH=../linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf ARCH=arm KERNEL_SRC=../linux-${LINUX_VER} modules_install; \
fi
@if test "${IMX}" = "imx6ul"; then \
cd caam-keyblob-master && make INSTALL_MOD_PATH=../linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf ARCH=arm KERNEL_SRC=../linux-${LINUX_VER} modules_install; \
fi
cd linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf/boot ; ln -sf zImage-${LINUX_VER}${LOCALVERSION}-usbarmory zImage
cd linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf/boot ; ln -sf ${IMX}-usbarmory-default-${LINUX_VER}${LOCALVERSION}.dtb ${IMX}-usbarmory.dtb
cd linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf/boot ; ln -sf ${IMX}-usbarmory.dtb imx6ull-usbarmory.dtb
rm linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf/lib/modules/${LINUX_VER}${LOCALVERSION}/{build,source}
chmod 755 linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf/DEBIAN
fakeroot dpkg-deb -b linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf.deb
armoryctl-deb: check_version armoryctl
mkdir -p armoryctl_${ARMORYCTL_VER}_armhf/{DEBIAN,sbin}
cat control_template_armoryctl | \
sed -e 's/YYYY/${ARMORYCTL_VER}/' \
> armoryctl_${ARMORYCTL_VER}_armhf/DEBIAN/control
cp -r armoryctl-${ARMORYCTL_VER}/armoryctl armoryctl_${ARMORYCTL_VER}_armhf/sbin
chmod 755 armoryctl_${ARMORYCTL_VER}_armhf/DEBIAN
fakeroot dpkg-deb -b armoryctl_${ARMORYCTL_VER}_armhf armoryctl_${ARMORYCTL_VER}_armhf.deb
u-boot: u-boot-${UBOOT_VER}/u-boot.bin
finalize: usbarmory-${IMG_VERSION}.raw u-boot-${UBOOT_VER}/u-boot.bin
@if test "${V}" = "mark-one"; then \
sudo dd if=u-boot-${UBOOT_VER}/u-boot.imx of=usbarmory-${IMG_VERSION}.raw bs=512 seek=2 conv=fsync conv=notrunc; \
elif test "${V}" = "mark-two"; then \
sudo dd if=u-boot-${UBOOT_VER}/u-boot-dtb.imx of=usbarmory-${IMG_VERSION}.raw bs=512 seek=2 conv=fsync conv=notrunc; \
fi
compress:
xz -k usbarmory-${IMG_VERSION}.raw
zip -j usbarmory-${IMG_VERSION}.raw.zip usbarmory-${IMG_VERSION}.raw
ifeq ($(V),mark-two)
all: check_version armoryctl-deb linux-deb debian u-boot finalize
else
all: check_version linux-deb debian u-boot finalize
endif
clean: check_version
-rm -fr linux-${LINUX_VER}*
-rm -fr u-boot-${UBOOT_VER}*
-rm -fr linux-image-${LINUX_VER_MAJOR}-usbarmory-${V}_${LINUX_VER}${LOCALVERSION}_armhf*
-rm -fr armoryctl*
-rm -fr mxc-scc2-master* mxs-dcp-master* caam-keyblob-master*
-rm -f usbarmory-${V}-debian_buster-base_image-*.raw
-sudo umount -f rootfs
-rmdir rootfs