include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
-define Build/copy-kernel
- $(MAKE) -C copy-kernel CROSS_COMPILE=$(TARGET_CROSS)
+define Build/copy-kernel.bin
+ $(call locked,$(MAKE) -C copy-kernel CROSS_COMPILE=$(TARGET_CROSS) O=$(KDIR),gemini-copy-kernel.bin)
endef
# Cook a "WRGG" image, this board is apparently one in the D-Link
define Build/storlink-default-images
mkdir -p $@.tmp
- $(call Build/copy-kernel)
# "App" partition is the rootfs
mv $@ $@.tmp/hddapp.tgz
# 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)
# Copy first part of the kernel into zImage
dd if=$(IMAGE_KERNEL) of=$@.tmp/zImage bs=1 seek=512 count=2096640
# Default images setup used by the StorLink reference designs
define Device/storlink-reference
+ COMPILE := copy-kernel-$(1).bin
+ COMPILE/copy-kernel-$(1).bin := copy-kernel.bin
IMAGES := factory.bin
IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 6144k | \
storlink-default-images $(1)
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
dep:
install:
-%.o : %.S
+$(OUT_DIR):
+ mkdir -p $(OUT_DIR)
+
+$(OUT_DIR)%.o : $(SRC_DIR)%.S | $(OUT_DIR)
$(AS) $(ASFLAGS) -k -o $@ $<
-%.bin: %.o
+$(OUT_DIR)%.bin: $(OUT_DIR)%.o
$(OBJCOPY) $(BIN_FLAGS) $< $@
mrproper: clean
clean:
- rm -f copy-kernel.bin copy-kernel.o
+ rm -f $(OUT_DIR)copy-kernel.bin $(OUT_DIR)copy-kernel.o