1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by scripts/Create-CopyPatch.
4 # T2 SDE: package/*/yaboot/stone_mod_yaboot.sh
5 # Copyright (C) 2004 - 2021 The T2 SDE Project
6 # Copyright (C) 1998 - 2003 ROCK Linux Project
8 # More information can be found in the files COPYING and README.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- T2-COPYRIGHT-NOTE-END ---
16 # [MAIN] 70 yaboot Yaboot Boot Loader Setup
19 create_kernel_list
() {
21 for x
in `(cd /boot/ ; ls vmlinux-*) | sort -r` ; do
22 if [ $first = 1 ] ; then
25 label
=linux-
${x/vmlinux-/}
33 initrd=$bootpath/initrd-${ver}
39 create_yaboot_conf
() {
40 cat << EOT > /etc/yaboot.conf
42 # /etc/yaboot.conf created with the T2 SDE Yaboot STONE module
44 # The bootstrap partition
49 # The partition with the yaboot binaries
52 # Initial multi-boot menu delay
55 # Second yaboot image chooser delay
58 install=$yabootpath/lib/yaboot/yaboot
59 magicboot=$yabootpath/lib/yaboot/ofboot
69 [ "$macosxpart" ] && \
70 echo -e "\nmacosx=$macosxdev\n" \
73 create_kernel_list
>> /etc
/yaboot.conf
75 gui_message
"This is the new /etc/yaboot.conf file:
77 $( cat /etc/yaboot.conf )"
82 # format the boostrap if not already done
83 if hmount
$bootstrapdev > /dev
/null
; then
86 if gui_yesno
"The boostrap device \
87 $bootstrapdev is not yet HFS formated. \
95 # maybe an unpatched yaboot and no devfsd (e.g. during install)
96 [ ! -c /dev
/nvram
] && ln -s /dev
/misc
/nvram
/dev
/nvram
101 yaboot_install_doit
() {
102 gui_cmd
'Installing Yaboot' "echo 'calling ybin' ; ybin"
106 local dev
="`sed -n "s
,\
([^
]*\
) $1 .
*,\
1,p
" /proc/mounts | tail -n 1`"
107 if [ ! "$dev" ] ; then # try the higher dentry
108 local try
="`dirname $1`"
109 dev
="`grep \" $try \" /proc/mounts | tail -n 1 | \
112 if [ -h "$dev" ] ; then
113 echo "/dev/`readlink $dev`"
122 dir
="`dirname $dir`/`readlink $dir`"
123 dir
="`echo $dir | sed 's,[^/]*/\.\./,,g'`"
128 rootdev
="`device4 /`"
129 dev
="${rootdev%%[0-9]*}"
130 bootdev
="`device4 /boot`"
131 yabootdev
="`device4 /usr`"
133 bootstrappart
="`parted $dev print | grep bootstrap | sed 's/ *\([[:digit:]]\+\) .*/\1/'`"
134 bootstrapdev
="$dev$bootstrappart"
136 macosxpart
="`parted $dev print | grep "hfs
+.
*OS X
" | head -n 1 | sed 's/ .*//'`"
137 [ "$macosxpart" ] && macosxdev
="$dev$macosxpart"
139 if [ "$rootdev" = "$bootdev" ]
140 then bootpath
=/boot
; else bootpath
="" ; fi
142 if [ "$rootdev" = "$yabootdev" ]
143 then yabootpath
=/usr
; else yabootpath
="" ; fi
144 yabootpart
="`echo $yabootdev | sed 's/[^0-9]*//'`"
146 if [ ! -f /etc
/yaboot.conf
] ; then
147 if gui_yesno
"Yaboot does not appear to be configured.
148 Automatically install yaboot now?"; then
150 if ! yaboot_install
; then
151 gui_message
"There was an error while installing yaboot."
158 gui_menu yaboot
'Yaboot Boot Loader Setup' \
159 "Following settings only for expert use: (default)" ""\
160 "Bootstrap Device ...... $bootstrapdev" "" \
161 "Yaboot partition:path . $yabootpart:$yabootpath" "" \
162 "Root Device ........... $rootdev" "" \
163 "Boot Device ........... $bootdev" "" \
164 "MacOS X partition ..... $macosxdev" "" \
166 '(Re-)Create default /etc/yaboot.conf' 'create_yaboot_conf' \
167 '(Re-)Install the yaboot boot chrp script and binary' 'yaboot_install' \
169 "Edit /etc/yaboot.conf (Config file)" \
170 "gui_edit 'Yaboot Configuration' /etc/yaboot.conf"