summaryrefslogtreecommitdiff
blob: 74ee450038735966767ccedf2ac0a7dc338d0ff4 (plain)
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
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-kernel/compaq-sources/compaq-sources-2.4.9.32.7-r4.ebuild,v 1.1 2004/04/17 09:35:23 plasmaroo Exp $

ETYPE="sources"
inherit kernel eutils
OKV=2.4.9
KV=${OKV}-32.7
EXTRAVERSION="-compaq-${PR}"
S=${WORKDIR}/linux-${KV}
IUSE=""

# This ebuild installs the sources for the Linux kernel shipped with the
# latest version of Red Hat Linux for Alpha, maintained by Compaq.
#
# -taviso <taviso@gentoo.org>
#

DEPEND="${DEPEND}
	app-arch/rpm2targz
	>=sys-apps/sed-4"

REDPEND=""
DESCRIPTION="Kernel from the Compaq Distribution of Red Hat Linux (ALPHA)."
SRC_URI="ftp://ftp2.compaq.com/pub/linux/RedHat/7.2-alpha/updates/rpms/alpha/kernel-source-${KV}.alpha.rpm"
HOMEPAGE="http://www.kernel.org/ http://www.redhat.com/ http://www.support.compaq.com/alpha-tools/redhat/"
KEYWORDS="-* ~alpha"
SLOT="${KV}"

src_unpack() {
	local kernel_rpm="kernel-source-${KV}.alpha.rpm"
	cd ${WORKDIR}

	ebegin "Unpacking Distribution RPM..."

	# agriffis' fast+efficient rpm extraction method from
	# the dev-lang/ccc ebuild.
	#
	i=${DISTDIR}/${kernel_rpm}
	dd ibs=`rpmoffset < ${i}` skip=1 if=$i 2>/dev/null \
	| gzip -dc | cpio -idmu 2>/dev/null \
	&& find usr -type d -print0 | xargs -0 chmod a+rx
	eend ${?}
	assert "Failed to extract ${kernel_rpm%.rpm}.tar.gz"

	mv usr/src/linux-${KV} ${WORKDIR}
	cd ${S}

	# Just fix a couple of minor issues...
	sed -i 's#include/linux/autoconf.h \(include/linux/version.h \\\)#\1#' Makefile
	sed -i 's#\(extern\) \(unsigned long irq_err_count;\)#\1 volatile \2#' arch/alpha/kernel/irq_alpha.c
	sed -i 's#/DISCARD/ : { \*(.text.exit)#/DISCARD/ : {#' arch/alpha/vmlinux.lds.in

	# Security patches
	epatch ${FILESDIR}/${P}.do_brk.patch || die "Failed to patch do_brk() vulnerability!"
	epatch ${FILESDIR}/${P}.CAN-2003-0985.patch || die "Failed to patch mremap() vulnerability!"
	epatch ${FILESDIR}/${P}.CAN-2004-0010.patch || die "Failed to add the CAN-2004-0010 patch!"
	epatch ${FILESDIR}/${P}.CAN-2004-0109.patch || die "Failed to patch CAN-2004-0109 vulnerability!"
	epatch ${FILESDIR}/${P}.CAN-2004-0177.patch || die "Failed to add the CAN-2004-0177 patch!"
	epatch ${FILESDIR}/${P}.CAN-2004-0178.patch || die "Failed to add the CAN-2004-0178 patch!"
	epatch ${FILESDIR}/${P}.rtc_fix.patch || die "Failed to patch RTC vulnerabilities!"
	epatch ${FILESDIR}/${P}.munmap.patch || die "Failed to apply munmap patch!"

	# Hand it over to the eclass...
	kernel_universal_unpack
}

pkg_postinst () {
	einfo "This ebuild has installed the sources for the Linux kernel shipped with the"
	einfo "latest version of Red Hat Linux Alpha, maintained by Compaq."
	einfo
	einfo "Compaq lag behind releases from kernel.org, but their kernels are"
	einfo "extensively tested, and used by many thousands. This kernel will include"
	einfo "bugfixes and extended hardware support, and is probably the most widely"
	einfo "used Linux kernel on the Alpha Platform today."
	einfo
	ewarn "DO NOT Report issues with this kernel to Red Hat or Compaq, use"
	ewarn "the Gentoo Linux bugzilla at http://bugs.gentoo.org/"
}