kumquat-buildroot/target/u-boot/Makefile.in

311 lines
11 KiB
Makefile
Raw Normal View History

#############################################################
#
# U-Boot
#
#############################################################
2009-01-02 12:18:09 +01:00
U_BOOT_VERSION:=$(strip $(subst ",,$(BR2_UBOOT_VERSION)))
#"))
U_BOOT_SOURCE:=u-boot-$(U_BOOT_VERSION).tar.bz2
U_BOOT_SITE:=$(strip $(subst ",,$(BR2_U_BOOT_SITE)))
#"))
U_BOOT_DIR:=$(PROJECT_BUILD_DIR)/u-boot-$(U_BOOT_VERSION)
U_BOOT_PATCH_DIR:=$(PROJECT_BUILD_DIR)/u-boot-$(U_BOOT_VERSION)-patches
U_BOOT_CAT:=$(BZCAT)
U_BOOT_BIN:=u-boot.bin
U_BOOT_TARGET_BIN:=$(PROJECT)-u-boot-$(U_BOOT_VERSION)-$(DATE).bin
U_BOOT_TOOLS_BIN:=mkimage
2009-01-02 12:18:09 +01:00
U_BOOT_TOOLS:=$(STAGING_DIR)/usr/bin/$(U_BOOT_TOOLS_BIN)
MKIMAGE:=$(U_BOOT_TOOLS)
U_BOOT_AUTOSCRIPT=$(BINARIES_DIR)/autoscript
U_BOOT_TARGETS:=$(BINARIES_DIR)/$(U_BOOT_BIN) $(U_BOOT_TOOLS) $(U_BOOT_TARGET_TOOLS)
ifeq ($(strip $(subst ",,$(BR2_TARGET_UBOOT_DEFAULT_ENV))),y)
#"))
U_BOOT_TARGETS += u-boot-autoscript
endif
TARGET_UBOOT_IPADDR:=$(strip $(subst ",, $(BR2_TARGET_UBOOT_IPADDR)))
#"))
TARGET_UBOOT_SERVERIP:=$(strip $(subst ",, $(BR2_TARGET_UBOOT_SERVERIP)))
#"))
TARGET_UBOOT_GATEWAY:=$(strip $(subst ",, $(BR2_TARGET_UBOOT_GATEWAY)))
#"))
TARGET_UBOOT_NETMASK:=$(strip $(subst ",, $(BR2_TARGET_UBOOT_NETMASK)))
#"))
TARGET_UBOOT_ETHADDR:=$(strip $(subst ",, $(BR2_TARGET_UBOOT_ETHADDR)))
#"))
2008-04-23 12:30:03 +02:00
# u-boot still uses arch=ppc for powerpc
U_BOOT_ARCH=$(KERNEL_ARCH:powerpc=ppc)
ifeq ($(UBOOT_BOARD_NAME),)
2009-01-02 12:18:09 +01:00
UBOOT_BOARD_NAME:=$(strip $(subst ",,$(BR2_TARGET_UBOOT_BOARDNAME)))
#"))
endif
ifneq ($(BR2_TARGET_U_BOOT_CONFIG_BOARD),)
U_BOOT_INC_CONF_FILE:=$(U_BOOT_DIR)/include/configs/$(subst _config,,$(BR2_TARGET_U_BOOT_CONFIG_BOARD)).h
else
U_BOOT_INC_CONF_FILE:=$(U_BOOT_DIR)/include/config.h
endif
U_BOOT_TARGET_TOOLS:=
ifeq ($(BR2_TARGET_UBOOT_TOOL_MKIMAGE),y)
U_BOOT_TARGET_TOOLS+=$(TARGET_DIR)/usr/bin/mkimage
endif
ifeq ($(BR2_TARGET_UBOOT_TOOL_ENV),y)
U_BOOT_TARGET_TOOLS+=$(TARGET_DIR)/usr/sbin/fw_printenv
endif
U_BOOT_CONFIGURE_OPTS :=
ifneq ($(BR2_TARGET_UBOOT_1_2_0_ATMEL),)
U_BOOT_CONFIGURE_OPTS += CONFIG_NOSOFTFLOAT=1
endif
# Define a helper function
define insert_define
@echo "#ifdef $(strip $(1))" >> $(U_BOOT_INC_CONF_FILE)
@echo "#undef $(strip $(1))" >> $(U_BOOT_INC_CONF_FILE)
@echo "#endif" >> $(U_BOOT_INC_CONF_FILE)
@echo '#define $(strip $(1)) $(strip $(subst ",,$(2)))' >> $(U_BOOT_INC_CONF_FILE)
endef
#"))
$(DL_DIR)/$(U_BOOT_SOURCE):
$(WGET) -P $(DL_DIR) $(U_BOOT_SITE)/$(U_BOOT_SOURCE)
$(U_BOOT_DIR)/.unpacked: $(DL_DIR)/$(U_BOOT_SOURCE)
$(U_BOOT_CAT) $(DL_DIR)/$(U_BOOT_SOURCE) \
| tar -C $(PROJECT_BUILD_DIR) $(TAR_OPTIONS) -
mkdir -p $(U_BOOT_DIR)
touch $@
$(U_BOOT_DIR)/.patched: $(U_BOOT_DIR)/.unpacked
2009-01-02 12:18:09 +01:00
toolchain/patch-kernel.sh $(U_BOOT_DIR) target/u-boot/$(U_BOOT_VERSION) \
u-boot-$(U_BOOT_VERSION)-\*.patch \
u-boot-$(U_BOOT_VERSION)-\*.patch.$(ARCH)
ifneq ($(strip $(BR2_TARGET_UBOOT_CUSTOM_PATCH)),"")
@mkdir -p $(U_BOOT_PATCH_DIR)
cp -dpr $(BR2_TARGET_UBOOT_CUSTOM_PATCH) $(U_BOOT_PATCH_DIR)
2008-04-09 09:02:20 +02:00
toolchain/patch-kernel.sh $(U_BOOT_DIR) $(U_BOOT_PATCH_DIR) \*.patch
endif
touch $@
$(U_BOOT_DIR)/.header_copied: $(U_BOOT_DIR)/.patched
ifneq ($(strip $(BR2_TARGET_U_BOOT_CONFIG_HEADER_FILE)),)
cp -dpf $(BR2_TARGET_U_BOOT_CONFIG_HEADER_FILE) $(U_BOOT_INC_CONF_FILE)
endif
touch $@
$(U_BOOT_DIR)/.configured: $(U_BOOT_DIR)/.header_copied
$(TARGET_CONFIGURE_OPTS) \
CFLAGS="$(TARGET_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
$(U_BOOT_CONFIGURE_OPTS) \
$(MAKE) -C $(U_BOOT_DIR) \
2009-01-02 12:18:09 +01:00
$(UBOOT_BOARD_NAME)_config
touch $@
$(U_BOOT_DIR)/.header_modified: $(U_BOOT_DIR)/.configured
# Modify configuration header in $(U_BOOT_INC_CONF_FILE)
@echo >> $(U_BOOT_INC_CONF_FILE)
@echo "/* Add a wrapper around the values Buildroot sets. */" >> $(U_BOOT_INC_CONF_FILE)
@echo "#ifndef __BR2_ADDED_CONFIG_H" >> $(U_BOOT_INC_CONF_FILE)
@echo "#define __BR2_ADDED_CONFIG_H" >> $(U_BOOT_INC_CONF_FILE)
$(call insert_define, DATE, $(DATE))
$(call insert_define, CONFIG_LOAD_SCRIPTS, 1)
ifneq ($(strip $(BR2_PROJECT)),"")
$(call insert_define, CONFIG_HOSTNAME, $(BR2_PROJECT))
endif
ifneq ($(strip $(BR2_TARGET_UBOOT_IPADDR)),"")
$(call insert_define, CONFIG_IPADDR, $(BR2_TARGET_UBOOT_IPADDR))
ifneq ($(strip $(BR2_TARGET_UBOOT_GATEWAY)),"")
$(call insert_define, CONFIG_GATEWAYIP, $(BR2_TARGET_UBOOT_GATEWAY))
endif
ifneq ($(strip $(BR2_TARGET_UBOOT_NETMASK)),"")
$(call insert_define, CONFIG_NETMASK, $(BR2_TARGET_UBOOT_NETMASK))
endif
endif # end BR2_TARGET_U_BOOT_IPADDR
ifneq ($(strip $(BR2_TARGET_UBOOT_SERVERIP)),"")
$(call insert_define, CONFIG_SERVERIP, $(BR2_TARGET_UBOOT_SERVERIP))
endif
ifneq ($(strip $(BR2_TARGET_UBOOT_ETHADDR)),"")
$(call insert_define, CONFIG_ETHADDR, $(BR2_TARGET_UBOOT_ETHADDR))
endif
ifneq ($(strip $(BR2_TARGET_UBOOT_ETH1ADDR)),)
ifneq ($(strip $(BR2_TARGET_UBOOT_ETH1ADDR)),"")
$(call insert_define, CONFIG_ETH1ADDR, $(BR2_TARGET_UBOOT_ETH1ADDR))
endif
endif
ifneq ($(strip $(BR2_TARGET_UBOOT_BOOTARGS)),)
ifneq ($(strip $(BR2_TARGET_UBOOT_BOOTARGS)),"")
$(call insert_define, CONFIG_BOOTARGS, $(BR2_TARGET_UBOOT_BOOTARGS))
endif
endif
ifneq ($(strip $(BR2_TARGET_UBOOT_BOOTCMD)),)
ifneq ($(strip $(BR2_TARGET_UBOOT_BOOTCMD)),"")
$(call insert_define, CONFIG_BOOTCOMMAND, $(BR2_TARGET_UBOOT_BOOTCMD))
endif
endif
ifeq ($(BR2_TARGET_UBOOT_SILENT),y)
$(call insert_define, CONFIG_SILENT_CONSOLE,)
endif
ifneq ($(strip $(BR2_TARGET_UBOOT_KERNEL_START)),"")
$(call insert_define, KERNEL_START, $(BR2_TARGET_UBOOT_KERNEL_START))
endif
ifneq ($(strip $(BR2_TARGET_UBOOT_KERNEL_LOCATION)),"")
$(call insert_define, KERNEL_LOCATION, $(BR2_TARGET_UBOOT_KERNEL_LOCATION))
endif
ifneq ($(strip $(BR2_TARGET_UBOOT_FILESYSTEM_START)),"")
$(call insert_define, FILESYSTEM_START, $(BR2_TARGET_UBOOT_FILESYSTEM_START))
endif
ifneq ($(strip $(BR2_TARGET_UBOOT_FILESYSTEM_LOCATION)),"")
$(call insert_define, FILESYSTEM_LOCATION, $(BR2_TARGET_UBOOT_FILESYSTEM_LOCATION))
endif
ifneq ($(strip $(BR2_TARGET_UBOOT_FILESYSTEM_SIZE)),"")
$(call insert_define, FILESYSTEM_SIZE, $(BR2_TARGET_UBOOT_FILESYSTEM_SIZE))
endif
ifneq ($(strip $(BR2_TARGET_UBOOT_END_OF_FLASH)),"")
$(call insert_define, END_OF_FLASH, $(BR2_TARGET_UBOOT_END_OF_FLASH))
endif
ifneq ($(strip $(BR2_TARGET_UBOOT_MEMORY_SIZE)),"")
$(call insert_define, MEMORY_SIZE, $(BR2_TARGET_UBOOT_MEMORY_SIZE))
endif
@echo "#endif /* __BR2_ADDED_CONFIG_H */" >> $(U_BOOT_INC_CONF_FILE)
touch $@
$(U_BOOT_DIR)/$(U_BOOT_BIN): $(U_BOOT_DIR)/.header_modified
$(TARGET_CONFIGURE_OPTS) \
CFLAGS="$(TARGET_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
$(U_BOOT_CONFIGURE_OPTS) \
2008-04-23 15:03:50 +02:00
$(MAKE) CROSS_COMPILE="$(TARGET_CROSS)" ARCH=$(U_BOOT_ARCH) \
2008-04-23 12:30:03 +02:00
-C $(U_BOOT_DIR)
$(BINARIES_DIR)/$(U_BOOT_BIN): $(U_BOOT_DIR)/$(U_BOOT_BIN)
2009-01-02 12:18:09 +01:00
rm -f $(BINARIES_DIR)/$(U_BOOT_BIN)
rm -f $(BINARIES_DIR)/$(U_BOOT_TARGET_BIN)
cp -dpf $(U_BOOT_DIR)/$(U_BOOT_BIN) $(BINARIES_DIR)/$(U_BOOT_TARGET_BIN)
(cd $(BINARIES_DIR); ln -s $(U_BOOT_TARGET_BIN) $(U_BOOT_BIN))
2009-01-02 12:18:09 +01:00
$(U_BOOT_TOOLS): $(U_BOOT_DIR)/tools/$(U_BOOT_TOOLS_BIN)
cp -dpf $(U_BOOT_DIR)/tools/$(U_BOOT_TOOLS_BIN) $(STAGING_DIR)/usr/bin/
$(TARGET_DIR)/usr/bin/mkimage: $(U_BOOT_DIR)/$(U_BOOT_BIN)
mkdir -p $(@D)
$(TARGET_CC) -I$(U_BOOT_DIR)/include -DUSE_HOSTCC -o $@ \
2008-08-20 22:04:18 +02:00
$(U_BOOT_DIR)/tools/mkimage.c \
$(addprefix $(U_BOOT_DIR)/tools/,crc32.c image.c md5.c sha1.c fdt*.c)
$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $@
$(TARGET_DIR)/usr/sbin/fw_printenv: $(U_BOOT_DIR)/$(U_BOOT_BIN)
mkdir -p $(@D)
$(TARGET_CC) -I$(U_BOOT_DIR)/include -I$(LINUX_HEADERS_DIR)/include \
-DUSE_HOSTCC -o $@ \
$(U_BOOT_DIR)/tools/env/*.c $(U_BOOT_DIR)/tools/crc32.c
$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $@
ln -sf fw_printenv $(TARGET_DIR)/usr/sbin/fw_setenv
u-boot: $(U_BOOT_TARGETS)
u-boot-autoscript: $(U_BOOT_AUTOSCRIPT).$(PROJECT)
u-boot-clean:
-$(MAKE) -C $(U_BOOT_DIR) clean
2009-01-02 12:18:09 +01:00
rm -f $(U_BOOT_TOOLS) $(U_BOOT_TARGET_TOOLS)
u-boot-dirclean:
rm -rf $(U_BOOT_DIR)
u-boot-source: $(DL_DIR)/$(U_BOOT_SOURCE)
u-boot-unpacked: $(U_BOOT_DIR)/.patched
u-boot-configured: $(U_BOOT_DIR)/.header_modified
#############################################################
#
# Generate an autoscript with the configration items
#
#############################################################
$(U_BOOT_AUTOSCRIPT): .config
rm -f $(U_BOOT_AUTOSCRIPT)
ifneq ($(TARGET_UBOOT_IPADDR),)
echo setenv ipaddr $(TARGET_UBOOT_IPADDR) > $(U_BOOT_AUTOSCRIPT)
else
echo TARGET_UBOOT_IPADDR="$(TARGET_UBOOT_IPADDR)"
endif
ifneq ($(TARGET_UBOOT_SERVERIP),)
echo setenv serverip $(TARGET_UBOOT_SERVERIP) >> $(U_BOOT_AUTOSCRIPT)
endif
ifneq ($(TARGET_UBOOT_GATEWAY),)
echo setenv gatewayip $(TARGET_UBOOT_GATEWAY) >> $(U_BOOT_AUTOSCRIPT)
endif
ifneq ($(TARGET_UBOOT_NETMASK),)
echo setenv netmask $(TARGET_UBOOT_NETMASK) >> $(U_BOOT_AUTOSCRIPT)
endif
echo setenv linux $(LINUX26_KERNEL_NAME).gz >> $(U_BOOT_AUTOSCRIPT)
echo setenv kernel-version $(LINUX26_VERSION) >> $(U_BOOT_AUTOSCRIPT)
echo setenv kernel-date $(DATE) >> $(U_BOOT_AUTOSCRIPT)
echo setenv hostname $(TARGET_HOSTNAME) >> $(U_BOOT_AUTOSCRIPT)
echo setenv fs-date $(DATE) >> $(U_BOOT_AUTOSCRIPT)
echo setenv rd-1 rootfs.$(ARCH)-$(DATE).ext2 >> $(U_BOOT_AUTOSCRIPT)
echo setenv rd-2 rootfs.$(ARCH)-$(DATE).jffs2 >> $(U_BOOT_AUTOSCRIPT)
echo setenv rd rootfs.$(BR2_ARCH)-$(DATE).ext2 >> $(U_BOOT_AUTOSCRIPT)
echo setenv ver 1 >> $(U_BOOT_AUTOSCRIPT)
ifneq ($(TARGET_UBOOT_ETHADDR),)
echo setenv ethaddr $(TARGET_UBOOT_ETHADDR) >> $(U_BOOT_AUTOSCRIPT)
endif
echo setenv fstype ram >> $(U_BOOT_AUTOSCRIPT)
echo fs >> $(U_BOOT_AUTOSCRIPT)
echo os >> $(U_BOOT_AUTOSCRIPT)
echo setargs >> $(U_BOOT_AUTOSCRIPT)
echo saveenv >> $(U_BOOT_AUTOSCRIPT)
$(U_BOOT_AUTOSCRIPT).$(PROJECT): $(U_BOOT_AUTOSCRIPT) $(MKIMAGE)
$(MKIMAGE) -A $(ARCH) \
-O linux \
-T script \
-C none \
-a 0 \
-e 0 \
-n "autoscr config" \
-d $(U_BOOT_AUTOSCRIPT) \
$(U_BOOT_AUTOSCRIPT).$(PROJECT)
#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(BR2_TARGET_UBOOT),y)
TARGETS+=u-boot
endif
u-boot-status:
@echo
@echo U_BOOT_INC_CONF_FILE = $(U_BOOT_INC_CONF_FILE)
2009-01-02 12:18:09 +01:00
@echo BR2_UBOOT_VERSION = $(BR2_UBOOT_VERSION)
@echo BR2_TARGET_U_BOOT_CONFIG_HEADER_FILE = $(BR2_TARGET_U_BOOT_CONFIG_HEADER_FILE)
@echo BR2_TARGET_U_BOOT_CONFIG_BOARD = $(BR2_TARGET_U_BOOT_CONFIG_BOARD)
@echo BR2_TARGET_UBOOT_SERVERIP = $(BR2_TARGET_UBOOT_SERVERIP)
@echo BR2_TARGET_UBOOT_IPADDR = $(BR2_TARGET_UBOOT_IPADDR)
@echo BR2_TARGET_UBOOT_GATEWAY = $(BR2_TARGET_UBOOT_GATEWAY)
@echo BR2_TARGET_UBOOT_NETMASK = $(BR2_TARGET_UBOOT_NETMASK)
@echo BR2_TARGET_UBOOT_ETH0ADDR = $(BR2_TARGET_UBOOT_ETHADDR)
@echo BR2_TARGET_UBOOT_ETH1ADDR = $(BR2_TARGET_UBOOT_ETH1ADDR)
@echo BR2_TARGET_UBOOT_BOOTARGS = $(BR2_TARGET_UBOOT_BOOTARGS)
@echo BR2_TARGET_UBOOT_BOOTCMD = $(BR2_TARGET_UBOOT_BOOTCMD)
@echo BR2_TARGET_UBOOT_SILENT = $(BR2_TARGET_UBOOT_SILENT)
2009-01-02 12:18:09 +01:00
@echo UBOOT_BOARD_NAME=$(UBOOT_BOARD_NAME)
@echo TEST=$(TEST)
@exit 0
2009-01-02 12:18:09 +01:00