mirror of https://github.com/hak5/openwrt.git
gemini: image: fix race condition when building copy-kernel.bin
Make treat copy-kernel.o as intermediate and delete it when it's no longer needed. This can fail when the same submake was triggered multiple times for different devices. arm-openwrt-linux-muslgnueabi-as -k -o copy-kernel.o copy-kernel.S export MAKEFLAGS= ;make -w -C copy-kernel CROSS_COMPILE=arm-openwrt-linux-muslgnueabi- arm-openwrt-linux-muslgnueabi-objcopy -O binary -S copy-kernel.o copy-kernel.bin make[5]: Entering directory '/builder/shared-workdir/build/target/linux/gemini/image/copy-kernel' arm-openwrt-linux-muslgnueabi-objcopy -O binary -S copy-kernel.o copy-kernel.bin rm copy-kernel.o make[5]: Leaving directory '/builder/shared-workdir/build/target/linux/gemini/image/copy-kernel' # "App" partition is the rootfs arm-openwrt-linux-muslgnueabi-objcopy: 'copy-kernel.o': No such file Makefile:27: recipe for target 'copy-kernel.bin' failed make[5]: Leaving directory '/builder/shared-workdir/build/target/linux/gemini/image/copy-kernel' make[5]: *** [copy-kernel.bin] Error 1 Makefile:244: recipe for target '/builder/shared-workdir/build/build_dir/target-arm_fa526_musl_eabi/linux-gemini/tmp/openwrt-gemini-storlink_sl93512r-ext4-factory.bin' failed make[4]: *** [/builder/shared-workdir/build/build_dir/target-arm_fa526_musl_eabi/linux-gemini/tmp/openwrt-gemini-storlink_sl93512r-ext4-factory.bin] Error 2 With this change, output files are directed to $(KDIR) Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>master
parent
7bed9bf10f
commit
6d819fae53
|
@ -7,8 +7,8 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
include $(INCLUDE_DIR)/image.mk
|
include $(INCLUDE_DIR)/image.mk
|
||||||
|
|
||||||
define Build/copy-kernel
|
define Build/copy-kernel.bin
|
||||||
$(MAKE) -C copy-kernel CROSS_COMPILE=$(TARGET_CROSS)
|
$(call locked,$(MAKE) -C copy-kernel CROSS_COMPILE=$(TARGET_CROSS) O=$(KDIR),gemini-copy-kernel.bin)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Cook a "WRGG" image, this board is apparently one in the D-Link
|
# Cook a "WRGG" image, this board is apparently one in the D-Link
|
||||||
|
@ -93,11 +93,10 @@ endef
|
||||||
define Build/storlink-default-images
|
define Build/storlink-default-images
|
||||||
mkdir -p $@.tmp
|
mkdir -p $@.tmp
|
||||||
|
|
||||||
$(call Build/copy-kernel)
|
|
||||||
# "App" partition is the rootfs
|
# "App" partition is the rootfs
|
||||||
mv $@ $@.tmp/hddapp.tgz
|
mv $@ $@.tmp/hddapp.tgz
|
||||||
# 256 bytes copy routine
|
# 256 bytes copy routine
|
||||||
dd if=copy-kernel/copy-kernel.bin of=$@.tmp/zImage
|
dd if=$(KDIR)/copy-kernel.bin of=$@.tmp/zImage
|
||||||
$(call Image/pad-to,$@.tmp/zImage,512)
|
$(call Image/pad-to,$@.tmp/zImage,512)
|
||||||
# Copy first part of the kernel into zImage
|
# Copy first part of the kernel into zImage
|
||||||
dd if=$(IMAGE_KERNEL) of=$@.tmp/zImage bs=1 seek=512 count=2096640
|
dd if=$(IMAGE_KERNEL) of=$@.tmp/zImage bs=1 seek=512 count=2096640
|
||||||
|
@ -182,6 +181,8 @@ TARGET_DEVICES += dlink_dns-313
|
||||||
|
|
||||||
# Default images setup used by the StorLink reference designs
|
# Default images setup used by the StorLink reference designs
|
||||||
define Device/storlink-reference
|
define Device/storlink-reference
|
||||||
|
COMPILE := copy-kernel-$(1).bin
|
||||||
|
COMPILE/copy-kernel-$(1).bin := copy-kernel.bin
|
||||||
IMAGES := factory.bin
|
IMAGES := factory.bin
|
||||||
IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 6144k | \
|
IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 6144k | \
|
||||||
storlink-default-images $(1)
|
storlink-default-images $(1)
|
||||||
|
|
|
@ -13,20 +13,26 @@ OBJCOPY := $(CROSS_COMPILE)objcopy
|
||||||
|
|
||||||
BIN_FLAGS := -O binary -S
|
BIN_FLAGS := -O binary -S
|
||||||
|
|
||||||
all: copy-kernel.bin
|
SRC_DIR := $(CURDIR)/
|
||||||
|
OUT_DIR := $(if $(O),$(if $(patsubst %/,,$(O)),$(O)/,$(O)),$(SRC_DIR))
|
||||||
|
|
||||||
|
all: $(OUT_DIR)copy-kernel.bin
|
||||||
|
|
||||||
# Don't build dependencies, this may die if $(CC) isn't gcc
|
# Don't build dependencies, this may die if $(CC) isn't gcc
|
||||||
dep:
|
dep:
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
|
||||||
%.o : %.S
|
$(OUT_DIR):
|
||||||
|
mkdir -p $(OUT_DIR)
|
||||||
|
|
||||||
|
$(OUT_DIR)%.o : $(SRC_DIR)%.S | $(OUT_DIR)
|
||||||
$(AS) $(ASFLAGS) -k -o $@ $<
|
$(AS) $(ASFLAGS) -k -o $@ $<
|
||||||
|
|
||||||
%.bin: %.o
|
$(OUT_DIR)%.bin: $(OUT_DIR)%.o
|
||||||
$(OBJCOPY) $(BIN_FLAGS) $< $@
|
$(OBJCOPY) $(BIN_FLAGS) $< $@
|
||||||
|
|
||||||
mrproper: clean
|
mrproper: clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f copy-kernel.bin copy-kernel.o
|
rm -f $(OUT_DIR)copy-kernel.bin $(OUT_DIR)copy-kernel.o
|
||||||
|
|
Loading…
Reference in New Issue