Skip to content

Commit 74e2156

Browse files
committed
use cpio-clean to make a reproducible makefile
1 parent 8a32fb4 commit 74e2156

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

Makefile

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ packages := $(pwd)/packages
44
build := $(pwd)/build
55
config := $(pwd)/build
66

7-
all:
7+
all: x230.rom
8+
89

910

1011
include modules/*
@@ -80,7 +81,8 @@ initrd_bins += initrd/bin/$(notdir $1)
8081
endef
8182

8283
$(foreach _, $(call outputs,kexec), $(eval $(call initrd_bin,$_)))
83-
#$(foreach _, $(call outputs,tpmtotp), $(eval $(call initrd_bin,$_)))
84+
$(foreach _, $(call outputs,tpmtotp), $(eval $(call initrd_bin,$_)))
85+
#$(eval $(call initrd_bin,$(build)/$(tpmtotp_dir)/unsealtotp))
8486
#$(foreach _, $(call outputs,xen), $(eval $(call initrd_bin,$_)))
8587

8688
# hack to install busybox into the initrd
@@ -138,16 +140,14 @@ initrd_libs: $(initrd_bins)
138140
#
139141
#
140142
initrd.cpio: $(initrd_bins) initrd_libs
141-
find ./initrd -print0 \
142-
| xargs -0 touch --no-dereference -d "1970-01-01"
143143
cd ./initrd ; \
144144
( \
145145
echo "/dev" ; \
146146
echo "/dev/console"; \
147147
find . \
148148
) \
149-
| sort \
150149
| cpio --quiet -H newc -o \
150+
| ../cpio-clean \
151151
> "../$@.tmp"
152152
if ! cmp --quiet "$@" "$@.tmp"; then \
153153
mv "$@.tmp" "$@"; \
@@ -157,9 +157,12 @@ initrd.cpio: $(initrd_bins) initrd_libs
157157
fi
158158

159159

160-
# hack for the linux kernel to depend on the initrd image
161-
# this will change once coreboot can link in the initrd separately
160+
# populate the coreboot initrd image from the one we built.
161+
# 4.4 doesn't allow this, but building from head does.
162162
$(call outputs,linux): initrd.cpio
163+
#$(call outputs,coreboot): $(build)/$(coreboot_dir)/initrd.cpio.xz
164+
$(build)/$(coreboot_dir)/initrd.cpio.xz: initrd.cpio
165+
xz < "$<" > "$@"
163166

164167
# hack for the coreboot to find the linux kernel
165168
$(build)/$(coreboot_dir)/bzImage: $(call outputs,linux)
@@ -173,3 +176,6 @@ $(call outputs,coreboot): $(build)/$(coreboot_dir)/bzImage
173176
#export CC := $(XGCC)/bin/x86_64-elf-gcc
174177
#export LDFLAGS := -L/lib/x86_64-linux-gnu
175178

179+
x230.rom: $(build)/$(coreboot_dir)/build/coreboot.rom
180+
dd if="$<" of="$@" bs=1M skip=8
181+

0 commit comments

Comments
 (0)