mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-07-24 13:36:31 +00:00
BUILD: Build with make (#306)
* Use a Makefile to configure,build or clean the images. * Update docs * Remove old build script.
This commit is contained in:
parent
5fc32d2eb7
commit
4aa07960d8
@ -47,18 +47,18 @@ Note that the current iteration of `enter.sh` will try to load the **overlayfs**
|
||||
|
||||
```
|
||||
root@somehashinhex:/build#
|
||||
root@somehashinhex:/build# cat scripts/build-all.sh
|
||||
root@somehashinhex:/build# make help
|
||||
[...]
|
||||
```
|
||||
|
||||
The _hassos_ developers provides another convenience script that will build hassos images for a (rather long!) list of targets - if you're not interested in building artifacts for all supported platforms, make sure to take a peek inside and monkeypatch away... After you're done making changes, start it, and go make a cup of tea. Or fifteen.
|
||||
The _hassos_ developers provide a Makefile that will build hassos images for a (rather long!) list of targets. For example run the command below to start building the _ova_ variant, and go make a cup of tea. Or fifteen.
|
||||
|
||||
```
|
||||
root@0db6f7079872:/build# scripts/build-all.sh
|
||||
root@0db6f7079872:/build# make ova
|
||||
[...]
|
||||
```
|
||||
|
||||
Personally, I removed all advertised build targets from the `all_platforms` array variable, expect for the _ova_ variant. That will result in a single VMDK image file at the very end of the build process. This image file is a compressed block device dump with a proper GPT partition table, prepared to ship into any OVA-compatible hypervisor's innards. For me, the end of the **ova** build steps looks like this:
|
||||
That will result in a single VMDK image file at the very end of the build process. This image file is a compressed block device dump with a proper GPT partition table, prepared to ship into any OVA-compatible hypervisor's innards. For me, the end of the **ova** build steps looks like this:
|
||||
|
||||
```
|
||||
[...]
|
||||
|
43
Makefile
Normal file
43
Makefile
Normal file
@ -0,0 +1,43 @@
|
||||
RELEASE_DIR = /build/release
|
||||
|
||||
BUILDROOT=/build/buildroot
|
||||
BUILDROOT_EXTERNAL=/build/buildroot-external
|
||||
DEFCONFIG_DIR = $(BUILDROOT_EXTERNAL)/configs
|
||||
|
||||
TARGETS := $(notdir $(patsubst %_defconfig,%,$(wildcard $(DEFCONFIG_DIR)/*_defconfig)))
|
||||
TARGETS_CONFIG := $(notdir $(patsubst %_defconfig,%-config,$(wildcard $(DEFCONFIG_DIR)/*_defconfig)))
|
||||
|
||||
.NOTPARALLEL: $(TARGETS) $(TARGETS_CONFIG) all
|
||||
|
||||
.PHONY: $(TARGETS) $(TARGETS_CONFIG) all clean help
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
$(RELEASE_DIR):
|
||||
mkdir -p $(RELEASE_DIR)
|
||||
|
||||
$(TARGETS_CONFIG): %-config:
|
||||
@echo "config $*"
|
||||
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) "$*_defconfig"
|
||||
|
||||
$(TARGETS): %: $(RELEASE_DIR) %-config
|
||||
@echo "build $@"
|
||||
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL)
|
||||
cp -f $(BUILDROOT)/output/images/hassos_* $(RELEASE_DIR)/
|
||||
|
||||
# Do not clean when building for one target
|
||||
ifneq ($(words $(filter $(TARGETS),$(MAKECMDGOALS))), 1)
|
||||
@echo "clean $@"
|
||||
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) clean
|
||||
endif
|
||||
@echo "finished $@"
|
||||
|
||||
clean:
|
||||
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) clean
|
||||
|
||||
help:
|
||||
@echo "Supported targets: $(TARGETS)"
|
||||
@echo "Run 'make <target>' to build a target image."
|
||||
@echo "Run 'make all' to build all target images."
|
||||
@echo "Run 'make clean' to clean the build output."
|
||||
@echo "Run 'make <target>-config' to configure buildroot for a target."
|
@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
mkdir -p /build/release
|
||||
|
||||
all_platforms=(ova rpi rpi0_w rpi2 rpi3 rpi3_64 tinker odroid_c2 intel_nuc opi_prime)
|
||||
for platform in "${all_platforms[@]}"; do
|
||||
make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external \
|
||||
"${platform}_defconfig"
|
||||
make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external
|
||||
cp -f /build/buildroot/output/images/hassos_* /build/release/
|
||||
|
||||
make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external \
|
||||
clean
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user