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 1940 by niro, Mon Oct 1 12:39:50 2012 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 202  install() Line 223  install()
223   elif [ -f /etc/mageversion ]   elif [ -f /etc/mageversion ]
224   then   then
225   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
226     elif [[ $(read_os_release id) = magellan ]]
227     then
228     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
229   else   else
230   title="Magellan Linux [ ${version} ]"   title="Magellan Linux [ ${version} ]"
231   fi   fi
# Line 223  install() Line 247  install()
247   elif [ -f /etc/mageversion ]   elif [ -f /etc/mageversion ]
248   then   then
249   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
250     elif [[ $(read_os_release id) = magellan ]]
251     then
252     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
253   else   else
254   title="Magellan Linux [ ${version} ]"   title="Magellan Linux [ ${version} ]"
255   fi   fi
# Line 245  install() Line 272  install()
272   elif [ -f /etc/mageversion ]   elif [ -f /etc/mageversion ]
273   then   then
274   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
275     elif [[ $(read_os_release id) = magellan ]]
276     then
277     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
278   else   else
279   title="Magellan Linux [ ${version} ]"   title="Magellan Linux [ ${version} ]"
280   fi   fi
281   ${grubby} --grub2 -c ${grub2EfiConfig} \   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
282   --add-kernel=${bootPrefix}/${kernelName}-${version} \   --add-kernel=${bootPrefix}/${kernelName}-${version} \
283   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
284   ${mbkernel:+--add-multiboot="${mbkernel}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} \
# Line 292  install() Line 322  install()
322   elif [ -f /etc/mageversion ]   elif [ -f /etc/mageversion ]
323   then   then
324   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
325     elif [[ $(read_os_release id) = magellan ]]
326     then
327     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
328   else   else
329   title="Magellan Linux [ ${version} ]"   title="Magellan Linux [ ${version} ]"
330   fi   fi
# Line 367  remove() Line 400  remove()
400   then   then
401   tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)   tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)
402   curversion=$(tail -n1 ${ubootDir}/${ubootKList})   curversion=$(tail -n1 ${ubootDir}/${ubootKList})
403   sed "/${version}/d" ${ubootDir}/${ubootKList} > ${tmpKList}   sed "/$version$/d" ${ubootDir}/${ubootKList} > ${tmpKList}
404   newversion=$(tail -n1 ${tmpKList})   newversion=$(tail -n1 ${tmpKList})
405   if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]   if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]
406   then   then
# Line 831  then Line 864  then
864   fi   fi
865  fi  fi
866    
867    # if we're using U-Boot, check if the default load address should change
868    if [[ -n ${cfguBoot} ]] && [[ -z ${UBOOT_IMGADDR} ]]
869    then
870     [[ ${version}  =~ .([^.]*)$ ]]
871     platform=${BASH_REMATCH[1]}
872     # A few platforms use an alternate kernel load address
873     if [[ ${platform} = omap ]]
874     then
875     ubootAddress=0x80008000
876     elif [[ ${platform} = imx ]]
877     then
878     ubootAddress=0x90008000
879     fi
880    fi
881    
882  # 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
883  # is lilo to determine if it should be run  # is lilo to determine if it should be run
884  if [[ -n ${cfgLilo} ]] && [[ -n ${isx86} ]]  if [[ -n ${cfgLilo} ]] && [[ -n ${isx86} ]]

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