Magellan Linux

Diff of /tags/grubby-8_40_20170706/new-kernel-pkg

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1757 by niro, Sat Feb 18 11:57:40 2012 UTC revision 2259 by niro, Mon Oct 21 14:03:18 2013 UTC
# Line 25  Line 25 
25  # along with this program.  If not, see <http://www.gnu.org/licenses/>.  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
26  #  #
27    
28    read_os_release()
29    {
30     local NAME
31     local ID
32     local Version
33     local Version_ID
34     local PRETTY_NAME
35     local ANSI_COLOR
36     local CPE_NAME
37    
38     if [[ -f /etc/os-release ]]
39     then
40     source /etc/os-release
41    
42     case $1 in
43     name) echo "${NAME}" ;;
44     id) echo "${ID}" ;;
45     version) echo "${Version}" ;;
46     version_id) echo "${Version_ID}" ;;
47     pretty_name) echo "${PRETTY_NAME}" ;;
48     ansi_color) echo "${ANSI_COLOR}" ;;
49     cpe_name) echo "${CPE_NAME}" ;;
50     esac
51     fi
52    }
53    
54  PATH=/sbin:/bin:$PATH  PATH=/sbin:/bin:$PATH
55    
56  lilo=/sbin/lilo  lilo=/sbin/lilo
# Line 65  then Line 91  then
91  elif [[ ${ARCH} = ppc64 ]] || [[ ${ARCH} = ppc ]]  elif [[ ${ARCH} = ppc64 ]] || [[ ${ARCH} = ppc ]]
92  then  then
93   liloConfig=/etc/yaboot.conf   liloConfig=/etc/yaboot.conf
94     grub2Config=/boot/grub/grub.cfg
95   bootPrefix=/boot   bootPrefix=/boot
96   lilo=/sbin/ybin   lilo=/sbin/ybin
97   liloFlag=yaboot   liloFlag=yaboot
# Line 85  then Line 112  then
112   lilo=/sbin/zipl   lilo=/sbin/zipl
113   runLilo="yes"   runLilo="yes"
114   isx86=""   isx86=""
115  elif [[ ${ARCH} = armv7l ]] || [[ ${ARCH} = armv7hl ]]  elif [[ ${ARCH} =~ armv[5|7].*l ]]
116  then  then
  machine=$(grep "^Hardware" /proc/cpuinfo | sed 's/Hardware\s*:\s*//')  
117   liloConfig=""   liloConfig=""
118   bootPrefix=/boot   bootPrefix=/boot
119   ubootDir=${UBOOT_DIR:-"/boot/uboot"}   extlinuxConfig=$(readlink -f /etc/extlinux.conf 2>/dev/null)
120     ubootDir=${UBOOT_DIR:-"/boot"}
121   ubootScript=$ubootDir/${UBOOT_SCR:-"boot.scr"}   ubootScript=$ubootDir/${UBOOT_SCR:-"boot.scr"}
122   ubootKList=${UBOOT_KLIST:-"klist.txt"}   ubootKList=${UBOOT_KLIST:-"klist.txt"}
123   ubootDevice=/dev/${UBOOT_DEVICE:-"mmcblk0p1"}   ubootDevice=/dev/${UBOOT_DEVICE:-"mmcblk0p1"}
124   ubootDefaultImage=${UBOOT_UIMAGE:-"uImage"}   ubootDefaultImage=${UBOOT_UIMAGE:-"uImage"}
125   ubootDefaultInitrd=${UBOOT_UINITRD:-"uInitrd"}   ubootDefaultInitrd=${UBOOT_UINITRD:-"uInitrd"}
126     ubootAddress=${UBOOT_IMGADDR:-"0x00008000"}
127   mounted=""   mounted=""
128   liloFlag=""   liloFlag=""
129   isx86=""   isx86=""
  if [[ ${machine} == "OMAP3 Beagle Board" ]] || [[ ${machine} == "OMAP4 Panda board" ]]  
  then  
  ubootAddress=0x80008000  
  else  
  ubootAddress=0x00008000  
  fi  
130  else  else
131   # this leaves i?86 and x86_64   # this leaves i?86 and x86_64
132   liloConfig=/etc/lilo.conf   liloConfig=/etc/lilo.conf
# Line 149  usage() Line 171  usage()
171  install()  install()
172  {  {
173   # XXX kernel should be able to be specified also (or work right on ia64)   # XXX kernel should be able to be specified also (or work right on ia64)
174   if [ ! -f ${bootPrefix}/${kernelName}-${version} ]   if [ ! -f ${kernelImage} ]
175   then   then
176   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"
177   return   return
# Line 174  install() Line 196  install()
196   if [[ -z ${initrdfile} ]]   if [[ -z ${initrdfile} ]]
197   then   then
198   [[ -n ${verbose} ]] && echo "No initrd, just adding system map"   [[ -n ${verbose} ]] && echo "No initrd, just adding system map"
199   /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${bootPrefix}/${kernelName}-${version} ${bootPrefix}/vmlinitrd-${version}   /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${kernelImage} ${bootPrefix}/vmlinitrd-${version}
200   else   else
201   /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${bootPrefix}/${kernelName}-${version} ${bootPrefix}/vmlinux.sm-${version}   /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${kernelImage} ${bootPrefix}/vmlinux.sm-${version}
202   /sbin/addRamDisk ${initrdfile} ${bootPrefix}/System.map-${version} ${bootPrefix}/vmlinux.sm-${version} ${bootPrefix}/vmlinitrd-${version} 2>/dev/null   /sbin/addRamDisk ${initrdfile} ${bootPrefix}/System.map-${version} ${bootPrefix}/vmlinux.sm-${version} ${bootPrefix}/vmlinitrd-${version} 2>/dev/null
203   rm ${bootPrefix}/vmlinux.sm-${version}   rm ${bootPrefix}/vmlinux.sm-${version}
204   fi   fi
# Line 184  install() Line 206  install()
206   fi   fi
207    
208   # get the root filesystem to use   # get the root filesystem to use
209   rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab)   rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab  2>/dev/null)
210     if [[ -z $rootdevice ]]
211     then
212     rootdevice=$(grep -o -P "(?<=root=)\S+" /proc/cmdline)
213     fi
214    
215   if [[ -n ${mbkernel} ]] && [[ -n ${cfgLilo} ]] && [[ ${liloFlag} != elilo ]]   if [[ -n ${mbkernel} ]] && [[ -n ${cfgLilo} ]] && [[ ${liloFlag} != elilo ]]
216   then   then
# Line 192  install() Line 218  install()
218   cfgLilo=""   cfgLilo=""
219   fi   fi
220    
221     if [[ -n ${banner} ]]
222     then
223     title="${banner} [ ${version} ]"
224     elif [[ $(read_os_release id) = magellan ]]
225     then
226     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
227     elif [ -f /etc/mageversion ]
228     then
229     title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
230     else
231     title="Magellan Linux [ ${version} ]"
232     fi
233    
234   if [[ -n ${cfgGrub} ]]   if [[ -n ${cfgGrub} ]]
235   then   then
236   [[ -n ${verbose} ]] && echo "adding ${version} to ${grubConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${grubConfig}"
237    
  if [[ -n ${banner} ]]  
  then  
  title="${banner} [ ${version} ]"  
  elif [ -f /etc/mageversion ]  
  then  
  title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"  
  else  
  title="Magellan Linux [ ${version} ]"  
  fi  
238   ${grubby} --grub -c ${grubConfig} \   ${grubby} --grub -c ${grubConfig} \
239   --add-kernel=${bootPrefix}/${kernelName}-${version} \   --add-kernel=${kernelImage} \
240   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
241   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
242   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
# Line 217  install() Line 247  install()
247   then   then
248   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2Config}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2Config}"
249    
  if [[ -n ${banner} ]]  
  then  
  title="${banner} [ ${version} ]"  
  elif [ -f /etc/mageversion ]  
  then  
  title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"  
  else  
  title="Magellan Linux [ ${version} ]"  
  fi  
250   ${grubby} --grub2 -c ${grub2Config} \   ${grubby} --grub2 -c ${grub2Config} \
251   --add-kernel=${bootPrefix}/${kernelName}-${version} \   --add-kernel=${kernelImage} \
252   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
253   ${mbkernel:+--add-multiboot="${mbkernel}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} \
254   ${mbargs:+--mbargs="${mbargs}"} \   ${mbargs:+--mbargs="${mbargs}"} \
# Line 239  install() Line 260  install()
260   then   then
261   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2EfiConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2EfiConfig}"
262    
263   if [[ -n ${banner} ]]   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
264   then   --add-kernel=${kernelImage} \
  title="${banner} [ ${version} ]"  
  elif [ -f /etc/mageversion ]  
  then  
  title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"  
  else  
  title="Magellan Linux [ ${version} ]"  
  fi  
  ${grubby} --grub2 -c ${grub2EfiConfig} \  
  --add-kernel=${bootPrefix}/${kernelName}-${version} \  
265   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
266   ${mbkernel:+--add-multiboot="${mbkernel}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} \
267   ${mbargs:+--mbargs="${mbargs}"} \   ${mbargs:+--mbargs="${mbargs}"} \
# Line 262  install() Line 274  install()
274   then   then
275   [[ -n ${verbose} ]] && echo "adding ${version} to ${liloConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${liloConfig}"
276    
277   ${grubby} --add-kernel=${bootPrefix}/${kernelName}-${version} ${INITRD} \   ${grubby} --add-kernel=${kernelImage} ${INITRD} \
278   --copy-default ${makedefault} --title ${version} \   --copy-default ${makedefault} --title ${version} \
279   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
280   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${version}" \   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${version}" \
# Line 286  install() Line 298  install()
298   then   then
299   [[ -n ${verbose} ]] && echo "adding ${version} to ${extlinuxConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${extlinuxConfig}"
300    
  if [[ -n ${banner} ]]  
  then  
  title="${banner} [ ${version} ]"  
  elif [ -f /etc/mageversion ]  
  then  
  title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"  
  else  
  title="Magellan Linux [ ${version} ]"  
  fi  
301   ${grubby} --extlinux -c ${extlinuxConfig} \   ${grubby} --extlinux -c ${extlinuxConfig} \
302   --add-kernel=${bootPrefix}/${kernelName}-${version} \   --add-kernel=${kernelImage} \
303   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
304   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
305   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
# Line 311  remove() Line 314  remove()
314   if [ -d /proc/iSeries ]   if [ -d /proc/iSeries ]
315   then   then
316   [[ -n ${verbose} ]] && echo "On an iSeries, remove img file"   [[ -n ${verbose} ]] && echo "On an iSeries, remove img file"
317   rm -f ${bootPrefix}/${kernelName}-${version}.img 2>/dev/null   rm -f ${kernelImage}.img 2>/dev/null
318   return   return
319   fi   fi
320    
# Line 319  remove() Line 322  remove()
322   then   then
323   [[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}"
324   ${grubby} --grub -c ${grubConfig} \   ${grubby} --grub -c ${grubConfig} \
325   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
326   else   else
327   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby for grub 0.97"   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby for grub 0.97"
328   fi   fi
# Line 327  remove() Line 330  remove()
330   then   then
331   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2Config}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2Config}"
332   ${grubby} --grub2 -c ${grub2Config} \   ${grubby} --grub2 -c ${grub2Config} \
333   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
334   else   else
335   [[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby for grub 2"   [[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby for grub 2"
336   fi   fi
337   if [[ -n ${cfgGrub2Efi} ]]   if [[ -n ${cfgGrub2Efi} ]]
338   then   then
339   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2EfiConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2EfiConfig}"
340   ${grubby} --grub2 -c ${grub2EfiConfig} \   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
341   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
342   else   else
343   [[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby grub 2 with UEFI"   [[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby grub 2 with UEFI"
344   fi   fi
# Line 343  remove() Line 346  remove()
346   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
347   then   then
348   [[ -n ${verbose} ]] && echo "removing ${version} from ${liloConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${liloConfig}"
349   ${grubby} --remove-kernel=${bootPrefix}/${kernelName}-${version} --${liloFlag}   ${grubby} --remove-kernel=${kernelImage} --${liloFlag}
350    
351   if [[ -n ${runLilo} ]]   if [[ -n ${runLilo} ]]
352   then   then
# Line 367  remove() Line 370  remove()
370   then   then
371   tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)   tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)
372   curversion=$(tail -n1 ${ubootDir}/${ubootKList})   curversion=$(tail -n1 ${ubootDir}/${ubootKList})
373   sed "/${version}/d" ${ubootDir}/${ubootKList} > ${tmpKList}   sed "/$version$/d" ${ubootDir}/${ubootKList} > ${tmpKList}
374   newversion=$(tail -n1 ${tmpKList})   newversion=$(tail -n1 ${tmpKList})
375   if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]   if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]
376   then   then
# Line 402  remove() Line 405  remove()
405   fi   fi
406    
407   mv ${tmpKList} ${ubootDir}/${ubootKList}   mv ${tmpKList} ${ubootDir}/${ubootKList}
408     [ -x /sbin/a-b-c ] && /sbin/a-b-c
409   else   else
410   [[ -n ${verbose} ]] && echo "uImage ${newversion} does not exist!"   [[ -n ${verbose} ]] && echo "uImage ${newversion} does not exist!"
411   [ -f ${tmpKList} ] && rm -f ${tmpKList}   [ -f ${tmpKList} ] && rm -f ${tmpKList}
# Line 417  remove() Line 421  remove()
421   then   then
422   [[ -n ${verbose} ]] && echo "removing ${version} from ${extlinuxConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${extlinuxConfig}"
423   ${grubby} --extlinux -c ${extlinuxConfig} \   ${grubby} --extlinux -c ${extlinuxConfig} \
424   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
425   else   else
426   [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux"   [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux"
427   fi   fi
# Line 425  remove() Line 429  remove()
429    
430  update()  update()
431  {  {
432   if [ ! -f ${bootPrefix}/${kernelName}-${version} ]   if [ ! -f ${kernelImage} ]
433   then   then
434   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"
435   return   return
# Line 447  update() Line 451  update()
451   then   then
452   [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}"
453   ${grubby} --grub -c ${grubConfig} \   ${grubby} --grub -c ${grubConfig} \
454   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
455   ${INITRD} \   ${INITRD} \
456   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
457   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 459  update() Line 463  update()
463   then   then
464   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2Config}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2Config}"
465   ${grubby} --grub2 -c ${grub2Config} \   ${grubby} --grub2 -c ${grub2Config} \
466   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
467   ${INITRD} \   ${INITRD} \
468   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
469   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 470  update() Line 474  update()
474   if [[ -n ${cfgGrub2Efi} ]]   if [[ -n ${cfgGrub2Efi} ]]
475   then   then
476   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2EfiConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2EfiConfig}"
477   ${grubby} --grub2 -c ${grub2EfiConfig} \   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
478   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
479   ${INITRD} \   ${INITRD} \
480   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
481   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 482  update() Line 486  update()
486   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
487   then   then
488   [[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}"
489   ${grubby} --update-kernel=${bootPrefix}/${kernelName}-${version} \   ${grubby} --update-kernel=${kernelImage} \
490   ${INITRD} \   ${INITRD} \
491   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
492   ${removeargs:+--remove-args="${removeargs}"} \   ${removeargs:+--remove-args="${removeargs}"} \
# Line 509  update() Line 513  update()
513   [[ -n ${verbose} ]] && echo "creating uImage-${version}"   [[ -n ${verbose} ]] && echo "creating uImage-${version}"
514   mkimage -A arm -O linux -T kernel -C none -a ${ubootAddress} \   mkimage -A arm -O linux -T kernel -C none -a ${ubootAddress} \
515   -e ${ubootAddress} -n ${version} \   -e ${ubootAddress} -n ${version} \
516   -d ${bootPrefix}/${kernelName}-${version} ${ubootDir}/uImage-${version}   -d ${kernelImage} ${ubootDir}/uImage-${version}
517    
518   [[ -n ${verbose} ]] && echo "creating uInitrd-${version}"   [[ -n ${verbose} ]] && echo "creating uInitrd-${version}"
519   mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 \   mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 \
# Line 528  update() Line 532  update()
532   [[ -n ${verbose} ]] && echo "copy uInitrd-${version} error, kernel not installed!" && exit   [[ -n ${verbose} ]] && echo "copy uInitrd-${version} error, kernel not installed!" && exit
533   fi   fi
534   echo ${version} >> ${ubootDir}/${ubootKList}   echo ${version} >> ${ubootDir}/${ubootKList}
535     [ -x /sbin/a-b-c ] && /sbin/a-b-c
536   else   else
537   [[ -n ${verbose} ]] && echo "cannot make ${version} the default"   [[ -n ${verbose} ]] && echo "cannot make ${version} the default"
538   fi   fi
# Line 539  update() Line 544  update()
544   then   then
545   [[ -n ${verbose} ]] && echo "updating ${version} from ${extlinuxConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${extlinuxConfig}"
546   ${grubby} --extlinux -c ${extlinuxConfig} \   ${grubby} --extlinux -c ${extlinuxConfig} \
547   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
548   ${INITRD} \   ${INITRD} \
549   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
550   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 581  doDepmod() Line 586  doDepmod()
586  doRmmoddep()  doRmmoddep()
587  {  {
588   [[ -n ${verbose} ]] && echo "removing modules.dep info for ${version}"   [[ -n ${verbose} ]] && echo "removing modules.dep info for ${version}"
589   [ -d /lib/modules/${version} ] && rm -f /lib/modules/${version}/modules.*   if [ -d /lib/modules/${version} ]
590     then
591     rm -f /lib/modules/${version}/modules.*.bin \
592     /lib/modules/${version}/modules.{alias,dep,devname,symbols,softdep}
593     fi
594  }  }
595    
596    
# Line 605  do Line 614  do
614   ;;   ;;
615    
616   --initrdfile*)   --initrdfile*)
617   if echo $1 | grep '=' >/dev/null   if [[ $1 == --initrdfile\=* ]]
618   then   then
619   initrdfile=$(echo $1 | sed 's/^--initrdfile=//')   initrdfile=${1#--initrdfile=}
620   else   else
621   initrdfile=$2   initrdfile=$2
622   shift   shift
# Line 615  do Line 624  do
624   ;;   ;;
625    
626   --kernel-args*)   --kernel-args*)
627   if echo $1 | grep '=' >/dev/null   if [[ $1 == --kernel-args\=* ]]
628   then   then
629   kernargs=$(echo $1 | sed 's/^--kernel-args=//')   kernargs=${1#--kernel-args=}
630   else   else
631   kernargs=$2   kernargs=$2
632   shift   shift
# Line 625  do Line 634  do
634   ;;   ;;
635    
636   --remove-args*)   --remove-args*)
637   if echo $1 | grep '=' >/dev/null   if [[ $1 == --remove-args\=* ]]
638   then   then
639   removeargs=$(echo $1 | sed 's/^--remove-args=//')   removeargs=${1#--remove-args=}
640   else   else
641   removeargs=$2   removeargs=$2
642   shift   shift
# Line 635  do Line 644  do
644   ;;   ;;
645    
646   --banner*)   --banner*)
647   if echo $1 | grep '=' >/dev/null   if [[ $1 == --banner\=* ]]
648   then   then
649   banner=$(echo $1 | sed 's/^--banner=//')   banner=${1#--banner=}
650   else   else
651   banner=$2   banner=$2
652   shift   shift
# Line 645  do Line 654  do
654   ;;   ;;
655    
656   --multiboot*)   --multiboot*)
657   if echo $1 |grep '=' >/dev/null   if [[ $1 == --multiboot\=* ]]
658   then   then
659   mbkernel=$(echo $1 | sed 's/^--multiboot=//')   mbkernel=${1#--multiboot=}
660   else   else
661   # can't really support having an optional second arg here   # can't really support having an optional second arg here
662   # sorry!   # sorry!
# Line 656  do Line 665  do
665   ;;   ;;
666    
667   --mbargs*)   --mbargs*)
668   if echo $1 |grep '=' >/dev/null   if [[ $1 == --mbargs\=* ]]
669   then   then
670   mbargs=$(echo $1 | sed 's/^--mbargs=//')   mbargs=${1#--mbargs=}
671   else   else
672   mbargs="$2"   mbargs="$2"
673   shift   shift
# Line 677  do Line 686  do
686   makedefault="--make-default"   makedefault="--make-default"
687   ;;   ;;
688    
689   --package)   --package*)
690   if echo $1 | grep '=' >/dev/null   if [[ $1 == --package\=* ]]
691   then   then
692   package=$(echo $1 | sed 's/^--package=//')   package=${1#--package=}
693   else   else
694   package=$2   package=$2
695   shift   shift
# Line 695  do Line 704  do
704   addplymouthinitrd=--add-plymouth-initrd   addplymouthinitrd=--add-plymouth-initrd
705   ;;   ;;
706    
707     --kernel-image*)
708     if [[ $1 == --kernel-image\=* ]]
709     then
710     kernelImage=${1#--kernel-image=}
711     else
712     kernelImage="$2"
713     shift
714     fi
715     if ! [[ -f ${kernelImage} ]]
716     then
717     echo "Can't find kernel image '${kernelImage}'" >&2
718     usage
719     exit 1
720     fi
721     ;;
722    
723   -v)   -v)
724   verbose=-v   verbose=-v
725   ;;   ;;
# Line 742  then Line 767  then
767   fi   fi
768  fi  fi
769    
770    [[ ${kernelImage} ]] || kernelImage="${bootPrefix}/${kernelName}-${version}"
771    
772  # set the initrd file based on arch; ia64 is the only currently known oddball  # set the initrd file based on arch; ia64 is the only currently known oddball
773  if [[ -z ${initrdfile} ]]  if [[ -z ${initrdfile} ]]
774  then  then
# Line 763  fi Line 790  fi
790  # add dracut i18n, keyboard and plymouth kernel args if requested  # add dracut i18n, keyboard and plymouth kernel args if requested
791  if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]]  if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]]
792  then  then
793   [ -r /etc/conf.d/keymap ] && . /etc/conf.d/keymap   if [ -r /etc/vconsole.conf ]
  [ -r /etc/conf.d/consolefont ] && . /etc/conf.d/consolefont  
   
  if [[ -n ${KEYMAP} ]]  
794   then   then
795   kernargs="${kernargs} KEYTABLE=${KEYMAP}"   . /etc/vconsole.conf
796    
797     for i in SYSFONT SYSFONTACM UNIMAP KEYTABLE
798     do
799     val=$(eval echo \$$i)
800     [[ -n ${val} ]] && kernargs="${kernargs} ${i}=${val}"
801     done
802     else
803     if [ -r /etc/conf.d/consolefont ]
804     then
805     . /etc/conf.d/consolefont
806    
807     if [[ -n ${CONSOLEFONT} ]]
808     then
809     kernargs="${kernargs} SYSFONT=${CONSOLEFONT}"
810     fi
811     fi
812    
813     if  [ -r /etc/conf.d/keymap ]
814     then
815     . /etc/conf.d/keymap
816    
817     if [[ -n ${KEYMAP} ]]
818     then
819     kernargs="${kernargs} KEYTABLE=${KEYMAP}"
820     fi
821     fi
822   fi   fi
823    
824   if [[ -n ${CONSOLEFONT} ]]   if [ -r /etc/locale.conf ]
825   then   then
826   kernargs="${kernargs} SYSFONT=${CONSOLEFONT}"   . /etc/locale.conf
827    
828     if [[ -n ${LANG} ]]
829     then
830     kernargs="${kernargs} LANG=${LANG}"
831     fi
832   fi   fi
833  fi  fi
834    
# Line 831  then Line 886  then
886   fi   fi
887  fi  fi
888    
889    # if we're using U-Boot, check if the default load address should change
890    if [[ -n ${cfguBoot} ]] && [[ -z ${UBOOT_IMGADDR} ]]
891    then
892     [[ ${version}  =~ .([^.]*)$ ]]
893     platform=${BASH_REMATCH[1]}
894     # A few platforms use an alternate kernel load address
895     if [[ ${platform} = omap ]]
896     then
897     ubootAddress=0x80008000
898     elif [[ ${platform} = imx ]]
899     then
900     ubootAddress=0x90008000
901     fi
902    fi
903    
904  # if we have a lilo config on an x86 box, see if the default boot loader  # if we have a lilo config on an x86 box, see if the default boot loader
905  # is lilo to determine if it should be run  # is lilo to determine if it should be run
906  if [[ -n ${cfgLilo} ]] && [[ -n ${isx86} ]]  if [[ -n ${cfgLilo} ]] && [[ -n ${isx86} ]]

Legend:
Removed from v.1757  
changed lines
  Added in v.2259