[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: manual kernel recompile vs make-kpkg



Ciao Charles Lewis,

 > make menuconfig (or xconfig)
 > make dep (make clean??)
 > make bzImage
 > make modules
 > make modules_install
 > cp /usr/src/kernel-source-2.2.12/arch/i386/boot/bzImage /boot/vmlinuz-2.2.12
 > rm /vmlinuz
 > ln -s /boot/vmlinuz-2.2.12 /vmlinuz

I have done this script for this task:

------8<----- cut here -----8<----
#!/bin/sh 

beep()
{	# beep $1 times

	if [ $# -eq 0 ]; then	
		N=1
	else	
		N=$1
	fi

	if [ "$2" = "" ] ; then
		freq=1000
	else
		freq=$2
	fi

	if [ "$3" = "" ] ; then
		lenght=100
	else
		lenght=$3
	fi

	echo -ne "\33[10;$freq]\33[11;$lenght]"

	until [ $N -eq 0  ]; do
		echo -ne "\a"
		N=$((N-1))
		sleep 1
	done

	freq=1000
	lenght=100
	echo -en "\33[10;$freq]\33[11;$lenght]"
}

difftime()
{
	# TIME0=`date +"%T"`
	# TIME1=$TIME0
	# TIMER="`difftime $TIME0 $TIME1`"


	TIME0=$1; TIME1=$2
	HOUR0=${TIME0:0:2}; MIN0=${TIME0:3:2}; SEC0=${TIME0:6:2}
	HOUR1=${TIME1:0:2}; MIN1=${TIME1:3:2}; SEC1=${TIME1:6:2}

	DIFF_HOUR=$((HOUR1-HOUR0))

	if [ $DIFF_HOUR -lt "0" ] ; then
		DIFF_HOUR=${DIFF_HOUR + 24}
	fi

	DIFF_MIN=$((MIN1-MIN0))
	if [ $DIFF_MIN -lt "0" ] ; then
		DIFF_HOUR=$((DIFF_HOUR-1))
		DIFF_MIN=$((DIFF_MIN + 60))
	fi

	DIFF_SEC=$((SEC1-SEC0))
	if [ $DIFF_SEC -lt "0" ] ; then
		DIFF_MIN=$((DIFF_MIN - 1))
		DIFF_SEC=$((DIFF_SEC + 60))
	fi

	echo $DIFF_HOUR:$DIFF_MIN:$DIFF_SEC
}

src_kernel_version()
{
	# extract version / patch-level / sub-level from Makefile

	HEADERa=`head -n 1 Makefile`
	HEADERb=`head -n 2 Makefile| tail -n 1`
	HEADERc=`head -n 3 Makefile| tail -n 1`
	HEADERd=`head -n 4 Makefile| tail -n 1`

#	echo "\"$HEADERa\", \"$HEADERb\", \"$HEADERc\", \"$HEADERd\""

	VERSION="${HEADERa#"VERSION = "}"
	PATCHLEVEL="${HEADERb#"PATCHLEVEL = "}"
	SUBLEVEL="${HEADERc#"SUBLEVEL = "}"
#	EXTRAVERSION="${HEADERd#"EXTRAVERSION = "}"

	K_VER="$VERSION.$PATCHLEVEL.$SUBLEVEL"
#	-$EXTRAVERSION"
	echo $K_VER
}

LOGFILE=make.log
# initialize LOGFILE:
cat /dev/null > $LOGFILE
echo -e "\n-=-=-=-=-=-=-=-=-=-=-=-\n" >> make-time.log

export K_VER=`src_kernel_version`

STEPS="dep clean bzImage modules modules_install"

NBEEP=1
TIME0=`date +"%T"`
TIME1=$TIME0
TIME00=$TIME0

echo "Compiling Linux Kernel $K_VER ..." | tee -a make-time.log

for STEP in $STEPS ; do
	TIMER="`date +"%A %d %B %Y @ %T"` : MAKE $STEP ... "
	echo -n $TIMER | tee -a make-time.log
#	echo -e -n $TIMER
	make $STEP >>  $LOGFILE 2>&1
	EXITcode=$?
	if [ ! $EXITcode = 0 ] ; then
		echo -n "EXIT code = $EXITcode"
		echo -e " ! ERROR ! Last $LOGFILE lines:\n-----8<----------8<----------8<-----"
		tail -n 15 $LOGFILE
		echo "-----8<----------8<----------8<-----"
		beep 750 1000
		exit 1
	fi
	TIME0=$TIME1
	TIME1=`date +"%T"`
	TIMER="`difftime $TIME0 $TIME1`"
	echo $TIMER | tee -a make-time.log
#	echo $TIMER
	beep $NBEEP
	NBEEP=$((NBEEP+1))
done

TIMER="`difftime $TIME00 $TIME1`"
echo "Total time: $TIMER" | tee -a make-time.log

# Useful if you have a lilo.conf like:
#
#    image=/usr/src/linux/arch/i386/boot/bzImage
#    label=new
#    alias=n
#    vga=ask

if [ -e /etc/lilo.conf ] ; then
   lilo \
	&& echo -e "\nLILO UPDATED, good luck with the new kernel $K_VER !!!\n"; \
	echo "Next boot-time -> lilo: test" \
	|| echo -e "\nERROR! Something goes wrong! check /etc/lilo.conf\n"
fi

EXTENSION=$K_VER-`date +"%Y%m%d"`

cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage.$EXTENSION
cp /usr/src/linux/System.map /boot/System.map.$EXTENSION
ln -s -f /boot/bzImage.$EXTENSION /boot/test__

beep 1 5000 1000

------8<----- cut here -----8<----



My lilo.conf:

------8<----- cut here -----8<----

# Specifies the boot device
boot=/dev/hda1

# Specifies the device that should be mounted as root.
root=/dev/hda1

# Enables map compaction:
compact
ignore-table

# Install the specified file as the new boot sector.
install=/boot/boot.b

# Specifies the number of _tenths_ of a second LILO should
# wait before booting the first image.  LILO
# doesn't wait if DELAY is omitted or if DELAY is set to zero.
delay=100
timeout=150

# Specifies the location of the map file:
map=/boot/map

read-only
prompt

verbose=1
message=/boot/message

# Specifies the VGA text mode that should be selected when booting
vga=normal

default=stable

# latest stabile version:
image=/boot/stable
   label=stable
   alias=s
   vga=0x0133

# old stabile version:
image=/boot/old
   label=old
   alias=o
   vga=8

# new version just compiled:
image=/usr/src/linux/arch/i386/boot/bzImage
   label=new
   alias=n
   vga=ask

# the same version, but different path
image=/boot/test__
   label=test
   alias=t
   vga=ask

------8<----- cut here -----8<----


/boot$ dir
-rw-r--r--   1 root     root       176557 Oct 20 01:48 System.map.2.2.12-19991020
-rw-r--r--   1 root     root       176474 Oct 25 00:49 System.map.2.2.13-19991025
-rw-r--r--   1 root     root       176557 Oct 26 14:14 System.map.2.2.13-19991026
-rw-r--r--   1 root     root          512 Oct 24 23:01 boot.0301
-rw-r--r--   1 root     root         4540 Sep 28 12:28 boot.b
-rw-r--r--   1 root     root         4540 Feb  2  1999 boot.b.preserved
-rw-r--r--   1 root     root       590200 Oct 20 01:48 bzImage.2.2.12-19991020
-rw-r--r--   1 root     root       590275 Oct 25 00:49 bzImage.2.2.13-19991025
-rw-r--r--   1 root     root       605634 Oct 26 14:14 bzImage.2.2.13-19991026
-rw-r--r--   1 root     root          612 Sep 28 12:28 chain.b
-rw-r--r--   1 root     root          612 Feb  2  1999 chain.b.preserved
-rw-------   1 root     root        15360 Oct 26 19:58 map
-rw-r--r--   1 root     root          444 Dec 12  1997 mbr.b
lrwxrwxrwx   1 root     root           17 Oct 25 00:51 message -> /etc/lilo.message
lrwxrwxrwx   1 root     root           37 Oct 25 00:52 new -> /usr/src/linux/arch/i386/boot/bzImage
lrwxrwxrwx   1 root     root           23 Oct 27 20:24 old -> /boot/bzImage.2.2.12-19991020
-rw-r--r--   1 root     root          620 Sep 28 12:28 os2_d.b
-rw-r--r--   1 root     root          620 Feb  2  1999 os2_d.b.preserved
lrwxrwxrwx   1 root     root           29 Oct 26 19:58 stable -> /boot/bzImage.2.2.13-19991026
lrwxrwxrwx   1 root     root           29 Oct 26 14:14 test__ -> /boot/bzImage.2.2.13-19991026




/usr/src/kernel-2.2.13$ cat make-time.log

-=-=-=-=-=-=-=-=-=-=-=-

Compiling Linux Kernel 2.2.13 ...
domenica 24 ottobre 1999 ore 03:35:11 : MAKE dep ...0:1:24
domenica 24 ottobre 1999 ore 03:36:36 : MAKE clean ...0:0:3
domenica 24 ottobre 1999 ore 03:36:40 : MAKE bzImage ...0:7:22
domenica 24 ottobre 1999 ore 03:44:03 : MAKE modules ...0:1:40
domenica 24 ottobre 1999 ore 03:45:44 : MAKE modules_install ...0:0:5
Total time: 0:10:34

-=-=-=-=-=-=-=-=-=-=-=-

Compiling Linux Kernel 2.2.13 ...
lunedl 25 ottobre 1999 ore 00:40:10 : MAKE dep ...
lunedl 25 ottobre 1999 ore 00:41:32 : MAKE clean ...0:0:3
lunedl 25 ottobre 1999 ore 00:41:37 : MAKE bzImage ...0:5:59
lunedl 25 ottobre 1999 ore 00:47:36 : MAKE modules ...0:1:28
lunedl 25 ottobre 1999 ore 00:49:06 : MAKE modules_install ...0:0:5
Total time:

-=-=-=-=-=-=-=-=-=-=-=-

Compiling Linux Kernel 2.2.13 ...
martedl 26 ottobre 1999 ore 14:04:35 : MAKE dep ...0:1:12
martedl 26 ottobre 1999 ore 14:05:49 : MAKE clean ...0:0:7
martedl 26 ottobre 1999 ore 14:05:56 : MAKE bzImage ...0:7:1
martedl 26 ottobre 1999 ore 14:12:58 : MAKE modules ...0:1:49
martedl 26 ottobre 1999 ore 14:14:48 : MAKE modules_install ...0:0:5
Total time: 0:10:14


Only 1 problem.... :-)
my "difftime" not always works! I don't know why ...

HTH

Ciao

-- 

Paolo Pedaletti, Como, ITALYa
paolo . pedaletti @ flashnet . it

pub  1024D/09120D83 1999-06-11 Paolo Pedaletti (Linux) <paolo.pedaletti@flashnet.it>
     Key fingerprint = 0058 45AE B7D3 D603 7D0E  D9B8 26E6 01E0 0912 0D83
sub  2048g/F0A8E667 1999-06-11


Reply to: