aboutsummaryrefslogtreecommitdiffstats
path: root/src/mkkerneldoth
blob: ff205e18af2e3fe70cba21cc4632f30626c1fe45 (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
#!/bin/bash
#
# Generate a header that defines the boot kernel.
#

KERNEL_TYPE=`uname -r | sed 's_^[^se]*\(\|smp\|enterprise\)$_-\1_;s_^-$__'`
KERNEL_RELEASE=`uname -r | sed 's|smp\|enterprise||g'`

rpm -q kernel$KERNEL_TYPE-$KERNEL_RELEASE >/dev/null 2>&1 && KERNEL_ARCH=`rpm -q --qf '%{ARCH}' kernel$KERNEL_TYPE-$KERNEL_RELEASE 2>/dev/null` || KERNEL_ARCH=`uname -m`

OLD_KERNEL_ARCH_TYPE=`sed -n 's_^/\* Kernel type \(.*\) \*/_\1_p' /boot/kernel.h 2>/dev/null`
if [ -n "$KERNEL_ARCH" -a "$KERNEL_ARCH$KERNEL_TYPE" != "$OLD_KERNEL_ARCH_TYPE" ]; then
  ENTERPRISE='0'
  SMP='0'
  UP='0'
  case "$KERNEL_TYPE" in
  -smp) SMP='1';;
  -enterprise) ENTERPRISE='1';;
  *) UP='1';;
  esac
  cat > /boot/kernel.h << EOF
/* This file is automatically generated at boot time. */
#ifndef __BOOT_KERNEL_H_
#define __BOOT_KERNEL_H_

/* Kernel type $KERNEL_ARCH$KERNEL_TYPE */

#ifndef __MODULE_KERNEL_$KERNEL_ARCH
#define __MODULE_KERNEL_$KERNEL_ARCH 1
#endif

#ifndef __BOOT_KERNEL_ENTERPRISE
#define __BOOT_KERNEL_ENTERPRISE $ENTERPRISE
#endif

#ifndef __BOOT_KERNEL_SMP
#define __BOOT_KERNEL_SMP $SMP
#endif

#ifndef __BOOT_KERNEL_UP
#define __BOOT_KERNEL_UP $UP
#endif

#endif
EOF
fi