CVS: brutus/hardkrash/modules/linux BUILD, NONE, 1.1 CONFIGURE, NONE, 1.1 DEPENDS, NONE, 1.1 DETAILS, NONE, 1.1 POST_INSTALL, NONE, 1.1 PRE_BUILD, NONE, 1.1

hardkrash at lunar-linux.org hardkrash at lunar-linux.org
Thu Oct 2 01:03:22 GMT 2003


Update of /var/cvs/lunar/brutus/hardkrash/modules/linux
In directory dbguin.lunar-linux.org:/tmp/cvs-serv17952

Added Files:
	BUILD CONFIGURE DEPENDS DETAILS POST_INSTALL PRE_BUILD 
Log Message:
this is the beginings of a new kernel module that i hacked up a little bit ago, under csm's original request, it was lost in a shuffle some of you may have even tested it

lets kick this pig

hardkrash


--- NEW FILE: BUILD ---
backup_modules()  {
  if    [  -d  /lib/modules/$VERSION      ];  then
    verbose_msg "Backing up old modules."
    rm   -rf   /lib/modules/$VERSION.old
    mv         /lib/modules/$VERSION      \
               /lib/modules/$VERSION.old
  fi
}

fail_build()  {
  # Restore the source backup of the linux kernel
  if [ -z "$1" ]
  then message "${PROBLEM_COLOR}An error was detected in the building of your kernel."
  else message "${PROBLEM_COLOR}While processing $1 an error was detected."
  fi
  message "Please check your kernel${DEFAULT_COLOR}"
  mv /usr/src/linux-$VERSION /usr/src/linux-$VERSION.broke
  rm -f /usr/src/linux
  mv /usr/src/linux-$VERSION.old /usr/src/linux-$VERSION
  ln -s /usr/src/linux-$VERSION /usr/src/linux
  false
}

cd  /usr/src/linux

#set the arch once
XARCH="x`arch`"

#Select the prefered linux config method and lets things fall back
while
  ALL_CONF_FAILED="n"
  case  $CONFIG_KERNEL in
      y|Y)  
        case $CONFIG_METHOD in
          xconfig )
                 if [ $DISPLAY ]
           then
               make xconfig || (CONFIG_METHOD="menuconfig"; make menuconfig ) \
                            || (CONFIG_METHOD="config";     make config ) \
                            || ALL_CONF_FAILED="y"
           else
               make menuconfig || ( CONFIG_METHOD="config"; make config ) \
                               || ALL_CONF_FAILED="y"
           fi ;;
          menuconfig ) make menuconfig \
					             || ( CONFIG_METHOD="config"; make config ) \
                       || ALL_CONF_FAILED="y";;
          config )     make config || ALL_CONF_FAILED="y" ;;
        esac

        if [ "$ALL_CONF_FAILED" == "y" ]
        then message "${PROBLEM_COLOR}Previous config methods failed."
           message "Choosing to not repeat will cause install to fail.${DEFAULT_COLOR}"
        fi

        if  query  "Repeat $CONFIG_METHOD?"  n
        then  CONFIG_KERNEL=y
        else  CONFIG_KERNEL=n
        fi

        if [ "$ALL_CONFIG_FAILED" == "y" ] && [ "$CONFIG_KERNEL" == "n" ]
        then fail_build "kernel configuration"
        fi     ;;

      *)  false  ;;
    esac
do
  true
done

(
  yes  n  |  make  oldconfig || fail_build "oldconfig" &&
  cp .config $CONFIG_CACHE                   &&

  if ! make dep
  then fail_build "make dep"
  else true
  fi                                         &&

  case $XARCH in
     xi386 | xi486 | xi586 | xi686 )
             make bzImage;;

    xalpha ) make boot ;;

      xppc ) make vmlinux ;;

    xsparc ) echo "Sorry no Lunar port yet want to try its easy :-P the penguin team will help."
             false ;;
      xarm ) echo "Sorry no Lunar port yet want to try its easy :-P the penguin team will help."
             false ;;
     xm68k ) echo "Sorry no Lunar port yet want to try its easy :-P the penguin team will help."
             false ;;
     xmips ) echo "Sorry no Lunar port yet want to try its easy :-P the penguin team will help."
             false ;;
          *) echo "Opps. You, yea you, yap at hardkrash for forgetting to put in your arch in this module. :-P"
             false ;;
  esac
  if [ "$?" -ne 0 ]
  then fail_build "kernel build for $XARCH"
  else true
  fi                                         &&

  if grep -q "CONFIG_MODULES=y" .config
  then
    if ! make modules
    then fail_build "make modules"
    else true
    fi
  fi                                         &&

  prepare_install                            &&

  backup_modules                             &&
	
  if grep -q "CONFIG_MODULES=y" .config
  then
    make modules_install
  fi                                         &&

  case $XARCH in
     xi386 | xi486 | xi586 | xi686 )
              if [ -e /boot/vmlinubz-$VERSION ]
              then
                mv /boot/vmlinubz-$VERSION /boot/vmlinubz-$VERSION.old
              fi                             &&
              cp arch/i386/boot/bzImage   /boot/vmlinubz-$VERSION 

    xalpha )  if [ -e /boot/vmlinux-$VERSION.gz ]
              then
                mv /boot/vmlinux-$VERSION.gz /boot/vmlinux-$VERSION.old.gz
              fi                             &&
              cp arch/alpha/boot/vmlinux.gz /boot/vmlinux-$VERSION.gz;;

      xppc )  if [ -e /boot/vmlinux-$VERSION ]
              then
                mv /boot/vmlinux-$VERSION /boot/vmlinux-$VERSION.old
              fi                             &&
              cp vmlinux /boot/vmlinux-$VERSION;;

      xarm )  echo "Oh crud they forgot to tell me what should I do for arm."
              false ;;
     xm68k )  echo "Oh crud they forgot to tell me what should I do for m68k."
              false ;;
     xmips )  echo "Oh crud they forgot to tell me what should I do for mips."
              false ;;
         * )  echo "Oh crud they forgot to tell me what to do for you. ;~-("
	      false ;;
  esac
) > $C_FIFO 2>&1

--- NEW FILE: CONFIGURE ---
XARCH="x`arch`"

if  !  grep  -q  "BOOT_LOADER"  $MODULE_CONFIG;  then

	case $XARCH in
	     xi386|xi486|xi586|xi686) 
	      message  "The Linux Kernel requires a boot loader"
	      message  "Choose either GRUB or LILO"
	      if  query  "To use lilo choose yes, to use grub choose no"  y
		then  BOOT_LOADER=lilo
	      else  BOOT_LOADER=grub
	      fi;;
	  
	    xalpha) BOOT_LOADER=aboot;;
	      xppc)  BOOT_LOADER=yaboot;;
	    xsparc) echo ";~( I am not setup for Sparcs. Can you electrify me?.";; 
	      xarm) echo ";~( I am not setup for arms. Can you give me limbs?";;
	     xm68k) echo ";~( I am not setup for 68k. Can you configure me?";;
	     xmips) echo ";~( I am not setup for mips. Can you configure me?";;
	  esac
	    
	  echo  "BOOT_LOADER=$BOOT_LOADER"  >>  $MODULE_CONFIG

fi

CONFIG_GRUB="n"
CONFIG_LILO="n"
CONFIG_ABOOT="n"
CONFIG_YABOOT="n"

if    grep  -q  "BOOT_LOADER=grub"  $MODULE_CONFIG  &&
      query  "Configure grub?"  n
then  CONFIG_GRUB=y
fi

if    grep  -q  "BOOT_LOADER=lilo"  $MODULE_CONFIG; then
      if ! grep -q "CONFIG_LILO=[YyNn]" $MODULE_CONFIG; then
	      if query  "Automaticaly configure and run lilo?"  n; 
	      then
		CONFIG_LILO=y
	      fi
      fi	    
      
      if query  "Hand edit /etc/lilo.conf?" n; 
      then
        EDIT_LILO=y
      else
        EDIT_LILO=n
      fi
fi

if    grep  -q  "BOOT_LOADER=aboot" $MODULE_CONFIG  &&
      query  "Configure aboot?" n
then  CONFIG_ABOOT=y
fi

if    grep  -q  "BOOT_LOADER=yaboot" $MODULE_CONFIG; then
	if ! grep -q "CONFIG_YABOOT=[YyNn]" $MODULE_CONFIG; then
		if query "Automatically configure and run yaboot?" n;
		then
			CONFIG_YABOOT=y
		fi
	fi
	
	if query "Hand edit /etc/yaboot.conf?" n;
	then
		EDIT_YABOOT=y
	else
		EDIT_YABOOT=n
	fi
fi

CONFIG_AGGRESSIVE="n"

if !  grep  -q  "CONFIG_AGGRESSIVE=" $MODULE_CONFIG &&
      query  "Use Aggressive patchset?" n
then  CONFIG_AGGRESSIVE="y"
else  if grep -q "CONFIG_AGGRESSIVE=y"  $MODULE_CONFIG
      then  CONFIG_AGGRESSIVE="y"
      fi
fi      

if  !  grep  -q  "CONFIG_METHOD="  $MODULE_CONFIG
then
      CONFIG_HELP="Answer \Z1one\Zn question at a time. (Are you SURE?)"
  MENUCONFIG_HELP="Menu driven ncurses interface, falls back to config."
     XCONFIG_HELP="Graphical interface with X windows, falls back to menuconfig."
     
  OPTIONS=( "config"     "text based"             "off" "$CONFIG_HELP"
            "menuconfig" "ncurses menu interface" "off" "$MENUCONFIG_HELP"
	    "xconfig"    "X graphical interface"  "off" "$XCONFIG_HELP" )

  while [ -z "$CONFIG_METHOD" ] ; do
  CONFIG_METHOD=`dialog --title "Select how to configure your kernel" 	\
  			--backtitle "Lunar Linux Kernel Configuration"  \
			--ok-label  "Ok"				\
			--no-cancel                                   	\
			--stdout                                      	\
			--item-help				      	\
			--colors				      	\
			--radiolist                                   	\
			"Select your kernel configuration method"    	      	\
			 0 0 0                                        	\
			"${OPTIONS[@]}"`

  done
  
  echo  "CONFIG_METHOD=$CONFIG_METHOD"  >>  $MODULE_CONFIG
fi


if  [  !  -f  $CONFIG_CACHE/.config  ];  then
  message  "Preparing to make $CONFIG_METHOD"
  CONFIG_KERNEL="y"
else
  message  "Reconfiguration is optional."
  if    query  "Configure linux kernel?"  n
  then  CONFIG_KERNEL=y
  else  CONFIG_KERNEL=n
  fi
fi

TEMP=`grep  -v  "CONFIG_KERNEL="          $MODULE_CONFIG  |
      grep  -v  "CONFIG_LILO="                            |
      grep  -v  "CONFIG_GRUB="                            |
      grep  -v  "CONFIG_ABOOT="				  |
      grep  -v  "EDIT_YABOOT="				  |
      grep  -v  "CONFIG_YABOOT="			  |
      grep  -v  "CONFIG_AGGRESSIVE="                      |
      grep  -v  "EDIT_LILO"`

echo  "$TEMP"                                >   $MODULE_CONFIG
echo  "CONFIG_KERNEL=$CONFIG_KERNEL"         >>  $MODULE_CONFIG
echo  "CONFIG_LILO=$CONFIG_LILO"             >>  $MODULE_CONFIG
echo  "CONFIG_GRUB=$CONFIG_GRUB"             >>  $MODULE_CONFIG
echo  "CONFIG_ABOOT=$CONFIG_ABOOT"           >>  $MODULE_CONFIG
echo  "CONFIG_YABOOT=$CONFIG_YABOOT"         >>  $MODULE_CONFIG
echo  "EDIT_YABOOT=$EDIT_YABOOT"	     >>  $MODULE_CONFIG
echo  "CONFIG_AGGRESSIVE=$CONFIG_AGGRESSIVE" >>  $MODULE_CONFIG
echo  "EDIT_LILO=$EDIT_LILO"	             >>  $MODULE_CONFIG

--- NEW FILE: DEPENDS ---
depends  autoconf

--- NEW FILE: DETAILS ---
         MODULE=linux
        VERSION=2.4.20
   PATCHVERSION=r1.3.1
         SOURCE=linux-$VERSION.tar.bz2
        SOURCE2=$MODULE-$VERSION-lunar-patch-set-$PATCHVERSION.tar.bz2
  SOURCE_URL[0]=$KERNEL_URL/pub/linux/kernel/v2.4/$SOURCE
  SOURCE_URL[1]=http://www.kernel.org/pub/linux/kernel/v2.4/$SOURCE
 SOURCE2_URL[0]=$PATCH_URL/$SOURCE2
     SOURCE_VFY=md5:c439d5c93d7fc9a1480a90842465bb97
    SOURCE2_VFY=md5:0f868c396ccba9a2af96b770ae706e66
        WEBSITE=http://www.kernel.org
        ENTERED=20020818
        UPDATED=20030924
    KEEP_SOURCE="on"
          SHORT="The Linux kernel, the core of the GNU/Linux OS, with the lunar patch set"
cat << EOF
The lunar patch set enables the sysadmin to add some desirable features like:

XFS support (enabled by default)
fixes APM SMP crashes
ipconntack.h
P3m-cache
pcmcia-smc91c92_cs
adds cpuid entries amd msr entries
devfs-zip
rivafb
rpc-accounting-nfs
smp-race-nfs
radeon FB fixes
scsi-in2000
scsi-t128
ide-driver-null
getcwd-err
mmap
ext3 fixes
paraport-serial-pci
titan-serial
VIA chipset vt8235 fixes
xfs-sysctl
firewire patch
pdc202xx
3c574_cs
ptrace patch
ipv4 routing hash patch

The aggressive patch set adds:

adds gcc 3.1 machine types to the kernel
swab64
preemptible kernel support
low-latency
kde-fix

Features are enabled or disabled by the standard kernel configuration tools,
i.e. "make menuconfig" or "make config" or "make xconfig".
EOF

--- NEW FILE: POST_INSTALL ---
lilo_image_entry()  {

  cat  <<  EOF

image			=	/boot/vmlinubz-$VERSION
	label		=	linux-$VERSION
	read-only
	restricted

EOF

}

grub_image_entry()  {

. $DEPENDS_CONFIG/grub

  cat  <<  EOF

title   linux-$VERSION
kernel  $GRUB_BOOT/vmlinubz-$VERSION
root    $GRUB_ROOT

EOF

}

yaboot_image_entry()  {

  cat  <<  EOF

image			=	/boot/vmlinubx-$VERSION
	label		=	linux-$VERSION
	restricted

EOF

}

update_lilo()  {
  if  !  grep  -q  "$VERSION"  /etc/lilo.conf;  then

    IFS_OLD=$IFS
    export  IFS="
"

    rm  -rf  /etc/lilo.conf.new
    cp  /etc/lilo.conf  /etc/lilo.conf.old

    (( IMAGE_COUNT=0  ))

    for  LINE  in  `cat /etc/lilo.conf`;  do

      if   echo  $LINE  |  grep  -q  "image"  ||
           echo  $LINE  |  grep  -q  "other"  ;  then
        if  (( IMAGE_COUNT  == 0  ));  then
          echo  -e  "`lilo_image_entry`"  >>  /etc/lilo.conf.new
        fi
        ((  IMAGE_COUNT++  ))
      fi

      if  ((  IMAGE_COUNT == 14  ));  then
        break
      fi
    
      echo  $LINE  >>  /etc/lilo.conf.new

    done

    if  ((  IMAGE_COUNT ==  0  ));  then
      echo  -e  "`lilo_image_entry`"  >>  /etc/lilo.conf.new
    fi

    cp  /etc/lilo.conf.new  /etc/lilo.conf

    export  IFS=$IFS_OLD

  fi

  case  $EDIT_LILO in
    y|Y|j|J)  ${EDITOR:-nano}  /etc/lilo.conf  ;;
  esac

  /sbin/lilo

}


update_grub()  {
  if  !  grep  -q  "$VERSION"  /boot/grub/menu.lst;  then

    IFS_OLD=$IFS
    export  IFS="
"

    rm  -rf  /boot/grub/menu.lst.new
    cp  /boot/grub/menu.lst  /boot/grub/menu.lst.old

    (( IMAGE_COUNT=0  ))

    for  LINE  in  `cat /boot/grub/menu.lst`;  do

      if   echo  $LINE  |  grep  -q  "title";  then
        if  (( IMAGE_COUNT  == 0  ));  then
          echo  -e  "`grub_image_entry`"  >>  /boot/grub/menu.lst.new
        fi
        ((  IMAGE_COUNT++  ))
      fi

      if  ((  IMAGE_COUNT == 14  ));  then
        break
      fi
    
      echo  $LINE  >>  /boot/grub/menu.lst.new

    done

    if  ((  IMAGE_COUNT ==  0  ));  then
      echo  -e  "`grub_image_entry`"  >>  /boot/grub/menu.lst.new
    fi

    cp  /boot/grub/menu.lst.new  /boot/grub/menu.lst

    export  IFS=$IFS_OLD

  fi

  case  $CONFIG_GRUB in

    y|Y)  ${EDITOR:-nano}  /boot/grub/menu.lst;;
  esac

  message "Install GRUB into MBR of first drive? [y|Y]"
  read GRUB_FIRST_DRIVE
  case $GRUB_FIRST_DRIVE in
    y|Y) GRUB_BOOT_DEVICE="(hd0)" ;; 
    *  ) 
         message "Otherwise please specify in GRUB notation the desired drive/partition"
         message "Using parenthesis and NO spaces!"
         message "Samples: (hd1)    2nd drive MBR"
         message "         (hd1,0)  2nd drive with 1st partition"
         message "         (hd0,2)  1st drive with 3rd partition"
         echo -n "GRUB_BOOT_DEVICE=(hd#,#):  "
         read GRUB_BOOT_DEVICE
  esac
  
  /usr/sbin/grub-install "$GRUB_BOOT_DEVICE"
  sleep 4

}

update_aboot() {
    ${EDITOR:-nano}  /etc/aboot.conf;
}

update_yaboot() {
  if  !  grep  -q  "$VERSION"  /etc/yaboot.conf;  then

    IFS_OLD=$IFS
    export  IFS="
"

    rm  -rf  /etc/yaboot.conf.new
    cp  /etc/yaboot.conf  /etc/yaboot.conf.old

    (( IMAGE_COUNT=0  ))

    for  LINE  in  `cat /etc/yaboot.conf`;  do

      if   echo  $LINE  |  grep  -q  "image"  ||
           echo  $LINE  |  grep  -q  "other"  ;  then
        if  (( IMAGE_COUNT  == 0  ));  then
          echo  -e  "`yaboot_image_entry`"  >>  /etc/yaboot.conf.new
        fi
        ((  IMAGE_COUNT++  ))
      fi

      if  ((  IMAGE_COUNT == 14  ));  then
        break
      fi
    
      echo  $LINE  >>  /etc/yaboot.conf.new

    done

    if  ((  IMAGE_COUNT ==  0  ));  then
      echo  -e  "`yaboot_image_entry`"  >>  /etc/yaboot.conf.new
    fi

    cp  /etc/yaboot.conf.new  /etc/yaboot.conf

    export  IFS=$IFS_OLD

  fi

  case  $EDIT_YABOOT in
    y|Y|j|J)  ${EDITOR:-nano}  /etc/yaboot.conf  ;;
  esac

  /sbin/ybin

}

case  $BOOT_LOADER  in
  lilo)   [ $CONFIG_LILO = y ]   && update_lilo   ;;
  grub)   [ $CONFIG_GRUB = y ]   && update_grub   ;;
  aboot)  [ $CONFIG_ABOOT = y ]  && update_aboot  ;;
  yaboot) [ $CONFIG_YABOOT = y ] && update_yaboot ;;
esac


#  Reinstall packages that add their own kernel modules

rm  -f  $BOOST_LOCK
if  module_installed  ftpfs;          then  lin  ftpfs;          fi
if  module_installed  cvsfs;          then  lin  cvsfs;          fi
if  module_installed  NVIDIA_kernel;  then  lin  NVIDIA_kernel;  fi
if  module_installed  NVIDIA;         then  lin  NVIDIA;         fi
if  module_installed  alsa-driver;    then  lin  alsa-driver;    fi
if  module_installed  cryptoapi;      then  lin  cryptoapi;      fi
if  module_installed  pcmcia-cs;      then  lin  pcmcia-cs;      fi
if  module_installed  mwavem;         then  lin  mwavem;         fi
if  module_installed  cipe;           then  lin  cipe;           fi
if  module_installed  snare-core;     then  lin  snare-core;     fi
if  module_installed  ltmodem;        then  lin  ltmodem;        fi

--- NEW FILE: PRE_BUILD ---
cd       /usr/src

# Back up previous Linux kernel source.
if [ -e linux-$VERSION.old ]
then
  rm -rf   linux-$VERSION.old
fi
mv       linux-$VERSION linux-$VERSION.old
rm  -f   linux


# Prepare source
unpack  $SOURCE
ln  -s     linux-$VERSION  linux
if  [  -f   $CONFIG_CACHE/.config  ];  then
  cp        $CONFIG_CACHE/.config  /usr/src/linux
fi

# Apply patches
cd /usr/src/linux
mkdir patches
bzcat $SOURCE_CACHE/$SOURCE2 | tar -xf - -C patches

if [ "`arch`" == "alpha" ]; then
    patch -p1 < patches/alpha/00_alpha-cia.patch
fi

for pat in patches/main/*
do
    patch -p1 < $pat
done

if [ "$CONFIG_AGGRESSIVE" == "y" ]; then
   for pat in patches/aggressive/*
   do
       patch -p1 < $pat
   done
fi

rm -rf patches
chown -R root:root /usr/src/linux-$VERSION

true





More information about the Lunar-commits mailing list