forked from nerves-project/nerves_system_br
-
Notifications
You must be signed in to change notification settings - Fork 0
/
external.mk
68 lines (59 loc) · 2.57 KB
/
external.mk
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
# Include Nerves-specific packages
include $(sort $(wildcard $(BR2_EXTERNAL)/package/*/*.mk))
# Nerves targets
# NERVES_DEFCONFIG_DIR is used to reference files in configurations
# relative to wherever the _defconfig is stored.
NERVES_DEFCONFIG_DIR = $(dir $(call qstrip,$(BR2_DEFCONFIG)))
export NERVES_DEFCONFIG_DIR
# Pull in any configuration-specific packages
-include $(NERVES_DEFCONFIG_DIR)/external.mk
# Create a system image for use by Bakeware and for creating
# firmware images without Buildroot
system:
$(BR2_EXTERNAL)/scripts/mksystem.sh $(BR2_NERVES_SYSTEM_NAME)
NERVES_FIRMWARE=$(firstword $(wildcard $(BINARIES_DIR)/*.fw))
# Replace everything on the SDCard with new bits
burn-complete: burn
burn:
@if [ -e "$(NERVES_FIRMWARE)" ]; then \
echo "Burning $(NERVES_FIRMWARE)..."; \
sudo $(HOST_DIR)/usr/bin/fwup -a -i $(NERVES_FIRMWARE) -t complete; \
else \
echo "ERROR: No firmware found. Check that 'make' completed successfully"; \
echo "and that a firmware (.fw) file is in $(BINARIES_DIR)."; \
fi
# Upgrade the image on the SDCard (app data won't be removed)
# This is usually the fastest way to update an SDCard that's already
# been programmed. It won't update bootloaders, so if something is
# really messed up, burn-complete may be better.
burn-upgrade:
@if [ -e "$(NERVES_FIRMWARE)" ]; then \
echo "Upgrading $(NERVES_FIRMWARE)..."; \
sudo $(HOST_DIR)/usr/bin/fwup -a -i $(NERVES_FIRMWARE) -t upgrade --no-eject; \
sudo $(HOST_DIR)/usr/bin/fwup -y -a -i /tmp/finalize.fw -t on-reboot; \
sudo rm /tmp/finalize.fw; \
else \
echo "ERROR: No firmware found. Check that 'make' completed successfully"; \
echo "and that a firmware (.fw) file is in $(BINARIES_DIR)."; \
fi
help:
@echo "Nerves System Help"
@echo "------------------"
@echo
@echo "This build directory is configured to create the system described in:"
@echo
@echo "$(BR2_DEFCONFIG)"
@echo
@echo "Building:"
@echo " all - Build the current configuration"
@echo " burn - Burn the most recent build to an SDCard (requires sudo)"
@echo " system - Build a system image for use with bake"
@echo " clean - Clean everything"
@echo
@echo "Configuration:"
@echo " menuconfig - Run Buildroot's menuconfig"
@echo " linux-menuconfig - Run menuconfig on the Linux kernel"
@echo
@echo "For much more information about the targets in this Makefile, run 'make buildroot-help'"
@echo "and see the Buildroot documentation."
.PHONY: burn burn-complete burn-upgrade system help