-
Notifications
You must be signed in to change notification settings - Fork 60
/
Makefile
387 lines (310 loc) · 15.2 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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# Thingino Firmware
# https://github.com/themactep/thingino-firmware
ifeq ($(__BASH_MAKE_COMPLETION__),1)
exit
endif
ifneq ($(shell command -v gawk >/dev/null; echo $$?),0)
$(error Please run `make bootstrap` to install prerequisites.)
endif
ifneq ($(findstring $(empty) $(empty),$(CURDIR)),)
$(error Current directory path "$(CURDIR)" contains spaces. Please remove spaces from the path and try again.)
endif
# Camera IP address
# shortened to just IP for convenience of running from command line
IP ?= 192.168.1.10
CAMERA_IP_ADDRESS = $(IP)
# Device of SD card
SDCARD_DEVICE ?= /dev/sdf
# TFTP server IP address to upload compiled images to
TFTP_IP_ADDRESS ?= 192.168.1.254
# Buildroot downloads directory
# can be reused from environment, just export the value:
# export BR2_DL_DIR = /path/to/your/local/storage
BR2_DL_DIR ?= $(HOME)/dl
# directory for extracting Buildroot sources
SRC_DIR ?= $(HOME)/src
# working directory
OUTPUT_DIR ?= $(HOME)/output/$(CAMERA)
STDOUT_LOG ?= $(OUTPUT_DIR)/compilation.log
STDERR_LOG ?= $(OUTPUT_DIR)/compilation-errors.log
# project directories
BR2_EXTERNAL := $(CURDIR)
SCRIPTS_DIR := $(BR2_EXTERNAL)/scripts
# make command for buildroot
BR2_MAKE = $(MAKE) -C $(BR2_EXTERNAL)/buildroot BR2_EXTERNAL=$(BR2_EXTERNAL) O=$(OUTPUT_DIR)
# handle the board
include $(BR2_EXTERNAL)/board.mk
# include device tree makefile
include $(BR2_EXTERNAL)/external.mk
# hardcoded variables
WGET := wget --quiet --no-verbose --retry-connrefused --continue --timeout=5
ifeq ($(shell command -v figlet),)
FIGLET := echo
else
FIGLET := $(shell command -v figlet) -t -f pagga
endif
U_BOOT_GITHUB_URL := https://github.com/gtxaspec/u-boot-ingenic/releases/download/latest
U_BOOT_ENV_FINAL_TXT = $(OUTPUT_DIR)/target/etc/uenv.txt
ifeq ($(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME),)
U_BOOT_BIN = $(OUTPUT_DIR)/images/u-boot-lzo-with-spl.bin
else
U_BOOT_BIN = $(OUTPUT_DIR)/images/$(patsubst "%",%,$(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME))
endif
U_BOOT_ENV_BIN = $(OUTPUT_DIR)/images/uenv.bin
KERNEL_BIN := $(OUTPUT_DIR)/images/uImage
ROOTFS_BIN := $(OUTPUT_DIR)/images/rootfs.squashfs
ROOTFS_TAR := $(OUTPUT_DIR)/images/rootfs.tar
OVERLAY_BIN := $(OUTPUT_DIR)/images/overlay.jffs2
# 0x0010000, 64K, 65_536
ALIGN_BLOCK := 65536
# 0x0008000, 32K, 32_768
# ALIGN_BLOCK := 32768
# create a full binary file suffixed with the time of the last modification to either uboot, kernel, or rootfs
FIRMWARE_NAME_FULL = thingino-$(CAMERA).bin
FIRMWARE_NAME_NOBOOT = thingino-$(CAMERA)-update.bin
FIRMWARE_BIN_FULL := $(OUTPUT_DIR)/images/$(FIRMWARE_NAME_FULL)
FIRMWARE_BIN_NOBOOT := $(OUTPUT_DIR)/images/$(FIRMWARE_NAME_NOBOOT)
# file sizes
U_BOOT_BIN_SIZE = $(shell stat -c%s $(U_BOOT_BIN))
U_BOOT_ENV_BIN_SIZE = $(shell stat -c%s $(U_BOOT_ENV_BIN))
KERNEL_BIN_SIZE = $(shell stat -c%s $(KERNEL_BIN))
ROOTFS_BIN_SIZE = $(shell stat -c%s $(ROOTFS_BIN))
OVERLAY_BIN_SIZE = $(shell stat -c%s $(OVERLAY_BIN))
FIRMWARE_BIN_FULL_SIZE = $(shell stat -c%s $(FIRMWARE_BIN_FULL))
FIRMWARE_BIN_NOBOOT_SIZE = $(shell stat -c%s $(FIRMWARE_BIN_NOBOOT))
U_BOOT_BIN_SIZE_ALIGNED = $(shell echo $$((($(U_BOOT_BIN_SIZE) / $(ALIGN_BLOCK) + 1) * $(ALIGN_BLOCK))))
KERNEL_BIN_SIZE_ALIGNED = $(shell echo $$((($(KERNEL_BIN_SIZE) / $(ALIGN_BLOCK) + 1) * $(ALIGN_BLOCK))))
ROOTFS_BIN_SIZE_ALIGNED = $(shell echo $$((($(ROOTFS_BIN_SIZE) / $(ALIGN_BLOCK) + 1) * $(ALIGN_BLOCK))))
OVERLAY_BIN_SIZE_ALIGNED = $(shell echo $$((($(OVERLAY_BIN_SIZE) / $(ALIGN_BLOCK) + 1) * $(ALIGN_BLOCK))))
# fixed size partitions
U_BOOT_PARTITION_SIZE := 262144
U_BOOT_ENV_PARTITION_SIZE := 65536
KERNEL_PARTITION_SIZE = $(KERNEL_BIN_SIZE_ALIGNED)
ROOTFS_PARTITION_SIZE = $(ROOTFS_BIN_SIZE_ALIGNED)
FIRMWARE_FULL_SIZE = $(FLASH_SIZE)
FIRMWARE_NOBOOT_SIZE = $(shell echo $$(($(FLASH_SIZE) - $(U_BOOT_PARTITION_SIZE) - $(U_BOOT_ENV_PARTITION_SIZE))))
# dynamic partitions
OVERLAY_SIZE = $(shell echo $$(($(FLASH_SIZE) - $(OVERLAY_OFFSET))))
OVERLAY_SIZE_NOBOOT = $(shell echo $$(($(FIRMWARE_NOBOOT_SIZE) - $(OVERLAY_OFFSET_NOBOOT))))
OVERLAY_MINUMUM_SIZE := 131072
# partition offsets
U_BOOT_OFFSET = 0
U_BOOT_ENV_OFFSET = $(shell echo $$(($(U_BOOT_OFFSET) + $(U_BOOT_PARTITION_SIZE))))
KERNEL_OFFSET = $(shell echo $$(($(U_BOOT_ENV_OFFSET) + $(U_BOOT_ENV_PARTITION_SIZE))))
ROOTFS_OFFSET = $(shell echo $$(($(KERNEL_OFFSET) + $(KERNEL_PARTITION_SIZE))))
OVERLAY_OFFSET = $(shell echo $$(($(ROOTFS_OFFSET) + $(ROOTFS_PARTITION_SIZE))))
# special case with no uboot nor env
OVERLAY_OFFSET_NOBOOT = $(shell echo $$(($(KERNEL_PARTITION_SIZE) + $(ROOTFS_PARTITION_SIZE))))
.PHONY: all bootstrap build build_fast clean cleanbuild create_overlay \
defconfig distclean fast help pack pack_full pack_update \
prepare_config reconfig sdk toolchain upload_tftp upgrade_ota br-%
all: build pack
@$(FIGLET) "FINE"
# install prerequisites
bootstrap:
$(SCRIPTS_DIR)/dep_check.sh
build: defconfig
$(BR2_MAKE) all
build_fast: defconfig
$(BR2_MAKE) -j$(shell nproc) all
fast: build_fast pack
@$(FIGLET) "FINE"
### Configuration
FRAGMENTS = $(shell awk '/FRAG:/ {$$1=$$1;gsub(/^.+:\s*/,"");print}' $(MODULE_CONFIG_REAL))
# Assemble config from bits and pieces
prepare_config: buildroot/Makefile
# create output directory
$(info * make OUTPUT_DIR $(OUTPUT_DIR))
mkdir -p $(OUTPUT_DIR)
# delete older config
$(info * remove existing .config file)
rm -rvf $(OUTPUT_DIR)/.config
# gather fragments of a new config
$(info * add fragments FRAGMENTS=$(FRAGMENTS) from $(MODULE_CONFIG_REAL))
for i in $(FRAGMENTS); do \
echo "** add configs/fragments/$$i.fragment"; \
cat configs/fragments/$$i.fragment >>$(OUTPUT_DIR)/.config; \
echo >>$(OUTPUT_DIR)/.config; \
done
# add module configuration
cat $(MODULE_CONFIG_REAL) >>$(OUTPUT_DIR)/.config
ifneq ($(CAMERA_CONFIG_REAL),$(MODULE_CONFIG_REAL))
# add camera configuration
cat $(CAMERA_CONFIG_REAL) >>$(OUTPUT_DIR)/.config
endif
# Add local.fragment to the final config
if [ -f local.fragment ]; then cat local.fragment >>$(OUTPUT_DIR)/.config; fi
# Add local.mk to the building directory to override settings
if [ -f $(BR2_EXTERNAL)/local.mk ]; then cp -f $(BR2_EXTERNAL)/local.mk $(OUTPUT_DIR)/local.mk; fi
if [ ! -L $(OUTPUT_DIR)/thingino ]; then ln -s $(BR2_EXTERNAL) $(OUTPUT_DIR)/thingino; fi
# Configure buildroot for a particular board
defconfig: prepare_config
@$(FIGLET) $(CAMERA)
cp $(OUTPUT_DIR)/.config $(OUTPUT_DIR)/.config_original
$(BR2_MAKE) BR2_DEFCONFIG=$(CAMERA_CONFIG_REAL) olddefconfig
# $(BR2_MAKE) BR2_DEFCONFIG=$(CAMERA_CONFIG_REAL) defconfig
select-device:
$(info -------------------> select-device)
# Call configurator UI
menuconfig: $(OUTPUT_DIR)/.config
$(BR2_MAKE) BR2_DEFCONFIG=$(CAMERA_CONFIG_REAL) menuconfig
nconfig: $(OUTPUT_DIR)/.config
$(BR2_MAKE) BR2_DEFCONFIG=$(CAMERA_CONFIG_REAL) nconfig
# Permanently save changes to the defconfig
saveconfig:
$(BR2_MAKE) BR2_DEFCONFIG=$(CAMERA_CONFIG_REAL) savedefconfig
### Files
clean:
rm -rf $(OUTPUT_DIR)/target
cleanbuild: distclean all
distclean:
if [ -d "$(OUTPUT_DIR)" ]; then rm -rf $(OUTPUT_DIR); fi
delete_bin_full:
if [ -f $(FIRMWARE_BIN_FULL) ]; then rm $(FIRMWARE_BIN_FULL); fi
delete_bin_update:
if [ -f $(FIRMWARE_BIN_NOBOOT) ]; then rm $(FIRMWARE_BIN_NOBOOT); fi
create_overlay: $(U_BOOT_BIN)
if [ $(OVERLAY_SIZE) -lt $(OVERLAY_MINUMUM_SIZE) ]; then $(FIGLET) "OVERSIZE"; fi
if [ -f $(OVERLAY_BIN) ]; then rm $(OVERLAY_BIN); fi
$(OUTPUT_DIR)/host/sbin/mkfs.jffs2 --little-endian --pad=$(OVERLAY_SIZE) \
--root=$(BR2_EXTERNAL)/overlay/upper/ --eraseblock=$(ALIGN_BLOCK) \
--output=$(OVERLAY_BIN) --squash
pack: pack_full pack_update
@$(FIGLET) $(CAMERA)
pack_full: $(FIRMWARE_BIN_FULL)
$(info FIRMWARE_BIN_FULL_SIZE: $(FIRMWARE_BIN_FULL_SIZE))
$(info FIRMWARE_FULL_SIZE: $(FIRMWARE_FULL_SIZE))
if [ $(FIRMWARE_BIN_FULL_SIZE) -gt $(FIRMWARE_FULL_SIZE) ]; then $(FIGLET) "OVERSIZE"; fi
@sha256sum $(FIRMWARE_BIN_FULL) | awk '{print $$1 " " filename}' filename=$$(basename $(FIRMWARE_BIN_FULL)) > $(FIRMWARE_BIN_FULL).sha256sum
pack_update: $(FIRMWARE_BIN_NOBOOT)
$(info FIRMWARE_BIN_NOBOOT_SIZE: $(FIRMWARE_BIN_NOBOOT_SIZE))
$(info FIRMWARE_NOBOOT_SIZE: $(FIRMWARE_NOBOOT_SIZE))
if [ $(FIRMWARE_BIN_NOBOOT_SIZE) -gt $(FIRMWARE_NOBOOT_SIZE) ]; then $(FIGLET) "OVERSIZE"; fi
@sha256sum $(FIRMWARE_BIN_NOBOOT) | awk '{print $$1 " " filename}' filename=$$(basename $(FIRMWARE_BIN_NOBOOT)) > $(FIRMWARE_BIN_NOBOOT).sha256sum
reconfig:
rm -rvf $(OUTPUT_DIR)/.config
rebuild-%: defconfig
$(BR2_MAKE) $(subst rebuild-,,$@)-dirclean $(subst rebuild-,,$@)
sdk: defconfig
ifeq ($(GCC),12)
sed -i 's/^BR2_TOOLCHAIN_EXTERNAL_GCC_13=y/# BR2_TOOLCHAIN_EXTERNAL_GCC_13 is not set/' $(OUTPUT_DIR)/.config; \
sed -i 's/^# BR2_TOOLCHAIN_EXTERNAL_GCC_12 is not set/BR2_TOOLCHAIN_EXTERNAL_GCC_12=y/' $(OUTPUT_DIR)/.config; \
sed -i 's/^BR2_TOOLCHAIN_GCC_AT_LEAST_13=y/# BR2_TOOLCHAIN_GCC_AT_LEAST_13 is not set/' $(OUTPUT_DIR)/.config; \
sed -i 's/^BR2_TOOLCHAIN_GCC_AT_LEAST="13"/BR2_TOOLCHAIN_GCC_AT_LEAST="12"/' $(OUTPUT_DIR)/.config;
endif
$(BR2_MAKE) sdk
source: defconfig
$(BR2_MAKE) BR2_DEFCONFIG=$(CAMERA_CONFIG_REAL) source
toolchain: defconfig
$(BR2_MAKE) sdk
update_ota: $(FIRMWARE_BIN_NOBOOT)
$(SCRIPTS_DIR)/fw_ota.sh $(FIRMWARE_BIN_NOBOOT) $(CAMERA_IP_ADDRESS)
# upgrade firmware using /tmp/ directory of the camera
upgrade_ota: $(FIRMWARE_BIN_FULL)
$(SCRIPTS_DIR)/fw_ota.sh $(FIRMWARE_BIN_FULL) $(CAMERA_IP_ADDRESS)
# upload firmware to tftp server
upload_tftp: $(FIRMWARE_BIN_FULL)
busybox tftp -l $(FIRMWARE_BIN_FULL) -r $(FIRMWARE_NAME_FULL) -p $(TFTP_IP_ADDRESS)
### Buildroot
# delete all build/{package} and per-package/{package} files
br-%-dirclean:
rm -rf $(OUTPUT_DIR)/per-package/$(subst -dirclean,,$(subst br-,,$@)) \
$(OUTPUT_DIR)/build/$(subst -dirclean,,$(subst br-,,$@))* \
$(OUTPUT_DIR)/target
# \ sed -i /^$(subst -dirclean,,$(subst br-,,$@))/d $(OUTPUT_DIR)/build/packages-file-list.txt
br-%: defconfig
$(BR2_MAKE) $(subst br-,,$@)
buildroot/Makefile:
git submodule init
git submodule update --depth 1 --recursive
# create output directory
$(OUTPUT_DIR):
mkdir -p $(OUTPUT_DIR)
# configure build
$(OUTPUT_DIR)/.config: defconfig
# create source directory
$(SRC_DIR):
mkdir -p $(SRC_DIR)
# download bootloader
$(U_BOOT_BIN):
$(info U_BOOT_BIN $(U_BOOT_BIN) not found!)
$(WGET) -O $@ $(U_BOOT_GITHUB_URL)/u-boot-$(SOC_MODEL_LESS_Z).bin
$(U_BOOT_ENV_BIN):
mkenvimage -s $(U_BOOT_ENV_PARTITION_SIZE) -o $@ $(U_BOOT_ENV_FINAL_TXT)
# rebuild Linux kernel
$(KERNEL_BIN):
$(info KERNEL_BIN: $@)
$(info KERNEL_BIN_SIZE: $(KERNEL_BIN_SIZE))
$(info KERNEL_PARTITION_SIZE: $(KERNEL_PARTITON_SIZE))
$(BR2_MAKE) linux-rebuild
# mv -vf $(OUTPUT_DIR)/images/uImage $@
# rebuild rootfs
$(ROOTFS_BIN):
$(info ROOTFS_BIN: $@)
$(info ROOTFS_BIN_SIZE: $(ROOTFS_BIN_SIZE))
$(info ROOTFS_PARTITION_SIZE: $(ROOTFS_PARTITION_SIZE))
$(BR2_MAKE) all
# create .tar file of rootfs
$(ROOTFS_TAR):
$(info ROOTFS_TAR: $@)
$(BR2_MAKE) all
$(OVERLAY_BIN): create_overlay
$(info OVERLAY_BIN: $@)
$(info OVERLAY_BIN_SIZE: $(OVERLAY_BIN_SIZE))
$(info OVERLAY_OFFSET: $(OVERLAY_OFFSET))
$(FIRMWARE_BIN_FULL): $(U_BOOT_BIN) $(U_BOOT_ENV_BIN) $(KERNEL_BIN) $(ROOTFS_BIN) $(OVERLAY_BIN)
$(info $(shell printf "%-10s | %8s | %9s | %9s |" PARTITION SIZE OFFSET END))
$(info $(shell printf "%-10s | %8d | 0x%07X | 0x%07X |" U_BOOT $(U_BOOT_BIN_SIZE) $(U_BOOT_OFFSET) $$(($(U_BOOT_OFFSET) + $(U_BOOT_BIN_SIZE)))))
$(info $(shell printf "%-10s | %8d | 0x%07X | 0x%07X |" U_BOOT_ENV $(U_BOOT_ENV_BIN_SIZE) $(U_BOOT_ENV_OFFSET) $$(($(U_BOOT_ENV_OFFSET) + $(U_BOOT_ENV_BIN_SIZE)))))
$(info $(shell printf "%-10s | %8d | 0x%07X | 0x%07X |" KERNEL $(KERNEL_BIN_SIZE) $(KERNEL_OFFSET) $$(($(KERNEL_OFFSET) + $(KERNEL_BIN_SIZE)))))
$(info $(shell printf "%-10s | %8d | 0x%07X | 0x%07X |" ROOTFS $(ROOTFS_BIN_SIZE) $(ROOTFS_OFFSET) $$(($(ROOTFS_OFFSET) + $(ROOTFS_BIN_SIZE)))))
$(info $(shell printf "%-10s | %8d | 0x%07X | 0x%07X |" OVERLAY $(OVERLAY_BIN_SIZE) $(OVERLAY_OFFSET) $$(($(OVERLAY_OFFSET) + $(OVERLAY_BIN_SIZE)))))
dd if=/dev/zero bs=$(SIZE_8M) skip=0 count=1 status=none | tr '\000' '\377' > $@
if [ $$(dd --version | awk -F '[. ]' 'NR==1{print $$3}') -lt 9 ]; then \
dd if=$(U_BOOT_BIN) bs=1 seek=$(U_BOOT_OFFSET) count=$(U_BOOT_BIN_SIZE) of=$@ conv=notrunc status=none; \
dd if=$(KERNEL_BIN) bs=1 seek=$(KERNEL_OFFSET) count=$(KERNEL_BIN_SIZE) of=$@ conv=notrunc status=none; \
dd if=$(ROOTFS_BIN) bs=1 seek=$(ROOTFS_OFFSET) count=$(ROOTFS_BIN_SIZE) of=$@ conv=notrunc status=none; \
dd if=$(OVERLAY_BIN) bs=1 seek=$(OVERLAY_OFFSET) count=$(OVERLAY_BIN_SIZE) of=$@ conv=notrunc status=none; \
else \
dd if=$(U_BOOT_BIN) bs=$(U_BOOT_BIN_SIZE) seek=$(U_BOOT_OFFSET)B count=1 of=$@ conv=notrunc status=none; \
dd if=$(KERNEL_BIN) bs=$(KERNEL_BIN_SIZE) seek=$(KERNEL_OFFSET)B count=1 of=$@ conv=notrunc status=none; \
dd if=$(ROOTFS_BIN) bs=$(ROOTFS_BIN_SIZE) seek=$(ROOTFS_OFFSET)B count=1 of=$@ conv=notrunc status=none; \
dd if=$(OVERLAY_BIN) bs=$(OVERLAY_BIN_SIZE) seek=$(OVERLAY_OFFSET)B count=1 of=$@ conv=notrunc status=none; \
fi
$(FIRMWARE_BIN_NOBOOT): $(KERNEL_BIN) $(ROOTFS_BIN) $(OVERLAY_BIN)
$(info $(shell printf "%-10s | %8s | %9s | %9s |" PARTITION SIZE OFFSET END))
$(info $(shell printf "%-10s | %8d | 0x%07X | 0x%07X |" KERNEL $(KERNEL_BIN_SIZE) $(KERNEL_OFFSET) $$(($(KERNEL_OFFSET) + $(KERNEL_BIN_SIZE)))))
$(info $(shell printf "%-10s | %8d | 0x%07X | 0x%07X |" ROOTFS $(ROOTFS_BIN_SIZE) $(ROOTFS_OFFSET) $$(($(ROOTFS_OFFSET) + $(ROOTFS_BIN_SIZE)))))
$(info $(shell printf "%-10s | %8d | 0x%07X | 0x%07X |" OVERLAY $(OVERLAY_BIN_SIZE) $(OVERLAY_OFFSET) $$(($(OVERLAY_OFFSET) + $(OVERLAY_BIN_SIZE)))))
dd if=/dev/zero bs=$(FIRMWARE_NOBOOT_SIZE) skip=0 count=1 status=none | tr '\000' '\377' > $@
if [ $$(dd --version | awk -F '[. ]' 'NR==1{print $$3}') -lt 9 ]; then \
dd if=$(KERNEL_BIN) bs=1 seek=0 count=$(KERNEL_BIN_SIZE) of=$@ conv=notrunc status=none; \
dd if=$(ROOTFS_BIN) bs=1 seek=$(KERNEL_PARTITION_SIZE) count=$(ROOTFS_BIN_SIZE) of=$@ conv=notrunc status=none; \
dd if=$(OVERLAY_BIN) bs=1 seek=$(OVERLAY_OFFSET_NOBOOT) count=$(OVERLAY_BIN_SIZE) of=$@ conv=notrunc status=none; \
else \
dd if=$(KERNEL_BIN) bs=$(KERNEL_BIN_SIZE) seek=0 count=1 of=$@ conv=notrunc status=none; \
dd if=$(ROOTFS_BIN) bs=$(ROOTFS_BIN_SIZE) seek=$(KERNEL_PARTITION_SIZE)B count=1 of=$@ conv=notrunc status=none; \
dd if=$(OVERLAY_BIN) bs=$(OVERLAY_BIN_SIZE) seek=$(OVERLAY_OFFSET_NOBOOT)B count=1 of=$@ conv=notrunc status=none; \
fi
help:
@echo "\n\
Usage:\n\
make bootstrap install system deps\n\
make defconfig (re)create config file\n\
make build and pack everything\n\
make build build kernel and rootfs\n\
make cleanbuild build everything from scratch\n\
make pack_full create a full firmware image\n\
make pack_update create an update firmware image (no bootloader)\n\
make clean clean before reassembly\n\
make distclean start building from scratch\n\
make rebuild-<pkg> perform a clean package rebuild for <pkg>\n\
make help print this help\n\
\n\
make upgrade_ota IP=192.168.1.10\n\
upload the full firmware file to the camera\n\
over network, and flash it\n\n\
make update_ota IP=192.168.1.10\n\
upload the update firmware file to the camera\n\
over network, and flash it\n\n\
"