Skip to content

Commit 6e148cb

Browse files
committed
Makefile changes to support putting data into the initrd, such as terminfo.
Signed-off-by: Matthew Drobnak <matthew@drobnak.com>
1 parent 19a705c commit 6e148cb

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,12 @@ endif
175175
# Create a temporary directory for the initrd
176176
initrd_dir := $(BOARD)
177177
initrd_tmp_dir := $(shell mktemp -d)
178+
initrd_data_dir := $(initrd_tmp_dir)/etc/terminfo/l
178179
initrd_lib_dir := $(initrd_tmp_dir)/lib
179180
initrd_bin_dir := $(initrd_tmp_dir)/bin
180181
modules-y += initrd
181182

182-
$(shell mkdir -p "$(initrd_lib_dir)" "$(initrd_bin_dir)")
183+
$(shell mkdir -p "$(initrd_lib_dir)" "$(initrd_bin_dir)" "$(initrd_data_dir)")
183184

184185
# We are running our own version of make,
185186
# proceed with the build.
@@ -291,13 +292,17 @@ include modules/*
291292
define bins =
292293
$(foreach m,$1,$(call prefix,$(build)/$($m_dir)/,$($m_output)))
293294
endef
295+
define data =
296+
$(foreach m,$1,$(call prefix,$(build)/$($m_dir)/,$($m_data)))
297+
endef
294298
define libs =
295299
$(foreach m,$1,$(call prefix,$(build)/$($m_dir)/,$($m_libraries)))
296300
endef
297301

298302
define outputs =
299303
$(foreach m,$1,\
300304
$(call bins,$m)\
305+
$(call data,$m)\
301306
$(call libs,$m)\
302307
)
303308
endef
@@ -577,6 +582,11 @@ $(initrd_bin_dir)/$(notdir $1): $1
577582
initrd_bins += $(initrd_bin_dir)/$(notdir $1)
578583
endef
579584

585+
define initrd_data_add =
586+
$(initrd_data_dir)/$(notdir $1): $1
587+
$(call do,INSTALL-DATA,$$(<:$(pwd)/%=%),cp -a --remove-destination "$$<" "$$@")
588+
initrd_data += $(initrd_data_dir)/$(notdir $1)
589+
endef
580590

581591
define initrd_lib_add =
582592
$(initrd_lib_dir)/$(notdir $1): $1
@@ -622,6 +632,10 @@ $(foreach m, $(bin_modules-y), \
622632
$(call map,initrd_bin_add,$(call bins,$m)) \
623633
)
624634

635+
# Install the data for every module that we have built
636+
$(foreach m, $(modules-y), \
637+
$(call map,initrd_data_add,$(call data,$m)) \
638+
)
625639
# Install the libraries for every module that we have built
626640
$(foreach m, $(modules-y), \
627641
$(call map,initrd_lib_add,$(call libs,$m)) \
@@ -727,9 +741,11 @@ $(build)/$(initrd_dir)/heads.cpio: FORCE
727741
#
728742
$(build)/$(initrd_dir)/tools.cpio: \
729743
$(initrd_bins) \
744+
$(initrd_data) \
730745
$(initrd_libs) \
731746
$(initrd_tmp_dir)/etc/config \
732747

748+
$(info Used **BINS**: $(initrd_bins))
733749
$(call do-cpio,$@,$(initrd_tmp_dir))
734750
@$(RM) -rf "$(initrd_tmp_dir)"
735751

0 commit comments

Comments
 (0)