1 |
commit: 1fa40d404d2e4513bb6d2f41d7839742c063c8c9 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jan 1 16:31:11 2020 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jan 1 22:00:32 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1fa40d40 |
7 |
|
8 |
sys-kernel/vanilla-kernel: Bump to 5.4.7 |
9 |
|
10 |
Strip installed files to the bare minimum while at it, following |
11 |
CentOS' kernel-devel packages. |
12 |
|
13 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
14 |
|
15 |
sys-kernel/vanilla-kernel/Manifest | 2 + |
16 |
.../vanilla-kernel/vanilla-kernel-5.4.7.ebuild | 284 +++++++++++++++++++++ |
17 |
2 files changed, 286 insertions(+) |
18 |
|
19 |
diff --git a/sys-kernel/vanilla-kernel/Manifest b/sys-kernel/vanilla-kernel/Manifest |
20 |
index a3a71cc7a0d..b56d5ea7045 100644 |
21 |
--- a/sys-kernel/vanilla-kernel/Manifest |
22 |
+++ b/sys-kernel/vanilla-kernel/Manifest |
23 |
@@ -1,5 +1,7 @@ |
24 |
DIST linux-5.4.3-arch1.i686.config 241295 BLAKE2B 795b6286bd1e7dc6aa5c1428e7bf08c204ce6c8cbee57863e9f64f8990790cc4398a7d062b54c89b1b80640f02a40fce028d9397725db0f968e8028b0611a20f SHA512 8c7387ded21c02b9cffee0e6d61a7040c44deae21764f743f7719f0d1c7adf684f6b62a501fe31709787ba741859e55fc3b8a3d3d27e52c09f2d8604212bf0a7 |
25 |
DIST linux-5.4.4.arch1-1.amd64.config 241587 BLAKE2B 71db76bf30a8d7f4dc680399b9f9fbb4236d1938bb86e23eb1ab236a667a959fc1cff788f7e432c43a6173e1bac4e20f3a6c3391d84275d46f1f66bd338bf538 SHA512 34d66658963dbd72fa3e96f2c5d5bccafb781fa14f6ebafe7859953929ba2fbb112f1435ca68cec8389d789cf0efa81d5fc0f5ac6dfa23a704348ab83709e9db |
26 |
DIST linux-5.4.6.tar.xz 109454640 BLAKE2B 8619492fedd4ae489a811561f72285b69deb827bb1db1f65be2a128d3bcbb69bdeec6b73650e1e8f72b18e5016c2df092bc77ee38be756d35f2903ecf0db1687 SHA512 9e1153e80303d6d5016856a25f3757259a3a428bad11208192315088d1f1a09957f5b8e966ab8cb5842ce1a740760f87474066294f8b410e9c44c810838bcdac |
27 |
+DIST linux-5.4.7.arch1-1.amd64.config 241598 BLAKE2B 536cce5cc23cf20e71cba7468a125557f85d8ffc3cb194dced79bd489d39f2e4ed3960816d15d1491007d11b3af466e0a74267f983dfcc5f511f9f566f7e9821 SHA512 8658db603e180c75caf76972d85ecf8a4e9c9cf6e047b4f9fc7cba0fa426f434361528c1c29b5580f116cdd23091bf9afb6635d751f3b90c4e968d16db90eac1 |
28 |
+DIST linux-5.4.7.tar.xz 109448088 BLAKE2B 70197bb6955253710be5b56660dd6e224d3415f9074afeac9525d28089a6c1aa307408cf6bf460370093b8d079837850136a06dee2f3203370ed6cd8ab4d6e66 SHA512 b3b6c843bb8210acf04d294887b527c2da10507ac731fe9f6f04cd21486d519cda5767a2ba094f10886717720ca3bd3dee22a650c213b7f8f6c1f825396dbed4 |
29 |
DIST tinycorelinux-10.1-amd64.qcow2 16842752 BLAKE2B e013e76503c335739a9623c0901ca791937a0e6b177854535cadec1e2c2cd2df588283ed3128cf652595f32264fbfe5b3bd3a8c97665fd4da344e308535be366 SHA512 c3aeb20ff8769da9211694b7f701907cc7ae7582cdfad2c2fdc008d97ebcbd9dc08245b4e8f8450e1cb304bd705345a11fe79f901a47979fee91443841d55641 |
30 |
DIST tinycorelinux-10.1-x86.qcow2 14876672 BLAKE2B 3c760eb7438b13261e52ecfaa33a53649ced95f1ab40aae52134b8cdc31a16d7aa0d6a6dd716e268ed148e9d77a10b7c700b141b61d70c82d271ffe88e8e2a3c SHA512 9964538dc42f232a11949f74b61d46422ea5da3bdc253a217119bd0b8a750c40fd2da0b07157067be9ac0226472614f210a1248114df0d331df390979867a895 |
31 |
|
32 |
diff --git a/sys-kernel/vanilla-kernel/vanilla-kernel-5.4.7.ebuild b/sys-kernel/vanilla-kernel/vanilla-kernel-5.4.7.ebuild |
33 |
new file mode 100644 |
34 |
index 00000000000..e4705ad0558 |
35 |
--- /dev/null |
36 |
+++ b/sys-kernel/vanilla-kernel/vanilla-kernel-5.4.7.ebuild |
37 |
@@ -0,0 +1,284 @@ |
38 |
+# Copyright 2019-2020 Gentoo Authors |
39 |
+# Distributed under the terms of the GNU General Public License v2 |
40 |
+ |
41 |
+EAPI=7 |
42 |
+ |
43 |
+inherit mount-boot savedconfig toolchain-funcs |
44 |
+ |
45 |
+MY_P=linux-${PV} |
46 |
+TCL_VER=10.1 |
47 |
+AMD64_CONFIG_VER=5.4.7.arch1-1 |
48 |
+AMD64_CONFIG_HASH=ff79453bc0451a9083bdaa02c3901372d61a9982 |
49 |
+I686_CONFIG_VER=5.4.3-arch1 |
50 |
+I686_CONFIG_HASH=076a52d43a08c4b3a3eacd1f2f9a855fb3b62f42 |
51 |
+ |
52 |
+DESCRIPTION="Linux kernel built from vanilla upstream sources" |
53 |
+HOMEPAGE="https://www.kernel.org/" |
54 |
+SRC_URI="https://cdn.kernel.org/pub/linux/kernel/v5.x/${MY_P}.tar.xz |
55 |
+ amd64? ( |
56 |
+ https://git.archlinux.org/svntogit/packages.git/plain/trunk/config?h=packages/linux&id=${AMD64_CONFIG_HASH} |
57 |
+ -> linux-${AMD64_CONFIG_VER}.amd64.config |
58 |
+ test? ( |
59 |
+ https://dev.gentoo.org/~mgorny/dist/tinycorelinux-${TCL_VER}-amd64.qcow2 |
60 |
+ ) |
61 |
+ ) |
62 |
+ x86? ( |
63 |
+ https://git.archlinux32.org/packages/plain/core/linux/config.i686?id=${I686_CONFIG_HASH} |
64 |
+ -> linux-${I686_CONFIG_VER}.i686.config |
65 |
+ test? ( |
66 |
+ https://dev.gentoo.org/~mgorny/dist/tinycorelinux-${TCL_VER}-x86.qcow2 |
67 |
+ ) |
68 |
+ )" |
69 |
+S=${WORKDIR}/${MY_P} |
70 |
+ |
71 |
+LICENSE="GPL-2" |
72 |
+SLOT="${PV}" |
73 |
+KEYWORDS="~amd64 ~x86" |
74 |
+IUSE="+initramfs test" |
75 |
+RESTRICT="!test? ( test ) test? ( userpriv )" |
76 |
+ |
77 |
+# install-DEPEND actually |
78 |
+# note: we need installkernel with initramfs support! |
79 |
+RDEPEND=" |
80 |
+ || ( |
81 |
+ sys-kernel/installkernel-gentoo |
82 |
+ sys-kernel/installkernel-systemd-boot |
83 |
+ ) |
84 |
+ initramfs? ( >=sys-kernel/dracut-049-r3 )" |
85 |
+BDEPEND=" |
86 |
+ sys-devel/bc |
87 |
+ virtual/libelf |
88 |
+ test? ( |
89 |
+ dev-tcltk/expect |
90 |
+ sys-kernel/dracut |
91 |
+ amd64? ( app-emulation/qemu[qemu_softmmu_targets_x86_64] ) |
92 |
+ x86? ( app-emulation/qemu[qemu_softmmu_targets_i386] ) |
93 |
+ )" |
94 |
+ |
95 |
+pkg_pretend() { |
96 |
+ mount-boot_pkg_pretend |
97 |
+ |
98 |
+ ewarn "This is an experimental package. The built kernel and/or initramfs" |
99 |
+ ewarn "may not work at all or fail with your bootloader configuration. Please" |
100 |
+ ewarn "make sure to keep a backup kernel available before testing it." |
101 |
+} |
102 |
+ |
103 |
+src_configure() { |
104 |
+ # force ld.bfd if we can find it easily |
105 |
+ local LD="$(tc-getLD)" |
106 |
+ if type -P "${LD}.bfd" &>/dev/null; then |
107 |
+ LD+=.bfd |
108 |
+ fi |
109 |
+ |
110 |
+ MAKEARGS=( |
111 |
+ V=1 |
112 |
+ |
113 |
+ HOSTCC="$(tc-getCC)" |
114 |
+ HOSTCXX="$(tc-getCXX)" |
115 |
+ HOSTCFLAGS="${CFLAGS}" |
116 |
+ HOSTLDFLAGS="${LDFLAGS}" |
117 |
+ |
118 |
+ AS="$(tc-getAS)" |
119 |
+ CC="$(tc-getCC)" |
120 |
+ LD="${LD}" |
121 |
+ AR="$(tc-getAR)" |
122 |
+ NM="$(tc-getNM)" |
123 |
+ STRIP=":" |
124 |
+ OBJCOPY="$(tc-getOBJCOPY)" |
125 |
+ OBJDUMP="$(tc-getOBJDUMP)" |
126 |
+ |
127 |
+ # we need to pass it to override colliding Gentoo envvar |
128 |
+ ARCH=x86 |
129 |
+ ) |
130 |
+ |
131 |
+ case ${ARCH} in |
132 |
+ amd64) |
133 |
+ cp "${DISTDIR}"/linux-${AMD64_CONFIG_VER}.amd64.config .config || die |
134 |
+ ;; |
135 |
+ x86) |
136 |
+ cp "${DISTDIR}"/linux-${I686_CONFIG_VER}.i686.config .config || die |
137 |
+ ;; |
138 |
+ *) |
139 |
+ die "Unsupported arch ${ARCH}" |
140 |
+ ;; |
141 |
+ esac |
142 |
+ |
143 |
+ # while Arch config is cool, we don't want gcc plugins as they |
144 |
+ # break distcc |
145 |
+ sed -i -e '/GCC_PLUGIN/d' .config || die |
146 |
+ # module compression prevents us from stripping them post-inst |
147 |
+ sed -i -e '/MODULE_COMPRESS/d' .config || die |
148 |
+ # shove our theft under the carpet! |
149 |
+ sed -i -e '/HOSTNAME/s:archlinux:gentoo:' .config || die |
150 |
+ # hey, we do support x32 |
151 |
+ sed -i -e '/CONFIG_X86_X32/s:.*:CONFIG_X86_X32=y:' .config || die |
152 |
+ restore_config .config |
153 |
+ |
154 |
+ mkdir -p "${WORKDIR}"/modprep || die |
155 |
+ mv .config "${WORKDIR}"/modprep/ || die |
156 |
+ emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" olddefconfig |
157 |
+ emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" modules_prepare |
158 |
+ cp -pR "${WORKDIR}"/modprep "${WORKDIR}"/build || die |
159 |
+} |
160 |
+ |
161 |
+src_compile() { |
162 |
+ emake O="${WORKDIR}"/build "${MAKEARGS[@]}" all |
163 |
+} |
164 |
+ |
165 |
+get_kern_arch() { |
166 |
+ echo x86 |
167 |
+} |
168 |
+ |
169 |
+src_test() { |
170 |
+ local image_arch=${ARCH} |
171 |
+ local qemu_arch=$(usex amd64 x86_64 i386) |
172 |
+ |
173 |
+ emake O="${WORKDIR}"/build "${MAKEARGS[@]}" \ |
174 |
+ INSTALL_MOD_PATH="${T}" modules_install |
175 |
+ |
176 |
+ dracut \ |
177 |
+ --conf /dev/null \ |
178 |
+ --confdir /dev/null \ |
179 |
+ --no-hostonly \ |
180 |
+ --kmoddir "${T}/lib/modules/${PV}" \ |
181 |
+ "${T}/initrd" "${PV}" || die |
182 |
+ cp "${DISTDIR}/tinycorelinux-${TCL_VER}-${image_arch}.qcow2" \ |
183 |
+ "${T}/fs.qcow2" || die |
184 |
+ |
185 |
+ cd "${T}" || die |
186 |
+ cat > run.sh <<-EOF || die |
187 |
+ #!/bin/sh |
188 |
+ exec qemu-system-${qemu_arch} \ |
189 |
+ -m 256M \ |
190 |
+ -display none \ |
191 |
+ -no-reboot \ |
192 |
+ -kernel '${WORKDIR}/build/arch/$(get_kern_arch)/boot/bzImage' \ |
193 |
+ -initrd '${T}/initrd' \ |
194 |
+ -serial mon:stdio \ |
195 |
+ -hda '${T}/fs.qcow2' \ |
196 |
+ -append 'root=/dev/sda console=ttyS0,115200n8' |
197 |
+ EOF |
198 |
+ chmod +x run.sh || die |
199 |
+ # TODO: initramfs does not let core finish starting on some systems, |
200 |
+ # figure out how to make it better at that |
201 |
+ expect - <<-EOF || die "Booting kernel failed" |
202 |
+ set timeout 900 |
203 |
+ spawn ./run.sh |
204 |
+ expect { |
205 |
+ "Kernel panic" { |
206 |
+ send_error "\n* Kernel panic" |
207 |
+ exit 1 |
208 |
+ } |
209 |
+ "Entering emergency mode" { |
210 |
+ send_error "\n* Initramfs failed to start the system" |
211 |
+ exit 1 |
212 |
+ } |
213 |
+ "Core 10.1" { |
214 |
+ send_error "\n* Booted to login" |
215 |
+ exit 0 |
216 |
+ } |
217 |
+ timeout { |
218 |
+ send_error "\n* Kernel boot timed out" |
219 |
+ exit 2 |
220 |
+ } |
221 |
+ } |
222 |
+ EOF |
223 |
+} |
224 |
+ |
225 |
+src_install() { |
226 |
+ # do not use 'make install' as it behaves differently based |
227 |
+ # on what kind of installkernel is installed |
228 |
+ emake O="${WORKDIR}"/build "${MAKEARGS[@]}" \ |
229 |
+ INSTALL_MOD_PATH="${ED}" modules_install |
230 |
+ |
231 |
+ # note: we're using mv rather than doins to save space and time |
232 |
+ # install main and arch-specific headers first, and scripts |
233 |
+ local kern_arch=$(get_kern_arch) |
234 |
+ dodir "/usr/src/linux-${PV}/arch/${kern_arch}" |
235 |
+ mv include scripts "${ED}/usr/src/linux-${PV}/" || die |
236 |
+ mv "arch/${kern_arch}/include" \ |
237 |
+ "${ED}/usr/src/linux-${PV}/arch/${kern_arch}/" || die |
238 |
+ |
239 |
+ # remove everything but Makefile* and Kconfig* |
240 |
+ find -type f '!' '(' -name 'Makefile*' -o -name 'Kconfig*' ')' \ |
241 |
+ -delete || die |
242 |
+ find -type l -delete || die |
243 |
+ cp -p -R * "${ED}/usr/src/linux-${PV}/" || die |
244 |
+ |
245 |
+ cd "${WORKDIR}" || die |
246 |
+ # strip out-of-source build stuffs from modprep |
247 |
+ # and then copy built files as well |
248 |
+ find modprep -type f '(' \ |
249 |
+ -name Makefile -o \ |
250 |
+ -name '*.[ao]' -o \ |
251 |
+ '(' -name '.*' -a -not -name '.config' ')' \ |
252 |
+ ')' -delete || die |
253 |
+ rm modprep/source || die |
254 |
+ cp -p -R modprep/. "${ED}/usr/src/linux-${PV}"/ || die |
255 |
+ |
256 |
+ # install the kernel and files needed for module builds |
257 |
+ cp build/{arch/x86/boot/bzImage,System.map,Module.symvers} \ |
258 |
+ "${ED}/usr/src/linux-${PV}"/ || die |
259 |
+ |
260 |
+ # strip empty directories |
261 |
+ find "${D}" -type d -empty -exec rmdir {} + || die |
262 |
+ |
263 |
+ # fix source tree and build dir symlinks |
264 |
+ dosym ../../../usr/src/linux-${PV} /lib/modules/${PV}/build |
265 |
+ dosym ../../../usr/src/linux-${PV} /lib/modules/${PV}/source |
266 |
+ |
267 |
+ save_config build/.config |
268 |
+} |
269 |
+ |
270 |
+pkg_preinst() { |
271 |
+ : |
272 |
+} |
273 |
+ |
274 |
+pkg_postinst() { |
275 |
+ if [[ -z ${ROOT} ]]; then |
276 |
+ mount-boot_pkg_preinst |
277 |
+ |
278 |
+ if use initramfs; then |
279 |
+ ebegin "Building initramfs via dracut" |
280 |
+ # putting it alongside kernel image as 'initrd' makes |
281 |
+ # kernel-install happier |
282 |
+ dracut --force "${EROOT}/usr/src/linux-${PV}/initrd" "${PV}" |
283 |
+ eend ${?} || die "Building initramfs failed" |
284 |
+ fi |
285 |
+ |
286 |
+ ebegin "Installing the kernel via installkernel" |
287 |
+ # note: .config is taken relatively to System.map; |
288 |
+ # initrd relatively to bzImage |
289 |
+ installkernel "${PV}" \ |
290 |
+ "${EROOT}/usr/src/linux-${PV}/bzImage" \ |
291 |
+ "${EROOT}/usr/src/linux-${PV}/System.map" |
292 |
+ eend ${?} || die "Installing the kernel failed" |
293 |
+ fi |
294 |
+ |
295 |
+ local symlink_target=$(readlink "${EROOT}"/usr/src/linux) |
296 |
+ local symlink_ver=${symlink_target#linux-} |
297 |
+ if [[ ${symlink_target} == linux-* && -z ${symlink_ver//[0-9.]/} ]] |
298 |
+ then |
299 |
+ local symlink_pkg=${CATEGORY}/${PN}-${symlink_ver} |
300 |
+ # if the current target is either being replaced, or still |
301 |
+ # installed (probably depclean candidate), update the symlink |
302 |
+ if has "${symlink_ver}" ${REPLACING_VERSIONS} || |
303 |
+ has_version -r "~${symlink_pkg}" |
304 |
+ then |
305 |
+ ebegin "Updating /usr/src/linux symlink" |
306 |
+ ln -f -n -s linux-${PV} "${EROOT}"/usr/src/linux |
307 |
+ eend ${?} |
308 |
+ fi |
309 |
+ fi |
310 |
+ |
311 |
+ savedconfig_pkg_postinst |
312 |
+} |
313 |
+ |
314 |
+pkg_prerm() { |
315 |
+ : |
316 |
+} |
317 |
+ |
318 |
+pkg_postrm() { |
319 |
+ rm -f "${EROOT}/usr/src/linux-${PV}/initrd" && |
320 |
+ rmdir --ignore-fail-on-non-empty "${EROOT}/usr/src/linux-${PV}" |
321 |
+} |