Makefile: add target to generate cpio

It is convenient to deliver the bootrr as a cpio archive which can be
appended to an initramfs image.

The output cpio filename can be overriding the CPIONAME variable, it
is set to 'bootrr' by default.

Also use a default value for DESTDIR, so that "make cpio" just works.

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
Nicolas Dechesne
2019-02-06 08:25:51 +01:00
committed by Bjorn Andersson
parent e4ea38f586
commit 2a1010e7ad

View File

@@ -4,6 +4,9 @@ all:
all-install :=
DESTDIR ?= dest
CPIONAME ?= bootrr
HELPERS := assert_file_is_empty \
assert_device_present \
assert_driver_present \
@@ -41,4 +44,17 @@ $(foreach v,${HELPERS},$(eval $(call add-scripts,helpers,$v)))
install: $(all-install)
CPIO := $(PWD)/$(CPIONAME).cpio
$(CPIO): $(all-install)
@cd $(DESTDIR) && find ./$(prefix)/bin | cpio -o -H newc > $(CPIO)
%.cpio.gz: %.cpio
@gzip < $< > $@
cpio: $(CPIO)
cpio.gz: $(CPIO).gz
clean:
@rm -f $(CPIO) $(CPIO).gz