2008-03-11 19:26:07 +01:00
|
|
|
#############################################################
|
|
|
|
#
|
|
|
|
# U-Boot
|
|
|
|
#
|
|
|
|
#############################################################
|
2008-08-20 22:04:18 +02:00
|
|
|
U_BOOT_VERSION:=1.3.4
|
2008-03-11 19:26:07 +01:00
|
|
|
U_BOOT_SOURCE:=u-boot-$(U_BOOT_VERSION).tar.bz2
|
|
|
|
U_BOOT_SITE:=ftp://ftp.denx.de/pub/u-boot
|
|
|
|
U_BOOT_DIR:=$(PROJECT_BUILD_DIR)/u-boot-$(U_BOOT_VERSION)
|
|
|
|
U_BOOT_PATCH_DIR:=$(PROJECT_BUILD_DIR)/u-boot-patches
|
|
|
|
U_BOOT_CAT:=$(BZCAT)
|
|
|
|
U_BOOT_BIN:=u-boot.bin
|
|
|
|
U_BOOT_TOOLS_BIN:=mkimage
|
2008-04-23 12:30:03 +02:00
|
|
|
# u-boot still uses arch=ppc for powerpc
|
2008-06-12 09:27:48 +02:00
|
|
|
U_BOOT_ARCH=$(KERNEL_ARCH:powerpc=ppc)
|
2008-03-11 19:26:07 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2008-04-23 15:03:53 +02:00
|
|
|
U_BOOT_TARGET_TOOLS:=
|
|
|
|
ifeq ($(strip $(BR2_TARGET_UBOOT_TOOL_MKIMAGE)),y)
|
|
|
|
U_BOOT_TARGET_TOOLS+=$(TARGET_DIR)/usr/bin/mkimage
|
|
|
|
endif
|
|
|
|
ifeq ($(strip $(BR2_TARGET_UBOOT_TOOL_ENV)),y)
|
|
|
|
U_BOOT_TARGET_TOOLS+=$(TARGET_DIR)/usr/sbin/fw_printenv
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2008-03-11 19:26:07 +01:00
|
|
|
# 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)
|
2008-08-20 22:04:14 +02:00
|
|
|
@echo '#define $(strip $(1)) $(2)' >> $(U_BOOT_INC_CONF_FILE)
|
2008-03-11 19:26:07 +01:00
|
|
|
endef
|
2008-04-01 09:03:07 +02:00
|
|
|
|
2008-03-11 19:26:07 +01:00
|
|
|
$(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) -
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(U_BOOT_DIR)/.patched: $(U_BOOT_DIR)/.unpacked
|
|
|
|
toolchain/patch-kernel.sh $(U_BOOT_DIR) target/u-boot/ \
|
2008-04-23 16:52:38 +02:00
|
|
|
u-boot-$(U_BOOT_VERSION)-\*.patch \
|
|
|
|
u-boot-$(U_BOOT_VERSION)-\*.patch.$(ARCH)
|
2008-03-11 19:26:07 +01:00
|
|
|
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
|
2008-03-11 19:26:07 +01:00
|
|
|
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)" \
|
|
|
|
$(MAKE) -C $(U_BOOT_DIR) \
|
|
|
|
$(BR2_TARGET_UBOOT_BOARDNAME)_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)
|
|
|
|
ifneq ($(strip $(BR2_PROJECT)),"")
|
2008-08-20 22:04:14 +02:00
|
|
|
$(call insert_define, CONFIG_HOSTNAME, $(BR2_PROJECT))
|
2008-03-11 19:26:07 +01:00
|
|
|
endif
|
|
|
|
ifneq ($(strip $(BR2_TARGET_UBOOT_SERVERIP)),"")
|
2008-08-20 22:04:14 +02:00
|
|
|
$(call insert_define, CONFIG_SERVERIP, $(BR2_TARGET_UBOOT_SERVERIP))
|
2008-03-11 19:26:07 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(strip $(BR2_TARGET_UBOOT_IPADDR)),"")
|
2008-08-20 22:04:14 +02:00
|
|
|
$(call insert_define, CONFIG_IPADDR, $(BR2_TARGET_UBOOT_IPADDR))
|
2008-03-11 19:26:07 +01:00
|
|
|
ifneq ($(strip $(BR2_TARGET_UBOOT_GATEWAY)),"")
|
2008-08-20 22:04:14 +02:00
|
|
|
$(call insert_define, CONFIG_GATEWAYIP, $(BR2_TARGET_UBOOT_GATEWAY))
|
2008-03-11 19:26:07 +01:00
|
|
|
endif
|
|
|
|
ifneq ($(strip $(BR2_TARGET_UBOOT_NETMASK)),"")
|
2008-08-20 22:04:14 +02:00
|
|
|
$(call insert_define, CONFIG_NETMASK, $(BR2_TARGET_UBOOT_NETMASK))
|
2008-03-11 19:26:07 +01:00
|
|
|
endif
|
|
|
|
endif # end BR2_TARGET_U_BOOT_IPADDR
|
|
|
|
|
|
|
|
ifneq ($(strip $(BR2_TARGET_UBOOT_ETHADDR)),"")
|
2008-08-20 22:04:14 +02:00
|
|
|
$(call insert_define, CONFIG_ETHADDR, $(BR2_TARGET_UBOOT_ETHADDR))
|
2008-03-11 19:26:07 +01:00
|
|
|
endif
|
|
|
|
ifneq ($(strip $(BR2_TARGET_UBOOT_ETH1ADDR)),"")
|
2008-08-20 22:04:14 +02:00
|
|
|
$(call insert_define, CONFIG_ETH2ADDR, $(BR2_TARGET_UBOOT_ETH1ADDR))
|
2008-03-11 19:26:07 +01:00
|
|
|
endif
|
|
|
|
ifneq ($(strip $(BR2_TARGET_UBOOT_BOOTARGS)),"")
|
2008-08-20 22:04:14 +02:00
|
|
|
$(call insert_define, CONFIG_BOOTARGS, $(BR2_TARGET_UBOOT_BOOTARGS))
|
2008-03-11 19:26:07 +01:00
|
|
|
endif
|
|
|
|
ifneq ($(strip $(BR2_TARGET_UBOOT_BOOTCMD)),"")
|
2008-08-20 22:04:14 +02:00
|
|
|
$(call insert_define, CONFIG_BOOTCOMMAND, $(BR2_TARGET_UBOOT_BOOTCMD))
|
2008-03-11 19:26:07 +01:00
|
|
|
endif
|
2008-08-20 22:04:14 +02:00
|
|
|
ifeq ($(strip $(BR2_TARGET_UBOOT_SILENT)),y)
|
|
|
|
$(call insert_define, CONFIG_SILENT_CONSOLE,)
|
2008-03-11 19:26:07 +01:00
|
|
|
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)" \
|
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)
|
2008-03-11 19:26:07 +01:00
|
|
|
|
|
|
|
$(BINARIES_DIR)/$(U_BOOT_BIN): $(U_BOOT_DIR)/$(U_BOOT_BIN)
|
|
|
|
cp -dpf $(U_BOOT_DIR)/$(U_BOOT_BIN) $(BINARIES_DIR)
|
|
|
|
cp -dpf $(U_BOOT_DIR)/tools/$(U_BOOT_TOOLS_BIN) $(STAGING_DIR)/usr/bin/
|
|
|
|
|
2008-04-23 15:03:53 +02:00
|
|
|
$(TARGET_DIR)/usr/bin/mkimage: $(U_BOOT_DIR)/$(U_BOOT_BIN)
|
2008-06-17 10:04:15 +02:00
|
|
|
mkdir -p $(@D)
|
2008-04-23 15:03:53 +02:00
|
|
|
$(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)
|
2008-04-23 15:03:53 +02:00
|
|
|
$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $@
|
|
|
|
|
|
|
|
$(TARGET_DIR)/usr/sbin/fw_printenv: $(U_BOOT_DIR)/$(U_BOOT_BIN)
|
2008-06-17 10:04:15 +02:00
|
|
|
mkdir -p $(@D)
|
2008-04-23 15:03:53 +02:00
|
|
|
$(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) $@
|
2008-04-23 16:52:35 +02:00
|
|
|
ln -sf fw_printenv $(TARGET_DIR)/usr/sbin/fw_setenv
|
2008-04-23 15:03:53 +02:00
|
|
|
|
2008-06-13 15:46:42 +02:00
|
|
|
u-boot: $(BINARIES_DIR)/$(U_BOOT_BIN) $(U_BOOT_TARGET_TOOLS)
|
2008-03-11 19:26:07 +01:00
|
|
|
|
|
|
|
u-boot-clean:
|
2008-04-01 09:03:07 +02:00
|
|
|
-$(MAKE) -C $(U_BOOT_DIR) clean
|
2008-04-23 15:03:53 +02:00
|
|
|
rm -f $(STAGING_DIR)/usr/bin/$(U_BOOT_TOOLS_BIN) $(U_BOOT_TARGET_TOOLS)
|
2008-03-11 19:26:07 +01:00
|
|
|
|
|
|
|
u-boot-dirclean:
|
|
|
|
rm -rf $(U_BOOT_DIR)
|
|
|
|
|
|
|
|
u-boot-source: $(DL_DIR)/$(U_BOOT_SOURCE)
|
|
|
|
|
|
|
|
#############################################################
|
|
|
|
#
|
|
|
|
# Toplevel Makefile options
|
|
|
|
#
|
|
|
|
#############################################################
|
|
|
|
ifeq ($(strip $(BR2_TARGET_UBOOT)),y)
|
|
|
|
TARGETS+=u-boot
|
|
|
|
endif
|
|
|
|
|
|
|
|
u-boot-status:
|
|
|
|
@echo
|
|
|
|
@echo U_BOOT_INC_CONF_FILE = $(U_BOOT_INC_CONF_FILE)
|
|
|
|
@echo
|
|
|
|
@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)
|
|
|
|
@echo
|
|
|
|
@exit 0
|