Lines 16-22
Link Here
|
16 |
# This will be able to go away once the klibc author updates his code |
16 |
# This will be able to go away once the klibc author updates his code |
17 |
# to build again the headers provided by the kernel's 'headers_install' target. |
17 |
# to build again the headers provided by the kernel's 'headers_install' target. |
18 |
|
18 |
|
19 |
inherit eutils multilib toolchain-funcs |
19 |
inherit eutils multilib toolchain-funcs savedconfig |
20 |
|
20 |
|
21 |
DESCRIPTION="A minimal libc subset for use with initramfs." |
21 |
DESCRIPTION="A minimal libc subset for use with initramfs." |
22 |
HOMEPAGE="http://www.zytor.com/mailman/listinfo/klibc" |
22 |
HOMEPAGE="http://www.zytor.com/mailman/listinfo/klibc" |
Lines 39-45
Link Here
|
39 |
LICENSE="|| ( GPL-2 LGPL-2 )" |
39 |
LICENSE="|| ( GPL-2 LGPL-2 )" |
40 |
KEYWORDS="~amd64 -mips ~ppc ~sparc ~x86 ~arm" |
40 |
KEYWORDS="~amd64 -mips ~ppc ~sparc ~x86 ~arm" |
41 |
SLOT="0" |
41 |
SLOT="0" |
42 |
IUSE="debug n32" |
42 |
IUSE="debug n32 savedconfig" |
43 |
|
43 |
|
44 |
DEPEND="dev-lang/perl" |
44 |
DEPEND="dev-lang/perl" |
45 |
RDEPEND="${DEPEND}" |
45 |
RDEPEND="${DEPEND}" |
Lines 51-56
Link Here
|
51 |
# Do not strip |
51 |
# Do not strip |
52 |
RESTRICT="strip" |
52 |
RESTRICT="strip" |
53 |
|
53 |
|
|
|
54 |
SAVED_DEFCONFIG_SRC="${PORTAGE_CONFIGROOT}etc/portage/savedconfig/${CATEGORY}/${PF}" |
55 |
|
54 |
kernel_asm_arch() { |
56 |
kernel_asm_arch() { |
55 |
a="${1:${ARCH}}" |
57 |
a="${1:${ARCH}}" |
56 |
case ${a} in |
58 |
case ${a} in |
Lines 63-72
Link Here
|
63 |
esac |
65 |
esac |
64 |
} |
66 |
} |
65 |
|
67 |
|
|
|
68 |
savedconfig_dst() { |
69 |
local a="$(kernel_asm_arch ${ARCH})" |
70 |
echo "${KS}/arch/${a}/configs/savedconfig_defconfig" |
71 |
} |
72 |
|
73 |
# for non-standardized defconfigs (e.g. arm*) |
74 |
require_savedconfig() { |
75 |
case ${ARCH} in |
76 |
arm*) return 0 ;; |
77 |
*) return 1 ;; |
78 |
esac |
79 |
} |
80 |
|
66 |
# For a given Gentoo ARCH, |
81 |
# For a given Gentoo ARCH, |
67 |
# specify the kernel defconfig most relevant |
82 |
# specify the kernel defconfig most relevant |
68 |
kernel_defconfig() { |
83 |
kernel_defconfig() { |
69 |
a="${1:${ARCH}}" |
84 |
a="${1:${ARCH}}" |
|
|
85 |
# for arches that do not have a standard defconfig (e.g. arm) |
86 |
if require_savedconfig ; then |
87 |
echo savedconfig_defconfig |
88 |
return |
89 |
fi |
70 |
# most, but not all arches have a sanely named defconfig |
90 |
# most, but not all arches have a sanely named defconfig |
71 |
case ${a} in |
91 |
case ${a} in |
72 |
ppc64) echo ppc64_defconfig ;; |
92 |
ppc64) echo ppc64_defconfig ;; |
Lines 77-82
Link Here
|
77 |
} |
97 |
} |
78 |
|
98 |
|
79 |
src_unpack() { |
99 |
src_unpack() { |
|
|
100 |
|
101 |
# do first to avoid wasting time or resources |
102 |
if require_savedconfig ; then |
103 |
if ! use savedconfig ; then |
104 |
eerror "Your ARCH requires a saved defconfig located at" |
105 |
eerror "${SAVED_DEFCONFIG_SRC}" |
106 |
eerror "Please create the file using linux-${OKV}, and then add" |
107 |
eerror "\"dev-libs/klibc savedconfig\" to " |
108 |
eerror "${PORTAGE_CONFIGROOT}etc/portage/package.use" |
109 |
die "USE=\"savedconfig\" is required for ARCH=${ARCH}" |
110 |
else |
111 |
if [ ! -f "${SAVED_DEFCONFIG_SRC}" ]; then |
112 |
eerror "Your savedconfig file does not exist at" |
113 |
eerror "${SAVED_DEFCONFIG_SRC}" |
114 |
eerror "Please create the file using linux-${OKV}." |
115 |
die "${SAVED_DEFCONFIG_SRC}: No such file or directory." |
116 |
fi |
117 |
fi |
118 |
else |
119 |
if use savedconfig ; then |
120 |
ewarn "Using a saved defconfig with ARCH=${ARCH} is discouraged and also completely" |
121 |
ewarn "unsupported. You have been warned." |
122 |
epause |
123 |
fi |
124 |
fi |
125 |
|
80 |
unpack linux-${OKV}.tar.bz2 ${P}.tar.bz2 |
126 |
unpack linux-${OKV}.tar.bz2 ${P}.tar.bz2 |
81 |
[ -n "${PKV}" ] && EPATCH_OPTS="-d ${KS} -p1" epatch "${DISTDIR}"/patch-${PKV}.bz2 |
127 |
[ -n "${PKV}" ] && EPATCH_OPTS="-d ${KS} -p1" epatch "${DISTDIR}"/patch-${PKV}.bz2 |
82 |
cd "${S}" |
128 |
cd "${S}" |
Lines 102-107
Link Here
|
102 |
|
148 |
|
103 |
# bug 229525, usr/include/arch/x86_64/sys/io.h has undefined variables |
149 |
# bug 229525, usr/include/arch/x86_64/sys/io.h has undefined variables |
104 |
epatch "${FILESDIR}"/${PN}-1.5.11-x86_64-io.h-return.diff |
150 |
epatch "${FILESDIR}"/${PN}-1.5.11-x86_64-io.h-return.diff |
|
|
151 |
|
152 |
if use savedconfig ; then |
153 |
restore_config "$(savedconfig_dst)" || die |
154 |
fi |
105 |
} |
155 |
} |
106 |
|
156 |
|
107 |
# klibc has it's own ideas of arches |
157 |
# klibc has it's own ideas of arches |