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 2242 by niro, Mon Oct 21 13:50:31 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"}   ubootDir=${UBOOT_DIR:-"/boot"}
120   ubootScript=$ubootDir/${UBOOT_SCR:-"boot.scr"}   ubootScript=$ubootDir/${UBOOT_SCR:-"boot.scr"}
121   ubootKList=${UBOOT_KLIST:-"klist.txt"}   ubootKList=${UBOOT_KLIST:-"klist.txt"}
122   ubootDevice=/dev/${UBOOT_DEVICE:-"mmcblk0p1"}   ubootDevice=/dev/${UBOOT_DEVICE:-"mmcblk0p1"}
123   ubootDefaultImage=${UBOOT_UIMAGE:-"uImage"}   ubootDefaultImage=${UBOOT_UIMAGE:-"uImage"}
124   ubootDefaultInitrd=${UBOOT_UINITRD:-"uInitrd"}   ubootDefaultInitrd=${UBOOT_UINITRD:-"uInitrd"}
125     ubootAddress=${UBOOT_IMGADDR:-"0x00008000"}
126   mounted=""   mounted=""
127   liloFlag=""   liloFlag=""
128   isx86=""   isx86=""
  if [[ ${machine} == "OMAP3 Beagle Board" ]] || [[ ${machine} == "OMAP4 Panda board" ]]  
  then  
  ubootAddress=0x80008000  
  else  
  ubootAddress=0x00008000  
  fi  
129  else  else
130   # this leaves i?86 and x86_64   # this leaves i?86 and x86_64
131   liloConfig=/etc/lilo.conf   liloConfig=/etc/lilo.conf
# Line 149  usage() Line 170  usage()
170  install()  install()
171  {  {
172   # 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)
173   if [ ! -f ${bootPrefix}/${kernelName}-${version} ]   if [ ! -f ${kernelImage} ]
174   then   then
175   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"
176   return   return
# Line 174  install() Line 195  install()
195   if [[ -z ${initrdfile} ]]   if [[ -z ${initrdfile} ]]
196   then   then
197   [[ -n ${verbose} ]] && echo "No initrd, just adding system map"   [[ -n ${verbose} ]] && echo "No initrd, just adding system map"
198   /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${bootPrefix}/${kernelName}-${version} ${bootPrefix}/vmlinitrd-${version}   /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${kernelImage} ${bootPrefix}/vmlinitrd-${version}
199   else   else
200   /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${bootPrefix}/${kernelName}-${version} ${bootPrefix}/vmlinux.sm-${version}   /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${kernelImage} ${bootPrefix}/vmlinux.sm-${version}
201   /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
202   rm ${bootPrefix}/vmlinux.sm-${version}   rm ${bootPrefix}/vmlinux.sm-${version}
203   fi   fi
# Line 184  install() Line 205  install()
205   fi   fi
206    
207   # get the root filesystem to use   # get the root filesystem to use
208   rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab)   rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab  2>/dev/null)
209     if [[ -z $rootdevice ]]
210     then
211     rootdevice=$(grep -o -P "(?<=root=)\S+" /proc/cmdline)
212     fi
213    
214   if [[ -n ${mbkernel} ]] && [[ -n ${cfgLilo} ]] && [[ ${liloFlag} != elilo ]]   if [[ -n ${mbkernel} ]] && [[ -n ${cfgLilo} ]] && [[ ${liloFlag} != elilo ]]
215   then   then
# Line 192  install() Line 217  install()
217   cfgLilo=""   cfgLilo=""
218   fi   fi
219    
220     if [[ -n ${banner} ]]
221     then
222     title="${banner} [ ${version} ]"
223     elif [[ $(read_os_release id) = magellan ]]
224     then
225     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
226     elif [ -f /etc/mageversion ]
227     then
228     title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
229     else
230     title="Magellan Linux [ ${version} ]"
231     fi
232    
233   if [[ -n ${cfgGrub} ]]   if [[ -n ${cfgGrub} ]]
234   then   then
235   [[ -n ${verbose} ]] && echo "adding ${version} to ${grubConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${grubConfig}"
236    
  if [[ -n ${banner} ]]  
  then  
  title="${banner} [ ${version} ]"  
  elif [ -f /etc/mageversion ]  
  then  
  title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"  
  else  
  title="Magellan Linux [ ${version} ]"  
  fi  
237   ${grubby} --grub -c ${grubConfig} \   ${grubby} --grub -c ${grubConfig} \
238   --add-kernel=${bootPrefix}/${kernelName}-${version} \   --add-kernel=${kernelImage} \
239   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
240   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
241   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
# Line 217  install() Line 246  install()
246   then   then
247   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2Config}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2Config}"
248    
  if [[ -n ${banner} ]]  
  then  
  title="${banner} [ ${version} ]"  
  elif [ -f /etc/mageversion ]  
  then  
  title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"  
  else  
  title="Magellan Linux [ ${version} ]"  
  fi  
249   ${grubby} --grub2 -c ${grub2Config} \   ${grubby} --grub2 -c ${grub2Config} \
250   --add-kernel=${bootPrefix}/${kernelName}-${version} \   --add-kernel=${kernelImage} \
251   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
252   ${mbkernel:+--add-multiboot="${mbkernel}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} \
253   ${mbargs:+--mbargs="${mbargs}"} \   ${mbargs:+--mbargs="${mbargs}"} \
# Line 239  install() Line 259  install()
259   then   then
260   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2EfiConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2EfiConfig}"
261    
262   if [[ -n ${banner} ]]   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
263   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} \  
264   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
265   ${mbkernel:+--add-multiboot="${mbkernel}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} \
266   ${mbargs:+--mbargs="${mbargs}"} \   ${mbargs:+--mbargs="${mbargs}"} \
# Line 262  install() Line 273  install()
273   then   then
274   [[ -n ${verbose} ]] && echo "adding ${version} to ${liloConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${liloConfig}"
275    
276   ${grubby} --add-kernel=${bootPrefix}/${kernelName}-${version} ${INITRD} \   ${grubby} --add-kernel=${kernelImage} ${INITRD} \
277   --copy-default ${makedefault} --title ${version} \   --copy-default ${makedefault} --title ${version} \
278   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
279   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${version}" \   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${version}" \
# Line 286  install() Line 297  install()
297   then   then
298   [[ -n ${verbose} ]] && echo "adding ${version} to ${extlinuxConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${extlinuxConfig}"
299    
  if [[ -n ${banner} ]]  
  then  
  title="${banner} [ ${version} ]"  
  elif [ -f /etc/mageversion ]  
  then  
  title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"  
  else  
  title="Magellan Linux [ ${version} ]"  
  fi  
300   ${grubby} --extlinux -c ${extlinuxConfig} \   ${grubby} --extlinux -c ${extlinuxConfig} \
301   --add-kernel=${bootPrefix}/${kernelName}-${version} \   --add-kernel=${kernelImage} \
302   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
303   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
304   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
# Line 311  remove() Line 313  remove()
313   if [ -d /proc/iSeries ]   if [ -d /proc/iSeries ]
314   then   then
315   [[ -n ${verbose} ]] && echo "On an iSeries, remove img file"   [[ -n ${verbose} ]] && echo "On an iSeries, remove img file"
316   rm -f ${bootPrefix}/${kernelName}-${version}.img 2>/dev/null   rm -f ${kernelImage}.img 2>/dev/null
317   return   return
318   fi   fi
319    
# Line 319  remove() Line 321  remove()
321   then   then
322   [[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}"
323   ${grubby} --grub -c ${grubConfig} \   ${grubby} --grub -c ${grubConfig} \
324   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
325   else   else
326   [[ -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"
327   fi   fi
# Line 327  remove() Line 329  remove()
329   then   then
330   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2Config}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2Config}"
331   ${grubby} --grub2 -c ${grub2Config} \   ${grubby} --grub2 -c ${grub2Config} \
332   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
333   else   else
334   [[ -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"
335   fi   fi
336   if [[ -n ${cfgGrub2Efi} ]]   if [[ -n ${cfgGrub2Efi} ]]
337   then   then
338   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2EfiConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2EfiConfig}"
339   ${grubby} --grub2 -c ${grub2EfiConfig} \   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
340   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
341   else   else
342   [[ -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"
343   fi   fi
# Line 343  remove() Line 345  remove()
345   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
346   then   then
347   [[ -n ${verbose} ]] && echo "removing ${version} from ${liloConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${liloConfig}"
348   ${grubby} --remove-kernel=${bootPrefix}/${kernelName}-${version} --${liloFlag}   ${grubby} --remove-kernel=${kernelImage} --${liloFlag}
349    
350   if [[ -n ${runLilo} ]]   if [[ -n ${runLilo} ]]
351   then   then
# Line 367  remove() Line 369  remove()
369   then   then
370   tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)   tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)
371   curversion=$(tail -n1 ${ubootDir}/${ubootKList})   curversion=$(tail -n1 ${ubootDir}/${ubootKList})
372   sed "/${version}/d" ${ubootDir}/${ubootKList} > ${tmpKList}   sed "/$version$/d" ${ubootDir}/${ubootKList} > ${tmpKList}
373   newversion=$(tail -n1 ${tmpKList})   newversion=$(tail -n1 ${tmpKList})
374   if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]   if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]
375   then   then
# Line 417  remove() Line 419  remove()
419   then   then
420   [[ -n ${verbose} ]] && echo "removing ${version} from ${extlinuxConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${extlinuxConfig}"
421   ${grubby} --extlinux -c ${extlinuxConfig} \   ${grubby} --extlinux -c ${extlinuxConfig} \
422   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
423   else   else
424   [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux"   [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux"
425   fi   fi
# Line 425  remove() Line 427  remove()
427    
428  update()  update()
429  {  {
430   if [ ! -f ${bootPrefix}/${kernelName}-${version} ]   if [ ! -f ${kernelImage} ]
431   then   then
432   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"
433   return   return
# Line 447  update() Line 449  update()
449   then   then
450   [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}"
451   ${grubby} --grub -c ${grubConfig} \   ${grubby} --grub -c ${grubConfig} \
452   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
453   ${INITRD} \   ${INITRD} \
454   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
455   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 459  update() Line 461  update()
461   then   then
462   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2Config}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2Config}"
463   ${grubby} --grub2 -c ${grub2Config} \   ${grubby} --grub2 -c ${grub2Config} \
464   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
465   ${INITRD} \   ${INITRD} \
466   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
467   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 470  update() Line 472  update()
472   if [[ -n ${cfgGrub2Efi} ]]   if [[ -n ${cfgGrub2Efi} ]]
473   then   then
474   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2EfiConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2EfiConfig}"
475   ${grubby} --grub2 -c ${grub2EfiConfig} \   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
476   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
477   ${INITRD} \   ${INITRD} \
478   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
479   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 482  update() Line 484  update()
484   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
485   then   then
486   [[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}"
487   ${grubby} --update-kernel=${bootPrefix}/${kernelName}-${version} \   ${grubby} --update-kernel=${kernelImage} \
488   ${INITRD} \   ${INITRD} \
489   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
490   ${removeargs:+--remove-args="${removeargs}"} \   ${removeargs:+--remove-args="${removeargs}"} \
# Line 509  update() Line 511  update()
511   [[ -n ${verbose} ]] && echo "creating uImage-${version}"   [[ -n ${verbose} ]] && echo "creating uImage-${version}"
512   mkimage -A arm -O linux -T kernel -C none -a ${ubootAddress} \   mkimage -A arm -O linux -T kernel -C none -a ${ubootAddress} \
513   -e ${ubootAddress} -n ${version} \   -e ${ubootAddress} -n ${version} \
514   -d ${bootPrefix}/${kernelName}-${version} ${ubootDir}/uImage-${version}   -d ${kernelImage} ${ubootDir}/uImage-${version}
515    
516   [[ -n ${verbose} ]] && echo "creating uInitrd-${version}"   [[ -n ${verbose} ]] && echo "creating uInitrd-${version}"
517   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 539  update() Line 541  update()
541   then   then
542   [[ -n ${verbose} ]] && echo "updating ${version} from ${extlinuxConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${extlinuxConfig}"
543   ${grubby} --extlinux -c ${extlinuxConfig} \   ${grubby} --extlinux -c ${extlinuxConfig} \
544   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
545   ${INITRD} \   ${INITRD} \
546   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
547   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 581  doDepmod() Line 583  doDepmod()
583  doRmmoddep()  doRmmoddep()
584  {  {
585   [[ -n ${verbose} ]] && echo "removing modules.dep info for ${version}"   [[ -n ${verbose} ]] && echo "removing modules.dep info for ${version}"
586   [ -d /lib/modules/${version} ] && rm -f /lib/modules/${version}/modules.*   if [ -d /lib/modules/${version} ]
587     then
588     rm -f /lib/modules/${version}/modules.*.bin \
589     /lib/modules/${version}/modules.{alias|dep|devname|symbols|softdep}
590     fi
591  }  }
592    
593    
# Line 605  do Line 611  do
611   ;;   ;;
612    
613   --initrdfile*)   --initrdfile*)
614   if echo $1 | grep '=' >/dev/null   if [[ $1 == --initrdfile\=* ]]
615   then   then
616   initrdfile=$(echo $1 | sed 's/^--initrdfile=//')   initrdfile=${1#--initrdfile=}
617   else   else
618   initrdfile=$2   initrdfile=$2
619   shift   shift
# Line 615  do Line 621  do
621   ;;   ;;
622    
623   --kernel-args*)   --kernel-args*)
624   if echo $1 | grep '=' >/dev/null   if [[ $1 == --kernel-args\=* ]]
625   then   then
626   kernargs=$(echo $1 | sed 's/^--kernel-args=//')   kernargs=${1#--kernel-args=}
627   else   else
628   kernargs=$2   kernargs=$2
629   shift   shift
# Line 625  do Line 631  do
631   ;;   ;;
632    
633   --remove-args*)   --remove-args*)
634   if echo $1 | grep '=' >/dev/null   if [[ $1 == --remove-args\=* ]]
635   then   then
636   removeargs=$(echo $1 | sed 's/^--remove-args=//')   removeargs=${1#--remove-args=}
637   else   else
638   removeargs=$2   removeargs=$2
639   shift   shift
# Line 635  do Line 641  do
641   ;;   ;;
642    
643   --banner*)   --banner*)
644   if echo $1 | grep '=' >/dev/null   if [[ $1 == --banner\=* ]]
645   then   then
646   banner=$(echo $1 | sed 's/^--banner=//')   banner=${1#--banner=}
647   else   else
648   banner=$2   banner=$2
649   shift   shift
# Line 645  do Line 651  do
651   ;;   ;;
652    
653   --multiboot*)   --multiboot*)
654   if echo $1 |grep '=' >/dev/null   if [[ $1 == --multiboot\=* ]]
655   then   then
656   mbkernel=$(echo $1 | sed 's/^--multiboot=//')   mbkernel=${1#--multiboot=}
657   else   else
658   # can't really support having an optional second arg here   # can't really support having an optional second arg here
659   # sorry!   # sorry!
# Line 656  do Line 662  do
662   ;;   ;;
663    
664   --mbargs*)   --mbargs*)
665   if echo $1 |grep '=' >/dev/null   if [[ $1 == --mbargs\=* ]]
666   then   then
667   mbargs=$(echo $1 | sed 's/^--mbargs=//')   mbargs=${1#--mbargs=}
668   else   else
669   mbargs="$2"   mbargs="$2"
670   shift   shift
# Line 677  do Line 683  do
683   makedefault="--make-default"   makedefault="--make-default"
684   ;;   ;;
685    
686   --package)   --package*)
687   if echo $1 | grep '=' >/dev/null   if [[ $1 == --package\=* ]]
688   then   then
689   package=$(echo $1 | sed 's/^--package=//')   package=${1#--package=}
690   else   else
691   package=$2   package=$2
692   shift   shift
# Line 695  do Line 701  do
701   addplymouthinitrd=--add-plymouth-initrd   addplymouthinitrd=--add-plymouth-initrd
702   ;;   ;;
703    
704     --kernel-image*)
705     if [[ $1 == --kernel-image\=* ]]
706     then
707     kernelImage=${1#--kernel-image=}
708     else
709     kernelImage="$2"
710     shift
711     fi
712     if ! [[ -f ${kernelImage} ]]
713     then
714     echo "Can't find kernel image '${kernelImage}'" >&2
715     usage
716     exit 1
717     fi
718     ;;
719    
720   -v)   -v)
721   verbose=-v   verbose=-v
722   ;;   ;;
# Line 742  then Line 764  then
764   fi   fi
765  fi  fi
766    
767    [[ ${kernelImage} ]] || kernelImage="${bootPrefix}/${kernelName}-${version}"
768    
769  # 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
770  if [[ -z ${initrdfile} ]]  if [[ -z ${initrdfile} ]]
771  then  then
# Line 763  fi Line 787  fi
787  # add dracut i18n, keyboard and plymouth kernel args if requested  # add dracut i18n, keyboard and plymouth kernel args if requested
788  if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]]  if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]]
789  then  then
790   [ -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} ]]  
791   then   then
792   kernargs="${kernargs} KEYTABLE=${KEYMAP}"   . /etc/vconsole.conf
793    
794     for i in SYSFONT SYSFONTACM UNIMAP KEYTABLE
795     do
796     val=$(eval echo \$$i)
797     [[ -n ${val} ]] && kernargs="${kernargs} ${i}=${val}"
798     done
799     else
800     if [ -r /etc/conf.d/consolefont ]
801     then
802     . /etc/conf.d/consolefont
803    
804     if [[ -n ${CONSOLEFONT} ]]
805     then
806     kernargs="${kernargs} SYSFONT=${CONSOLEFONT}"
807     fi
808     fi
809    
810     if  [ -r /etc/conf.d/keymap ]
811     then
812     . /etc/conf.d/keymap
813    
814     if [[ -n ${KEYMAP} ]]
815     then
816     kernargs="${kernargs} KEYTABLE=${KEYMAP}"
817     fi
818     fi
819   fi   fi
820    
821   if [[ -n ${CONSOLEFONT} ]]   if [ -r /etc/locale.conf ]
822   then   then
823   kernargs="${kernargs} SYSFONT=${CONSOLEFONT}"   . /etc/locale.conf
824    
825     if [[ -n ${LANG} ]]
826     then
827     kernargs="${kernargs} LANG=${LANG}"
828     fi
829   fi   fi
830  fi  fi
831    
# Line 831  then Line 883  then
883   fi   fi
884  fi  fi
885    
886    # if we're using U-Boot, check if the default load address should change
887    if [[ -n ${cfguBoot} ]] && [[ -z ${UBOOT_IMGADDR} ]]
888    then
889     [[ ${version}  =~ .([^.]*)$ ]]
890     platform=${BASH_REMATCH[1]}
891     # A few platforms use an alternate kernel load address
892     if [[ ${platform} = omap ]]
893     then
894     ubootAddress=0x80008000
895     elif [[ ${platform} = imx ]]
896     then
897     ubootAddress=0x90008000
898     fi
899    fi
900    
901  # 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
902  # is lilo to determine if it should be run  # is lilo to determine if it should be run
903  if [[ -n ${cfgLilo} ]] && [[ -n ${isx86} ]]  if [[ -n ${cfgLilo} ]] && [[ -n ${isx86} ]]

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