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 2699 by niro, Wed Jul 16 10:50:58 2014 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 123  initrd="" Line 145  initrd=""
145  dracut=""  dracut=""
146  dracuthostonly=""  dracuthostonly=""
147  initrdfile=""  initrdfile=""
148    devtreefile=""
149  moddep=""  moddep=""
150  verbose=""  verbose=""
151  makedefault=""  makedefault=""
# Line 140  usage() Line 163  usage()
163   echo "       [--banner=<banner>] [--multiboot=multiboot]" >&2   echo "       [--banner=<banner>] [--multiboot=multiboot]" >&2
164   echo "       [--mbargs=mbargs] [--make-default] [--add-dracut-args]" >&2   echo "       [--mbargs=mbargs] [--make-default] [--add-dracut-args]" >&2
165   echo "       [--add-plymouth-initrd]" >&2   echo "       [--add-plymouth-initrd]" >&2
166   echo "       [--host-only]" >&2   echo "       [--host-only] [--devtree=<devicetree.dtb>]" >&2
167   echo "       <--install | --remove | --update> <kernel-version>" >&2   echo "       <--install | --remove | --update> <kernel-version>" >&2
168   echo "       (ex: $(basename $0) --mkinitrd --depmod --install 2.4.7-2)" >&2   echo "       (ex: $(basename $0) --mkinitrd --depmod --install 2.4.7-2)" >&2
169   exit 1   exit 1
# Line 149  usage() Line 172  usage()
172  install()  install()
173  {  {
174   # 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)
175   if [ ! -f ${bootPrefix}/${kernelName}-${version} ]   if [ ! -f ${kernelImage} ]
176   then   then
177   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"
178   return   return
# Line 167  install() Line 190  install()
190   fi   fi
191   fi   fi
192    
193     DEVTREE=""
194     if [[ x${devtreefile} != x ]] && [ -f ${devtreefile} ]
195     then
196     [[ -n ${verbose} ]] && echo "found ${devtreefile} and using it with grubby"
197     DEVTREE="--devtree ${devtreefile}"
198     fi
199    
200   # FIXME: is this a good heuristic to find out if we're on iSeries?   # FIXME: is this a good heuristic to find out if we're on iSeries?
201   if [ -d /proc/iSeries ]   if [ -d /proc/iSeries ]
202   then   then
# Line 174  install() Line 204  install()
204   if [[ -z ${initrdfile} ]]   if [[ -z ${initrdfile} ]]
205   then   then
206   [[ -n ${verbose} ]] && echo "No initrd, just adding system map"   [[ -n ${verbose} ]] && echo "No initrd, just adding system map"
207   /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${bootPrefix}/${kernelName}-${version} ${bootPrefix}/vmlinitrd-${version}   /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${kernelImage} ${bootPrefix}/vmlinitrd-${version}
208   else   else
209   /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${bootPrefix}/${kernelName}-${version} ${bootPrefix}/vmlinux.sm-${version}   /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${kernelImage} ${bootPrefix}/vmlinux.sm-${version}
210   /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
211   rm ${bootPrefix}/vmlinux.sm-${version}   rm ${bootPrefix}/vmlinux.sm-${version}
212   fi   fi
# Line 184  install() Line 214  install()
214   fi   fi
215    
216   # get the root filesystem to use   # get the root filesystem to use
217   rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab)   rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab  2>/dev/null)
218     if [[ -z $rootdevice ]]
219     then
220     rootdevice=$(grep -o -P "(?<=root=)\S+" /proc/cmdline)
221     fi
222    
223   if [[ -n ${mbkernel} ]] && [[ -n ${cfgLilo} ]] && [[ ${liloFlag} != elilo ]]   if [[ -n ${mbkernel} ]] && [[ -n ${cfgLilo} ]] && [[ ${liloFlag} != elilo ]]
224   then   then
# Line 192  install() Line 226  install()
226   cfgLilo=""   cfgLilo=""
227   fi   fi
228    
229   if [[ -n ${cfgGrub} ]]   if [[ -n ${banner} ]]
230   then   then
231   [[ -n ${verbose} ]] && echo "adding ${version} to ${grubConfig}"   if [[ ${ARCH} = s390 ]] || [[ ${ARCH} = s390x ]]
   
  if [[ -n ${banner} ]]  
232   then   then
233   title="${banner} [ ${version} ]"   title=$(echo ${banner} | sed 's/ /_/g')
  elif [ -f /etc/mageversion ]  
  then  
  title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"  
234   else   else
235   title="Magellan Linux [ ${version} ]"   title="${banner} [ ${version} ]"
236   fi   fi
237     elif [[ ${ARCH} = s390 ]] || [[ ${ARCH} = s390x ]]
238     then
239     title=$(echo ${version} | sed 's/ /_/g')
240     elif [ -f /etc/os-release ]
241     then
242     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
243     elif [ -f /etc/mageversion ]
244     then
245     title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
246     else
247     title="Magellan Linux [ ${version} ]"
248     fi
249    
250     if [[ -n ${cfgGrub} ]]
251     then
252     [[ -n ${verbose} ]] && echo "adding ${version} to ${grubConfig}"
253    
254   ${grubby} --grub -c ${grubConfig} \   ${grubby} --grub -c ${grubConfig} \
255   --add-kernel=${bootPrefix}/${kernelName}-${version} \   --add-kernel=${kernelImage} \
256   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
257   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
258   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
# Line 217  install() Line 263  install()
263   then   then
264   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2Config}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2Config}"
265    
  if [[ -n ${banner} ]]  
  then  
  title="${banner} [ ${version} ]"  
  elif [ -f /etc/mageversion ]  
  then  
  title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"  
  else  
  title="Magellan Linux [ ${version} ]"  
  fi  
266   ${grubby} --grub2 -c ${grub2Config} \   ${grubby} --grub2 -c ${grub2Config} \
267   --add-kernel=${bootPrefix}/${kernelName}-${version} \   --add-kernel=${kernelImage} \
268   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
269   ${mbkernel:+--add-multiboot="${mbkernel}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} \
270   ${mbargs:+--mbargs="${mbargs}"} \   ${mbargs:+--mbargs="${mbargs}"} \
# Line 239  install() Line 276  install()
276   then   then
277   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2EfiConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2EfiConfig}"
278    
279   if [[ -n ${banner} ]]   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
280   then   --add-kernel=${kernelImage} ${DEVTREE} \
  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} \  
281   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
282   ${mbkernel:+--add-multiboot="${mbkernel}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} \
283   ${mbargs:+--mbargs="${mbargs}"} \   ${mbargs:+--mbargs="${mbargs}"} \
# Line 262  install() Line 290  install()
290   then   then
291   [[ -n ${verbose} ]] && echo "adding ${version} to ${liloConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${liloConfig}"
292    
293   ${grubby} --add-kernel=${bootPrefix}/${kernelName}-${version} ${INITRD} \   ${grubby} --add-kernel=${kernelImage} ${INITRD} \
294   --copy-default ${makedefault} --title ${version} \   --copy-default ${makedefault} --title "${title}" \
295   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
296   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${version}" \   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${version}" \
297   --${liloFlag}   --${liloFlag}
# Line 286  install() Line 314  install()
314   then   then
315   [[ -n ${verbose} ]] && echo "adding ${version} to ${extlinuxConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${extlinuxConfig}"
316    
  if [[ -n ${banner} ]]  
  then  
  title="${banner} [ ${version} ]"  
  elif [ -f /etc/mageversion ]  
  then  
  title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"  
  else  
  title="Magellan Linux [ ${version} ]"  
  fi  
317   ${grubby} --extlinux -c ${extlinuxConfig} \   ${grubby} --extlinux -c ${extlinuxConfig} \
318   --add-kernel=${bootPrefix}/${kernelName}-${version} \   --add-kernel=${kernelImage} \
319   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
320   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
321   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
# Line 311  remove() Line 330  remove()
330   if [ -d /proc/iSeries ]   if [ -d /proc/iSeries ]
331   then   then
332   [[ -n ${verbose} ]] && echo "On an iSeries, remove img file"   [[ -n ${verbose} ]] && echo "On an iSeries, remove img file"
333   rm -f ${bootPrefix}/${kernelName}-${version}.img 2>/dev/null   rm -f ${kernelImage}.img 2>/dev/null
334   return   return
335   fi   fi
336    
# Line 319  remove() Line 338  remove()
338   then   then
339   [[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}"
340   ${grubby} --grub -c ${grubConfig} \   ${grubby} --grub -c ${grubConfig} \
341   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
342   else   else
343   [[ -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"
344   fi   fi
# Line 327  remove() Line 346  remove()
346   then   then
347   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2Config}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2Config}"
348   ${grubby} --grub2 -c ${grub2Config} \   ${grubby} --grub2 -c ${grub2Config} \
349   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
350   else   else
351   [[ -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"
352   fi   fi
353   if [[ -n ${cfgGrub2Efi} ]]   if [[ -n ${cfgGrub2Efi} ]]
354   then   then
355   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2EfiConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2EfiConfig}"
356   ${grubby} --grub2 -c ${grub2EfiConfig} \   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
357   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
358   else   else
359   [[ -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"
360   fi   fi
# Line 343  remove() Line 362  remove()
362   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
363   then   then
364   [[ -n ${verbose} ]] && echo "removing ${version} from ${liloConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${liloConfig}"
365   ${grubby} --remove-kernel=${bootPrefix}/${kernelName}-${version} --${liloFlag}   ${grubby} --remove-kernel=${kernelImage} --${liloFlag}
366    
367   if [[ -n ${runLilo} ]]   if [[ -n ${runLilo} ]]
368   then   then
# Line 367  remove() Line 386  remove()
386   then   then
387   tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)   tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)
388   curversion=$(tail -n1 ${ubootDir}/${ubootKList})   curversion=$(tail -n1 ${ubootDir}/${ubootKList})
389   sed "/${version}/d" ${ubootDir}/${ubootKList} > ${tmpKList}   sed "/$version$/d" ${ubootDir}/${ubootKList} > ${tmpKList}
390   newversion=$(tail -n1 ${tmpKList})   newversion=$(tail -n1 ${tmpKList})
391   if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]   if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]
392   then   then
# Line 402  remove() Line 421  remove()
421   fi   fi
422    
423   mv ${tmpKList} ${ubootDir}/${ubootKList}   mv ${tmpKList} ${ubootDir}/${ubootKList}
424     [ -x /sbin/a-b-c ] && /sbin/a-b-c
425   else   else
426   [[ -n ${verbose} ]] && echo "uImage ${newversion} does not exist!"   [[ -n ${verbose} ]] && echo "uImage ${newversion} does not exist!"
427   [ -f ${tmpKList} ] && rm -f ${tmpKList}   [ -f ${tmpKList} ] && rm -f ${tmpKList}
# Line 417  remove() Line 437  remove()
437   then   then
438   [[ -n ${verbose} ]] && echo "removing ${version} from ${extlinuxConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${extlinuxConfig}"
439   ${grubby} --extlinux -c ${extlinuxConfig} \   ${grubby} --extlinux -c ${extlinuxConfig} \
440   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
441   else   else
442   [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux"   [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux"
443   fi   fi
# Line 425  remove() Line 445  remove()
445    
446  update()  update()
447  {  {
448   if [ ! -f ${bootPrefix}/${kernelName}-${version} ]   if [ ! -f ${kernelImage} ]
449   then   then
450   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"
451   return   return
# Line 447  update() Line 467  update()
467   then   then
468   [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}"
469   ${grubby} --grub -c ${grubConfig} \   ${grubby} --grub -c ${grubConfig} \
470   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
471   ${INITRD} \   ${INITRD} \
472   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
473   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"} \
474     ${mbkernel:+--add-multiboot="${mbkernel}"}
475   else   else
476   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby"
477   fi   fi
# Line 459  update() Line 480  update()
480   then   then
481   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2Config}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2Config}"
482   ${grubby} --grub2 -c ${grub2Config} \   ${grubby} --grub2 -c ${grub2Config} \
483   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
484   ${INITRD} \   ${INITRD} \
485   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
486   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 470  update() Line 491  update()
491   if [[ -n ${cfgGrub2Efi} ]]   if [[ -n ${cfgGrub2Efi} ]]
492   then   then
493   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2EfiConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2EfiConfig}"
494   ${grubby} --grub2 -c ${grub2EfiConfig} \   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
495   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
496   ${INITRD} \   ${INITRD} \
497   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
498   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 482  update() Line 503  update()
503   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
504   then   then
505   [[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}"
506   ${grubby} --update-kernel=${bootPrefix}/${kernelName}-${version} \   ${grubby} --update-kernel=${kernelImage} \
507   ${INITRD} \   ${INITRD} \
508   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
509   ${removeargs:+--remove-args="${removeargs}"} \   ${removeargs:+--remove-args="${removeargs}"} \
# Line 509  update() Line 530  update()
530   [[ -n ${verbose} ]] && echo "creating uImage-${version}"   [[ -n ${verbose} ]] && echo "creating uImage-${version}"
531   mkimage -A arm -O linux -T kernel -C none -a ${ubootAddress} \   mkimage -A arm -O linux -T kernel -C none -a ${ubootAddress} \
532   -e ${ubootAddress} -n ${version} \   -e ${ubootAddress} -n ${version} \
533   -d ${bootPrefix}/${kernelName}-${version} ${ubootDir}/uImage-${version}   -d ${kernelImage} ${ubootDir}/uImage-${version}
534    
535   [[ -n ${verbose} ]] && echo "creating uInitrd-${version}"   [[ -n ${verbose} ]] && echo "creating uInitrd-${version}"
536   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 549  update()
549   [[ -n ${verbose} ]] && echo "copy uInitrd-${version} error, kernel not installed!" && exit   [[ -n ${verbose} ]] && echo "copy uInitrd-${version} error, kernel not installed!" && exit
550   fi   fi
551   echo ${version} >> ${ubootDir}/${ubootKList}   echo ${version} >> ${ubootDir}/${ubootKList}
552     [ -x /sbin/a-b-c ] && /sbin/a-b-c
553   else   else
554   [[ -n ${verbose} ]] && echo "cannot make ${version} the default"   [[ -n ${verbose} ]] && echo "cannot make ${version} the default"
555   fi   fi
# Line 539  update() Line 561  update()
561   then   then
562   [[ -n ${verbose} ]] && echo "updating ${version} from ${extlinuxConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${extlinuxConfig}"
563   ${grubby} --extlinux -c ${extlinuxConfig} \   ${grubby} --extlinux -c ${extlinuxConfig} \
564   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
565   ${INITRD} \   ${INITRD} \
566   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
567   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 581  doDepmod() Line 603  doDepmod()
603  doRmmoddep()  doRmmoddep()
604  {  {
605   [[ -n ${verbose} ]] && echo "removing modules.dep info for ${version}"   [[ -n ${verbose} ]] && echo "removing modules.dep info for ${version}"
606   [ -d /lib/modules/${version} ] && rm -f /lib/modules/${version}/modules.*   if [ -d /lib/modules/${version} ]
607     then
608     rm -f /lib/modules/${version}/modules.*.bin \
609     /lib/modules/${version}/modules.{alias,dep,devname,symbols,softdep}
610     fi
611  }  }
612    
613    
# Line 596  do Line 622  do
622   initrd="remove"   initrd="remove"
623   ;;   ;;
624    
625     --devtree*)
626     if [[ $1 == --devtree\=* ]]
627     then
628     devtreefile="${1#--devtreefile=}"
629     else
630     devtreefile="$2"
631     shift
632     fi
633     ;;
634    
635   --dracut)   --dracut)
636   dracut=--dracut   dracut=--dracut
637   ;;   ;;
# Line 605  do Line 641  do
641   ;;   ;;
642    
643   --initrdfile*)   --initrdfile*)
644   if echo $1 | grep '=' >/dev/null   if [[ $1 == --initrdfile\=* ]]
645   then   then
646   initrdfile=$(echo $1 | sed 's/^--initrdfile=//')   initrdfile=${1#--initrdfile=}
647   else   else
648   initrdfile=$2   initrdfile=$2
649   shift   shift
# Line 615  do Line 651  do
651   ;;   ;;
652    
653   --kernel-args*)   --kernel-args*)
654   if echo $1 | grep '=' >/dev/null   if [[ $1 == --kernel-args\=* ]]
655   then   then
656   kernargs=$(echo $1 | sed 's/^--kernel-args=//')   kernargs=${1#--kernel-args=}
657   else   else
658   kernargs=$2   kernargs=$2
659   shift   shift
# Line 625  do Line 661  do
661   ;;   ;;
662    
663   --remove-args*)   --remove-args*)
664   if echo $1 | grep '=' >/dev/null   if [[ $1 == --remove-args\=* ]]
665   then   then
666   removeargs=$(echo $1 | sed 's/^--remove-args=//')   removeargs=${1#--remove-args=}
667   else   else
668   removeargs=$2   removeargs=$2
669   shift   shift
# Line 635  do Line 671  do
671   ;;   ;;
672    
673   --banner*)   --banner*)
674   if echo $1 | grep '=' >/dev/null   if [[ $1 == --banner\=* ]]
675   then   then
676   banner=$(echo $1 | sed 's/^--banner=//')   banner=${1#--banner=}
677   else   else
678   banner=$2   banner=$2
679   shift   shift
# Line 645  do Line 681  do
681   ;;   ;;
682    
683   --multiboot*)   --multiboot*)
684   if echo $1 |grep '=' >/dev/null   if [[ $1 == --multiboot\=* ]]
685   then   then
686   mbkernel=$(echo $1 | sed 's/^--multiboot=//')   mbkernel=${1#--multiboot=}
687   else   else
688   # can't really support having an optional second arg here   # can't really support having an optional second arg here
689   # sorry!   # sorry!
# Line 656  do Line 692  do
692   ;;   ;;
693    
694   --mbargs*)   --mbargs*)
695   if echo $1 |grep '=' >/dev/null   if [[ $1 == --mbargs\=* ]]
696   then   then
697   mbargs=$(echo $1 | sed 's/^--mbargs=//')   mbargs=${1#--mbargs=}
698   else   else
699   mbargs="$2"   mbargs="$2"
700   shift   shift
# Line 677  do Line 713  do
713   makedefault="--make-default"   makedefault="--make-default"
714   ;;   ;;
715    
716   --package)   --package*)
717   if echo $1 | grep '=' >/dev/null   if [[ $1 == --package\=* ]]
718   then   then
719   package=$(echo $1 | sed 's/^--package=//')   package=${1#--package=}
720   else   else
721   package=$2   package=$2
722   shift   shift
# Line 695  do Line 731  do
731   addplymouthinitrd=--add-plymouth-initrd   addplymouthinitrd=--add-plymouth-initrd
732   ;;   ;;
733    
734     --kernel-image*)
735     if [[ $1 == --kernel-image\=* ]]
736     then
737     kernelImage=${1#--kernel-image=}
738     else
739     kernelImage="$2"
740     shift
741     fi
742     if ! [[ -f ${kernelImage} ]]
743     then
744     echo "Can't find kernel image '${kernelImage}'" >&2
745     usage
746     exit 1
747     fi
748     ;;
749    
750   -v)   -v)
751   verbose=-v   verbose=-v
752   ;;   ;;
# Line 742  then Line 794  then
794   fi   fi
795  fi  fi
796    
797    [[ ${kernelImage} ]] || kernelImage="${bootPrefix}/${kernelName}-${version}"
798    
799  # 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
800  if [[ -z ${initrdfile} ]]  if [[ -z ${initrdfile} ]]
801  then  then
# Line 763  fi Line 817  fi
817  # add dracut i18n, keyboard and plymouth kernel args if requested  # add dracut i18n, keyboard and plymouth kernel args if requested
818  if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]]  if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]]
819  then  then
820   [ -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} ]]  
821   then   then
822   kernargs="${kernargs} KEYTABLE=${KEYMAP}"   . /etc/vconsole.conf
823    
824     for i in SYSFONT SYSFONTACM UNIMAP KEYTABLE
825     do
826     val=$(eval echo \$$i)
827     [[ -n ${val} ]] && kernargs="${kernargs} ${i}=${val}"
828     done
829     else
830     if [ -r /etc/conf.d/consolefont ]
831     then
832     . /etc/conf.d/consolefont
833    
834     if [[ -n ${CONSOLEFONT} ]]
835     then
836     kernargs="${kernargs} SYSFONT=${CONSOLEFONT}"
837     fi
838     fi
839    
840     if  [ -r /etc/conf.d/keymap ]
841     then
842     . /etc/conf.d/keymap
843    
844     if [[ -n ${KEYMAP} ]]
845     then
846     kernargs="${kernargs} KEYTABLE=${KEYMAP}"
847     fi
848     fi
849   fi   fi
850    
851   if [[ -n ${CONSOLEFONT} ]]   if [ -r /etc/locale.conf ]
852   then   then
853   kernargs="${kernargs} SYSFONT=${CONSOLEFONT}"   . /etc/locale.conf
854    
855     if [[ -n ${LANG} ]]
856     then
857     kernargs="${kernargs} LANG=${LANG}"
858     fi
859   fi   fi
860  fi  fi
861    
# Line 831  then Line 913  then
913   fi   fi
914  fi  fi
915    
916    # if we're using U-Boot, check if the default load address should change
917    if [[ -n ${cfguBoot} ]] && [[ -z ${UBOOT_IMGADDR} ]]
918    then
919     [[ ${version}  =~ .([^.]*)$ ]]
920     platform=${BASH_REMATCH[1]}
921     # A few platforms use an alternate kernel load address
922     if [[ ${platform} = omap ]]
923     then
924     ubootAddress=0x80008000
925     elif [[ ${platform} = imx ]]
926     then
927     ubootAddress=0x90008000
928     fi
929    fi
930    
931  # 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
932  # is lilo to determine if it should be run  # is lilo to determine if it should be run
933  if [[ -n ${cfgLilo} ]] && [[ -n ${isx86} ]]  if [[ -n ${cfgLilo} ]] && [[ -n ${isx86} ]]

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