summaryrefslogtreecommitdiff
blob: bfea98b23366e2561a3aa2391cbd2af1405d16b9 (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Gentoo/NetBSD GENERIC kernel ebuild
# Patrice Clement <charlieroot@free.fr>
inherit eutils netbsd

DESCRIPTION="NetBSD 5.0 kernel ebuild (GENERIC)"
HOMEPAGE="http://cvsweb.netbsd.org"
SRC_URI=""
SLOT="0"
LICENCE="BSD"
KEYWORDS="~x86-nbsd"

DEPEND=">=sys-netbsd/netbsd-src-5.0
        >=sys-netbsd/netbsd-cctools-5.0"

src_unpack() {
  # Move to kernel configuration files directory
  cd ${NETBSD_SRC_DIR}/sys/arch/i386/conf

  # Backup original GENERIC kernel configuration file
  if [ ! -e GENERIC_ORIG ]; then
    cp GENERIC GENERIC_ORIG
  else
    cp GENERIC_ORIG GENERIC
  fi

  # This patch:
  # - changes march & mtune GCC compilation flags to prescott
  # - enable ACPI verbosity
  # - enable kernel built-in pf device (no need to load it through LKM)
  epatch ${FILESDIR}/${P}-GENERIC.patch

  # Generate kernel directory data structure
  einfo "Generating kernel directory data structure..."
  ${NETBSD_TOOLDIR}/bin/nbconfig GENERIC
  einfo "OK!"

  # Move to GENERIC kernel data directory
  cd ${NETBSD_SRC_DIR}/sys/arch/i386/compile/GENERIC

  # Clean directory
  einfo "Cleaning GENERIC kernel directory..."
  netbsd_src_compile clean
  einfo "OK!"

  # Create kernel dependencies
  einfo "Creating kernel dependencies..."
  netbsd_src_compile depend
  einfo "OK!"
}

src_compile() {
  # Compile kernel
  einfo "Starting kernel compilation..."
  cd ${NETBSD_SRC_DIR}/sys/arch/i386/compile/GENERIC
  netbsd_src_compile all
  einfo "Kernel compilation finished."
}

pkg_preinst() {
  # Create a backup of existing kernel, which should be named "netbsd" by default.
  if [ -e ${ROOT}/netbsd ]; then
    einfo "Create a backup of existing kernel..."
    mv ${ROOT}/netbsd ${ROOT}/netbsd.old
    einfo "OK!"
  fi
}

src_install() {
  # Kernel will be installed in ${NETBSD_ROOT} directory, called "netbsd", with 755 rights.
  cd ${NETBSD_SRC_DIR}/sys/arch/i386/compile/GENERIC
  insinto ${NETBSD_ROOT}
  insopts -m0755
  einfo 'Installing new compiled kernel...'
  doins netbsd
  einfo 'OK!'
}