summaryrefslogtreecommitdiff
path: root/libre/grub/1000-am335x_bone--10_linux-20_linux_xen-detect-devicetree-file.patch
blob: eac637d5b30fa07757d0262582b08d32893762e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
--- a/util/grub.d/10_linux.in	2021-06-17 03:06:45.912081000 -0500
+++ b/util/grub.d/10_linux.in	2021-06-18 02:16:38.219592837 -0500
@@ -155,6 +155,25 @@
 	initrd	$(echo $initrd_path)
 EOF
   fi
+  if [ "$(cat /sys/devices/platform/bone_capemgr/baseboard/board-name)" = 'A335BONE' ]; then
+    if test -f "${rel_dirname}/dtbs/${version}/am335x-bone.dtb" ; then
+    # TRANSLATORS: Device tree path isn't identifier. Should be translated.
+    message="$(gettext_printf "Loading devices tree file ...")"
+    sed "s/^/$submenu_indentation/" << EOF
+	echo	'$(echo "$message" | grub_quote)'
+	devicetree	${rel_dirname}/dtbs/${version}/am335x-bone.dtb
+EOF
+    fi
+  elif [ "$(cat /sys/devices/platform/bone_capemgr/baseboard/board-name)" = 'A335BNLT' ]; then
+    if test -f "${rel_dirname}/dtbs/${version}/am335x-boneblack.dtb" ; then
+    # TRANSLATORS: Device tree path isn't identifier. Should be translated.
+    message="$(gettext_printf "Loading devices tree file ...")"
+    sed "s/^/$submenu_indentation/" << EOF
+	echo	'$(echo "$message" | grub_quote)'
+	devicetree	${rel_dirname}/dtbs/${version}/am335x-boneblack.dtb
+EOF
+    fi
+  fi
   sed "s/^/$submenu_indentation/" << EOF
 }
 EOF
@@ -261,6 +280,16 @@
     fi
   fi
 
+  if [ "$(cat /sys/devices/platform/bone_capemgr/baseboard/board-name)" = 'A335BONE' ]; then
+    if test -f "${dirname}/dtbs/${version}/am335x-bone.dtb" ; then
+      gettext_printf "Found device tree file: %s\n" "${dirname}/dtbs/${version}/am335x-bone.dtb" >&2
+    fi
+  elif [ "$(cat /sys/devices/platform/bone_capemgr/baseboard/board-name)" = 'A335BNLT' ]; then
+    if test -f "${dirname}/dtbs/${version}/am335x-boneblack.dtb" ; then
+      gettext_printf "Found device tree file: %s\n" "${dirname}/dtbs/${version}/am335x-boneblack.dtb" >&2
+    fi
+  fi
+
   # The GRUB_DISABLE_SUBMENU option used to be different than others since it was
   # mentioned in the documentation that has to be set to 'y' instead of 'true' to
   # enable it. This caused a lot of confusion to users that set the option to 'y',
--- a/util/grub.d/20_linux_xen.in	2021-06-17 03:06:56.202081000 -0500
+++ b/util/grub.d/20_linux_xen.in	2021-06-18 02:23:54.679591971 -0500
@@ -172,6 +172,25 @@
 	${module_loader}     ${rel_dirname}/${xenpolicy}
 EOF
   fi
+  if [ "$(cat /sys/devices/platform/bone_capemgr/baseboard/board-name)" = 'A335BONE' ]; then
+    if test -f "${rel_dirname}/dtbs/${version}/am335x-bone.dtb" ; then
+    # TRANSLATORS: Device tree path isn't identifier. Should be translated.
+    message="$(gettext_printf "Loading devices tree file ...")"
+    sed "s/^/$submenu_indentation/" << EOF
+	echo	'$(echo "$message" | grub_quote)'
+	devicetree	${rel_dirname}/dtbs/${version}/am335x-bone.dtb
+EOF
+    fi
+  elif [ "$(cat /sys/devices/platform/bone_capemgr/baseboard/board-name)" = 'A335BNLT' ]; then
+    if test -f "${rel_dirname}/dtbs/${version}/am335x-boneblack.dtb" ; then
+    # TRANSLATORS: Device tree path isn't identifier. Should be translated.
+    message="$(gettext_printf "Loading devices tree file ...")"
+    sed "s/^/$submenu_indentation/" << EOF
+	echo	'$(echo "$message" | grub_quote)'
+	devicetree	${rel_dirname}/dtbs/${version}/am335x-boneblack.dtb
+EOF
+    fi
+  fi
   sed "s/^/$submenu_indentation/" << EOF
 }
 EOF
@@ -316,6 +335,16 @@
 	    fi
 	fi
 
+  if [ "$(cat /sys/devices/platform/bone_capemgr/baseboard/board-name)" = 'A335BONE' ]; then
+    if test -f "${dirname}/dtbs/${version}/am335x-bone.dtb" ; then
+      gettext_printf "Found device tree file: %s\n" "${dirname}/dtbs/${version}/am335x-bone.dtb" >&2
+    fi
+  elif [ "$(cat /sys/devices/platform/bone_capemgr/baseboard/board-name)" = 'A335BNLT' ]; then
+    if test -f "${dirname}/dtbs/${version}/am335x-boneblack.dtb" ; then
+      gettext_printf "Found device tree file: %s\n" "${dirname}/dtbs/${version}/am335x-boneblack.dtb" >&2
+    fi
+  fi
+
 	# The GRUB_DISABLE_SUBMENU option used to be different than others since it was
 	# mentioned in the documentation that has to be set to 'y' instead of 'true' to
 	# enable it. This caused a lot of confusion to users that set the option to 'y',