1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
DESCRIPTION = "C library for embedded systems"
LICENSE = "LGPL"
SECTION = "libs"
PRIORITY = "required"
MAINTAINER = "Gerald Britton <gbritton@doomcom.org>"
# We want to select whether we're building a uclibc or glibc system and
# perform provides accordingly. We want to trigger on the original
# TARGET_VENDOR setting, so we must do this before changing it.
def target_is_uclibc(d):
import oe
if (oe.data.getVar('TARGET_VENDOR', d, 1) == '-uclibc'):
return 1
return 0
def cond_provides(d):
import oe
if target_is_uclibc(d):
return 'virtual/libc'
return ''
def cond_packages(d):
import oe
if target_is_uclibc(d):
return '${PN} ${PN}-doc ${PN}-dev ${PN}-locale'
return '${PN}-compat'
PROVIDES := "${@cond_provides(d)}"
PACKAGES := "${@cond_packages(d)}"
# When target is not a uclibc system, do a compat-only package
FILES_${PN}-compat = "${libdir}/lib*.so.* /lib/*.so*"
# This will ONLY build to this target (we override it incase we're buliding
# the world for a glibc system)
TARGET_VENDOR = "-uclibc"
TARGET_SYS = "${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
TARGET_PREFIX = "${TARGET_SYS}-"
FILESDIR = "${@os.path.dirname(oe.data.getVar('FILE',d,1))}/uclibc-${PV}"
DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc-initial"
SRC_URI = "http://www.uclibc.org/downloads/uClibc-${PV}.tar.bz2 \
http://www.uclibc.org/downloads/toolchain/kernel-headers-2.4.21.tar.bz2"
S = "${WORKDIR}/uClibc-${PV}"
UCLIBC_PREFIX = "${CROSS_DIR}/${TARGET_SYS}"
UCLIBC_STAGE_PREFIX = "${STAGING_DIR}/${HOST_SYS}"
EXTRA_OEMAKE = ""
uclibcbuild_do_patch() {
rm -f ${WORKDIR}/linux/include/asm
ln -sf asm-${TARGET_ARCH} ${WORKDIR}/linux/include/asm
touch ${WORKDIR}/linux/include/linux/autoconf.h
echo "#define UTS_RELEASE \"2.4.21\"" > ${WORKDIR}/linux/include/linux/version.h
echo "#define LINUX_VERSION_CODE 132117" >> ${WORKDIR}/linux/include/linux/version.h
echo "#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))" \
>> ${WORKDIR}/linux/include/linux/version.h
if [ -f ${FILESDIR}/uClibc.config.${TARGET_ARCH} ]; then
cp ${FILESDIR}/uClibc.config.${TARGET_ARCH} ${S}/.config
else
echo ERROR: No target specific config for ${TARGET_ARCH}
fi
perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=${TARGET_ARCH}\nCROSS=${TARGET_PREFIX},g' ${S}/Rules.mak
perl -i -p -e 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"${WORKDIR}/linux\",g' ${S}/.config
perl -i -p -e 's,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX=\"/\",g' ${S}/.config
perl -i -p -e 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"/${prefix}\",g' ${S}/.config
perl -i -p -e 's,^SHARED_LIB_LOADER_PATH=.*,SHARED_LIB_LOADER_PATH=\"/lib\",g' ${S}/.config
perl -i -p -e 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y\nUCLIBC_HAS_LOCALE=n,g' ${S}/.config
make oldconfig
}
python do_patch () {
oe.build.exec_func('base_do_patch', d)
oe.build.exec_func('uclibcbuild_do_patch', d)
}
do_stage() {
# Install into the cross dir (this MUST be done first because we
# will install crt1.o in the install_dev stage and gcc needs it)
make PREFIX= DEVEL_PREFIX=${UCLIBC_PREFIX}/ \
RUNTIME_PREFIX=${UCLIBC_PREFIX}/ \
install_dev install_runtime install_utils
# We don't really need this
rm -f ${UCLIBC_PREFIX}/include/.cvsignore
# Fixup shared lib symlinks
( cd ${UCLIBC_STAGE_PREFIX}/lib
for f in c crypt dl m nsl pthread resolv thread_db util; do
ln -sf lib${f}.so.? lib${f}.so
done
)
# Install into the staging dir
make PREFIX= DEVEL_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
RUNTIME_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
install_dev install_runtime install_utils
# We don't really need this
rm -f ${UCLIBC_STAGE_PREFIX}/include/.cvsignore
# Fixup shared lib symlinks
( cd ${UCLIBC_STAGE_PREFIX}/lib
for f in c crypt dl m nsl pthread resolv thread_db util; do
ln -sf lib${f}.so.? lib${f}.so
done
)
}
do_install() {
make PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \
install_dev install_runtime install_utils
# We don't really need this in /usr/include
rm -f ${D}/${prefix}/include/.cvsignore
}
|