Makefile: change install paths, provide bootrr-run script

Install all the tests into separe dir (${prefix}/libexec/bootrr).
Provide a generic script to run all the tests on the target board.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
This commit is contained in:
Dmitry Baryshkov
2021-10-02 17:54:21 +03:00
committed by Bjorn Andersson
parent e5413c7b1f
commit 388e281ef2
3 changed files with 30 additions and 7 deletions

2
.gitignore vendored
View File

@@ -1,3 +1,3 @@
dest/
bootrr.cpio*
bin/bootrr

View File

@@ -11,23 +11,33 @@ HELPERS := $(wildcard helpers/*)
BOARDS := $(wildcard boards/*)
BINS := bin/bootrr
LIBEXEC_DIR ?= $(prefix)/libexec
BOOTRR_DIR = $(LIBEXEC_DIR)/bootrr
define add-scripts
$(DESTDIR)$(prefix)/bin/$(notdir $1): $1
$(DESTDIR)$1/$2: $2
@echo "INSTALL $$<"
@install -D -m 755 $$< $$@
all-install += $(DESTDIR)$(prefix)/bin/$(notdir $1)
all-install += $(DESTDIR)$1/$2
endef
$(foreach v,${BOARDS},$(eval $(call add-scripts,$v)))
$(foreach v,${HELPERS},$(eval $(call add-scripts,$v)))
$(foreach v,${BOARDS},$(eval $(call add-scripts,$(BOOTRR_DIR),$v)))
$(foreach v,${HELPERS},$(eval $(call add-scripts,$(BOOTRR_DIR),$v)))
$(foreach v,${BINS},$(eval $(call add-scripts,$(prefix),$v)))
bin/bootrr: bin/bootrr.in Makefile
@sed -e 's!@BOOTRR@!$(BOOTRR_DIR)!g' $< > $@.tmp
@mv $@.tmp $@
install: $(all-install)
CPIO := $(PWD)/$(CPIONAME).cpio
$(CPIO): $(all-install)
@cd $(DESTDIR) && find ./$(prefix)/bin | cpio -o -H newc > $(CPIO)
@cd $(DESTDIR) && find ./$(prefix) | cpio -o -H newc > $(CPIO)
%.cpio.gz: %.cpio
@gzip < $< > $@
@@ -37,4 +47,4 @@ cpio: $(CPIO)
cpio.gz: $(CPIO).gz
clean:
@rm -f $(CPIO) $(CPIO).gz
@rm -f $(CPIO) $(CPIO).gz bin/bootrr

13
bin/bootrr.in Normal file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
BOOTRR_DIR=@BOOTRR@
PATH=${BOOTRR_DIR}/helpers:${PATH}
bootrr-generic-tests
for TEST in $(tr "\0" "\n" < /proc/device-tree/compatible); do
if [ -x "${BOOTRR_DIR}/boards/${TEST}" ]; then
${BOOTRR_DIR}/boards/${TEST}
fi
done