source: projects/initscripts/tags/initscripts-8.91.3/src/mkkerneldoth @ 1108

Revision 1108, 1.1 KB checked in by daisuke, 13 years ago (diff)

import initscripts-8.90.6 from internal cvs repository

Line 
1#!/bin/bash
2#
3# Generate a header that defines the boot kernel.
4#
5
6KERNEL_TYPE=`uname -r | sed 's_^.*\(smp\|enterprise\)$_-\1_;t;s_.*__;'`
7KERNEL_RELEASE=`uname -r | sed 's|smp\|enterprise||g'`
8
9rpm -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`
10
11OLD_KERNEL_ARCH_TYPE=`sed -n 's_^/\* Kernel type \(.*\) \*/_\1_p' /boot/kernel.h 2>/dev/null`
12if [ -n "$KERNEL_ARCH" -a "$KERNEL_ARCH$KERNEL_TYPE" != "$OLD_KERNEL_ARCH_TYPE" ]; then
13  ENTERPRISE='0'
14  SMP='0'
15  UP='0'
16  case "$KERNEL_TYPE" in
17  -smp) SMP='1';;
18  -enterprise) ENTERPRISE='1';;
19  *) UP='1';;
20  esac
21  cat > /boot/kernel.h << EOF
22/* This file is automatically generated at boot time. */
23#ifndef __BOOT_KERNEL_H_
24#define __BOOT_KERNEL_H_
25
26/* Kernel type $KERNEL_ARCH$KERNEL_TYPE */
27
28#ifndef __MODULE_KERNEL_$KERNEL_ARCH
29#define __MODULE_KERNEL_$KERNEL_ARCH 1
30#endif
31
32#ifndef __BOOT_KERNEL_ENTERPRISE
33#define __BOOT_KERNEL_ENTERPRISE $ENTERPRISE
34#endif
35
36#ifndef __BOOT_KERNEL_SMP
37#define __BOOT_KERNEL_SMP $SMP
38#endif
39
40#ifndef __BOOT_KERNEL_UP
41#define __BOOT_KERNEL_UP $UP
42#endif
43
44#endif
45EOF
46fi
Note: See TracBrowser for help on using the repository browser.