* move libffi to base/ Category
[t2sde.git] / package / boot / aboot / stone_mod_aboot.sh
blob0f58ed6198fdb8eed5f502d677f6eeb08528b409
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/aboot/stone_mod_aboot.sh
3 # Copyright (C) 2004 - 2025 The T2 SDE Project
4 #
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License version 2.
10 # --- T2-COPYRIGHT-NOTE-END ---
12 # [MAIN] 70 aboot Aboot Boot Loader Setup
13 # [SETUP] 90 aboot
15 create_kernel_list() {
16 local alpha_idx=0
17 for x in `(cd /boot/; ls vmlinux-*gz) | sort -Vr`; do
18 ver=${x/vmlinux-}; ver=${ver%.gz}
19 cat << EOT
20 $((alpha_idyx++)):${bootdev##*[^0-9]}$bootpath/$x initrd=$bootpath/initrd-${ver} root=$rootdev ro
21 EOT
22 done
25 create_aboot_conf() {
26 cat << EOT > /boot/aboot.conf
28 # /boot/aboot.conf created with the T2 SDE Aboot STONE module
30 EOT
32 create_kernel_list >> /boot/aboot.conf
34 gui_message "This is the new /boot/aboot.conf file:
36 $(< /boot/aboot.conf)"
39 aboot_install() {
40 gui_cmd 'Installing Aboot' "echo 'calling swriteboot'; swriteboot ${bootdev%%[0-9]} /boot/bootlx"
43 device4()
45 local dev="`grep \" $1 \" /proc/mounts | tail -n 1 |
46 cut -d ' ' -f 1`"
47 if [ ! "$dev" ]; then # try the higher dentry
48 local try="`dirname $1`"
49 dev="`grep \" $try \" /proc/mounts | tail -n 1 | \
50 cut -d ' ' -f 1`"
52 if [ -h "$dev" ]; then
53 echo "/dev/`readlink $dev`"
54 else
55 echo $dev
59 realpath() {
60 dir="`dirname $1`"
61 file="`basename $1`"
62 dir="`dirname $dir`/`readlink $dir`"
63 dir="`echo $dir | sed 's,[^/]*/\.\./,,g'`"
64 echo $dir/$file
67 main() {
68 rootdev="`device4 /`"
69 bootdev="`device4 /boot`"
71 if [ "$rootdev" = "$bootdev" ]
72 then bootpath=/boot; else bootpath=""; fi
74 if [ ! -f /boot/aboot.conf ]; then
75 if gui_yesno "Aboot does not appear to be configured.
76 Automatically install Aboot now?"; then
77 create_aboot_conf
78 if ! aboot_install; then
79 gui_message "There was an error while installing Aboot."
84 while
86 gui_menu yaboot 'Aboot Boot Loader Setup' \
87 "Root Device ........... $rootdev" "" \
88 "Boot Device ........... $bootdev" "" \
89 "Boot Path ............. $bootpath" "" \
90 '' '' \
91 '(Re-)Create aboot.conf with installed kernels' 'create_aboot_conf' \
92 '(Re-)Install Aboot' 'aboot_install' \
93 '' '' \
94 "Edit /boot/aboot.conf (Config file)" \
95 "gui_edit 'STONE Configuration' /boot/aboot.conf"
96 do : ; done