1 # Defaults, if not set in the platform config
2 ifeq ($(CONFIG_TARGET_64BIT
),y
)
5 UCLIBC_CONFIG ?
= defconfig-x86_64
9 UCLIBC_CONFIG ?
= defconfig
12 ifeq ($(findstring defconfig
,$(UCLIBC_CONFIG
)),defconfig
)
13 ifeq ($(shell if
[ -f
$(PACKAGE_DIR
)/uclibc
/conf
/customconfig--
$(PAYLOAD
)--$(UCLIBC_ARCH
)--$(COREBOOT_VENDOR
)-$(COREBOOT_BOARD
) ]; then echo
1; fi
),1)
14 UCLIBC_CONFIG
= customconfig--
$(PAYLOAD
)--$(UCLIBC_ARCH
)--$(COREBOOT_VENDOR
)-$(COREBOOT_BOARD
)
18 UCLIBC_URL
=http
://www.uclibc.org
/downloads
19 UCLIBC_SOURCE
=uClibc-
$(UCLIBC_VER
).
tar.bz2
20 UCLIBC_DIR
=$(BUILD_DIR
)/uclibc
21 UCLIBC_SRC_DIR
=$(UCLIBC_DIR
)/uClibc-
$(UCLIBC_VER
)
22 UCLIBC_STAMP_DIR
=$(UCLIBC_DIR
)/stamps
23 UCLIBC_LOG_DIR
=$(UCLIBC_DIR
)/logs
25 ifeq ($(CONFIG_VERBOSE
),y
)
26 UCLIBC_BUILD_LOG
=/dev
/stdout
27 UCLIBC_INSTALL_LOG
=/dev
/stdout
29 UCLIBC_BUILD_LOG
=$(UCLIBC_LOG_DIR
)/build.log
30 UCLIBC_INSTALL_LOG
=$(UCLIBC_LOG_DIR
)/install.log
33 $(SOURCE_DIR
)/$(UCLIBC_SOURCE
):
34 @ echo
"Downloading uclibc..."
35 @ mkdir
-p
$(SOURCE_DIR
)
36 @ wget
$(WGET_Q
) -P
$(SOURCE_DIR
) $(UCLIBC_URL
)/$(UCLIBC_SOURCE
)
38 $(UCLIBC_STAMP_DIR
)/.unpacked
: $(SOURCE_DIR
)/$(UCLIBC_SOURCE
) |
$(UCLIBC_STAMP_DIR
) $(UCLIBC_DIR
)
39 @ echo
"Unpacking uclibc..."
40 @
tar -C
$(UCLIBC_DIR
) -jxf
$(SOURCE_DIR
)/$(UCLIBC_SOURCE
)
43 $(UCLIBC_SRC_DIR
)/.config
: $(UCLIBC_STAMP_DIR
)/.unpacked
44 @ cat
$(PACKAGE_DIR
)/uclibc
/conf
/$(UCLIBC_CONFIG
) | sed
-e s
:^KERNEL_HEADERS
=.
*:KERNEL_HEADERS
=\"$(KERNEL_SRC_DIR
)/include\": > $(UCLIBC_SRC_DIR
)/.config
46 $(UCLIBC_SRC_DIR
)/lib
/libc.a
: $(UCLIBC_SRC_DIR
)/.config
47 @ echo
"Building uclibc..."
48 ifneq ($(findstring defconfig
,$(UCLIBC_CONFIG
)),defconfig
)
49 @ echo
"Using custom config $(PACKAGE_DIR)/uclibc/conf/$(UCLIBC_CONFIG)"
51 @
( unset CFLAGS
; unset LDFLAGS
; \
52 $(MAKE
) $(PARALLEL_MAKE
) -C
$(UCLIBC_SRC_DIR
) TARGET_ARCH
="$(UCLIBC_ARCH)" \
53 CC
="$(CC) $(CROSS_CFLAGS)" LD
="$(LD) $(CROSS_LDFLAGS)" \
54 HOSTCC
="$(HOST_CC)" KERNEL_SOURCE
="$(KERNEL_SRC_DIR)" \
56 SHARED_LIB_LOADER_PATH
="/lib" \
57 SHARED_LIB_LOADER_PREFIX
="/lib" \
58 all > $(UCLIBC_BUILD_LOG
) 2>&1)
59 @ mkdir
-p
$(OUTPUT_DIR
)/config
/uclibc
60 @ cp
$(UCLIBC_SRC_DIR
)/.config
$(OUTPUT_DIR
)/config
/uclibc
/
62 $(STAGING_DIR
)/lib
/libc.a
: $(UCLIBC_SRC_DIR
)/lib
/libc.a
63 @
$(MAKE
) -C
$(UCLIBC_SRC_DIR
) \
65 DEVEL_PREFIX
=$(STAGING_DIR
)/ \
66 RUNTIME_PREFIX
=$(STAGING_DIR
)/ \
67 install_runtime install_dev
> $(UCLIBC_INSTALL_LOG
) 2>&1
69 $(UCLIBC_SRC_DIR
)/utils
/ldd
: $(UCLIBC_SRC_DIR
)/lib
/libc.a
70 @
$(MAKE
) -C
$(UCLIBC_SRC_DIR
)/utils ldd
72 $(STAGING_DIR
)/bin
/ldd
: $(UCLIBC_SRC_DIR
)/utils
/ldd
73 @
install -m
755 -d
$(STAGING_DIR
)/bin
74 @
install -m
755 $< $@
76 $(UCLIBC_STAMP_DIR
) $(UCLIBC_LOG_DIR
) $(UCLIBC_DIR
):
79 uclibc
: $(UCLIBC_STAMP_DIR
) $(UCLIBC_LOG_DIR
) $(STAGING_DIR
)/lib
/libc.a
82 @ echo
"Cleaning uclibc..."
83 ifneq ($(wildcard $(UCLIBC_SRC_DIR
)/Makefile
),)
84 @
$(MAKE
) -C
$(UCLIBC_SRC_DIR
) clean > /dev
/null
2>&1
88 @
rm -rf
$(UCLIBC_DIR
)/*
91 @ echo
"Package: uclibc"
92 @ echo
"Source: $(UCLIBC_URL)/$(UCLIBC_SOURCE)"
95 uclibc-extract
: $(UCLIBC_STAMP_DIR
)/.unpacked
97 uclibc-config
: |
$(UCLIBC_SRC_DIR
)/.config
98 ifeq ($(shell if
[ -f
$(PACKAGE_DIR
)/uclibc
/conf
/customconfig--
$(PAYLOAD
)--$(UCLIBC_ARCH
)--$(COREBOOT_VENDOR
)-$(COREBOOT_BOARD
) ]; then echo
1; fi
),1)
99 @ cp
-f
$(PACKAGE_DIR
)/uclibc
/conf
/customconfig--
$(PAYLOAD
)--$(UCLIBC_ARCH
)--$(COREBOOT_VENDOR
)-$(COREBOOT_BOARD
) $(UCLIBC_SRC_DIR
)/.config
101 ifeq (uclibc
,$(filter uclibc
,$(PAYLOAD-y
)))
102 @ echo
"Configure uclibc..."
103 @
$(MAKE
) -C
$(UCLIBC_SRC_DIR
) TARGET_ARCH
="$(UCLIBC_ARCH)" menuconfig
105 ifeq ($(shell if
[ -f
$(PACKAGE_DIR
)/uclibc
/conf
/customconfig--
$(PAYLOAD
)--$(UCLIBC_ARCH
)--$(COREBOOT_VENDOR
)-$(COREBOOT_BOARD
) ]; then echo
1; fi
),1)
106 @ echo
"Found an existing custom configuration file:"
107 @ echo
" $(PACKAGE_DIR)/uclibc/conf/customconfig--$(PAYLOAD)--$(UCLIBC_ARCH)--$(COREBOOT_VENDOR)-$(COREBOOT_BOARD)"
108 @ echo
"I've copied it back to the source directory for modification."
109 @ echo
"Remove the above file and re-run this command if you want to create a new custom configuration from scratch for this payload/board."
112 @ cp
-f
$(UCLIBC_SRC_DIR
)/.config
$(PACKAGE_DIR
)/uclibc
/conf
/customconfig--
$(PAYLOAD
)--$(UCLIBC_ARCH
)--$(COREBOOT_VENDOR
)-$(COREBOOT_BOARD
)
113 @ echo
"Your custom uclibc config file has been saved as $(PACKAGE_DIR)/uclibc/conf/customconfig--$(PAYLOAD)--$(UCLIBC_ARCH)--$(COREBOOT_VENDOR)-$(COREBOOT_BOARD)."
116 @ echo
"Your payload does not require uclibc."