On Monday, February 16, 2015 12:47:28 PM Will Godfrey wrote:
On Mon, 16 Feb 2015 12:13:53 -0500
Gene Heskett <gheskett(a)wdtv.com> wrote:
I have a script I use for the build/install that
I can post if there
is any interest.
Cheers, Gene Heskett
There is interest :)
Line wrap disabled!
#!/bin/sh
## this script assumes you have downloaded, unpacked and linked kernel-whatever.version
## First, edit this to set the version string to match the Makefile setting
# yeah, I know, I should pass it as $1. Someday...
VER=3.14.26
echo now makeing kernel $VER, if not right, hit ctl+c now && \
sleep 3 && \
## For use with the lm_sensors kit, you'll need the following lines inserted
## into your /etc/rc.d/rc.local script
##------------------
### now do some lm-sensors stuff
## i2c adaptor drivers
#modprobe i2c-via
## i2c chip drivers
#modprobe gl518sm
## alternate chip driver
#modprobe eeprom
##------------------
## And add these lines to /etc/conf.modules
# I2C module options
#alias char-major-89 i2c-dev
##------------------
## Now, the real work. This assumes you have copied your
## .config and .config.old
## files from the source directory of your previous kernel install, and have
## done 'make oldconfig' in the new source directory and answered all the
## questions, and then do a 'make xconfig' to check/change anything you wanted
## to
## The above is NOT for major version upgrades, you must start from scratch, do NOT
## copy over the older .config's when upping from 2.2.x to 2.4.x or 2.6.x
# I've re-arranged this to be one contiguous command line, because this way if there
# is an error, it dies right there instead of making you scroll back 300k in the
# history to check for errors.
# And, due to changes in the 2.6 way of doing things, the System.map
# stuff has been moved to a point BEFORE the make modules_install
# because make modules_install now has a self-contained depmod command. :(
# Also, one should make sure the DEPMOD declaration in the Makefile
# is NOT hard coded pathwise, so it will find the newer, 2.6 version of depmod
make clean && \
make oldconfig && \
make prepare && \
echo && \
echo && \
echo makeing bzImage && \
ccache make -j3 bzImage && \
echo && \
echo && \
echo Now making modules && \
echo && \
echo && \
ccache make -j3 modules && \
echo && \
echo doing a make headers_install && \
make headers_install && \
echo removeing /boot/vmlinuz-$VER-old && \
rm -f /boot/vmlinuz-$VER-old && \
echo touching vmlinuz-$VER && \
touch /boot/vmlinuz-$VER && \
echo mv-ing /boot/vmlinuz-$VER /boot/vmlinuz-$VER-old && \
mv -f /boot/vmlinuz-$VER /boot/vmlinuz-$VER-old && \
echo copying bzImage to /boot/vmlinuz-$VER && \
cp -f arch/x86/boot/bzImage /boot/vmlinuz-$VER && \
echo removeing old lib/modules/$VER.old && \
rm -fR /lib/modules/$VER.old && \
echo touching /lib/modules/$VER && \
touch /lib/modules/$VER && \
echo moving /lib/modules/$VER to /lib/modules/$VER.old && \
mv -f /lib/modules/$VER /lib/modules/$VER.old && \
echo cleaning up in /boot && \
rm -f /boot/System.map && \
echo saveing the System.map-$VER to System.map-$VER.old && \
touch /boot/System.map-$VER && \
mv /boot/System.map-$VER /boot/System.map-$VER.old && \
echo copying in new System.map && \
cp -f System.map /boot/System.map-$VER && \
echo cd-ing to /boot && \
cd /boot && \
echo doing the link of System.map-$VER to System.map && \
ln -s System.map-$VER System.map && \
echo cd-ing back to /usr/src/linux-$VER to do the modules_install && \
cd /usr/src/linux-$VER && \
echo make modules_install && \
ccache make -j3 modules_install && \
echo installing firmware && \
make firmware_install && \
echo now making a new /boot/initrd.$VER.img && \
# touch it in case its not there yet && \
touch /boot/initrd-$VER.img && \
# then move it to .old && \
mv /boot/initrd-$VER.img /boot/initrd-$VER.old && \
# now make a new one IN /boot! && \
mkinitrd /boot/initrd-$VER.img $VER && \
echo and copying it to initrd-$VER.img && \
touch initrd-$VER.img.old && \
rm -f initrd-$VER.img.old && \
# leave a copy here too && \
cp /boot/initrd-$VER.img initrd-$VER.img && \
cd /usr/src/linux-$VER && \
depmod -a -e -F System.map $VER && \
# Ok, now we need to be saving the .config in /boot and dump the copy in /proc \
touch /boot/config-$VER.gz && \
mv /boot/config-$VER.gz /boot/config-$VER.gz.old && \
gzip -c .config >/boot/config-$VER.gz && \
ls -l /boot/ | grep config-$VER.gz && \
echo
echo All done! Edit grub.conf, reboot and chose your kernel at the grub prompt
All those && \ are used to string it into a series invocation that if a
build error occurs anyplace, it should bail out leaving the build error
on screen.
It might need more tweeking than just the $VER setting, in particular
there are now at least 2 versions of the utility that does the generation
of the initrd images. So consult the man page for your version and modify
to suit. It also has some historical cruft, some of which dates back to
linux-2.2 days. Now probably commented out. I last built a working 3.16.0
kernel with it, modified of course.
This script also keeps one previous generation by deleting the -old
version if it exists, renaming the existing same named stuff to -old
if they exist so that if a failure occurs, and the grub refresh thing has been
run, then you can back up to the working version by rebooting to the old one.
But things in linux aren't constant, and I haven't tested that to see
if it still works in 4 or 5 years.
It also uses ccache which can materially speed up 2nd and subsequent builds.
So get ccache & install it. You will be pleased.
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>