[PATCH] RSB: add GRUB2 to the RTEMS tools and use it in 6/rtems-x86_64 build set

Karel Gardas karel at functional.vision
Sat Nov 13 20:46:02 UTC 2021


---
 rtems/config/6/rtems-x86_64.bset       |  5 ++
 rtems/config/tools/rtems-grub-2.06.cfg |  8 +++
 source-builder/config/grub2.cfg        | 75 ++++++++++++++++++++++++++
 3 files changed, 88 insertions(+)
 create mode 100644 rtems/config/tools/rtems-grub-2.06.cfg
 create mode 100644 source-builder/config/grub2.cfg

diff --git a/rtems/config/6/rtems-x86_64.bset b/rtems/config/6/rtems-x86_64.bset
index dbfc9e6..088c9f5 100644
--- a/rtems/config/6/rtems-x86_64.bset
+++ b/rtems/config/6/rtems-x86_64.bset
@@ -1,4 +1,9 @@
 %define release 1
 %define rtems_arch x86_64
 %define with_libgomp
+%define grub2_platform efi
+%define grub2_target x86_64
+
 %include 6/rtems-default.bset
+
+tools/rtems-grub-2.06
diff --git a/rtems/config/tools/rtems-grub-2.06.cfg b/rtems/config/tools/rtems-grub-2.06.cfg
new file mode 100644
index 0000000..977e230
--- /dev/null
+++ b/rtems/config/tools/rtems-grub-2.06.cfg
@@ -0,0 +1,8 @@
+%include %{_configdir}/checks.cfg
+%include %{_configdir}/base.cfg
+
+%define grub2_version 2.06
+
+%hash sha512 grub-%{grub2_version}.tar.xz 4f11c648f3078567e53fc0c74d5026fdc6da4be27d188975e79d9a4df817ade0fe5ad2ddd694238a07edc45adfa02943d83c57767dd51548102b375e529e8efe
+
+%include %{_configdir}/grub2.cfg
diff --git a/source-builder/config/grub2.cfg b/source-builder/config/grub2.cfg
new file mode 100644
index 0000000..2333d6a
--- /dev/null
+++ b/source-builder/config/grub2.cfg
@@ -0,0 +1,75 @@
+#
+# GNU GRUB, the GRand Unified Bootloader
+#
+# This configuration file configure's, make's and install's GRUB2.
+#
+
+%define grub2_platform_supported = 1
+
+%ifos darwin
+%undefine grub2_platform_supported
+%{echo "Darwin does not support Grub2 compilation by default."}
+%{echo "If you need Grub2 on Darwin, please install objconv"}
+%{echo "and enable it by removing '%undefine grub2_platform_supported' above"}
+%endif
+
+%if %{defined grub2_platform_supported}
+
+%if %{release} == %{nil}
+%define release 1
+%endif
+
+Name:      grub2-%{grub2_version}-%{_host}-%{release}
+Summary:   GNU GRUB, the GRand Unified Bootloader v%{grub2_version} for target %{_target} on host %{_host}
+Version:   %{grub2_version}
+Release:   %{release}
+URL: 	   https://www.gnu.org/software/grub/index.html
+
+#
+# Source
+#
+%source set grub2 https://ftp.gnu.org/gnu/grub/grub-%{grub2_version}.tar.xz
+
+#
+# Prepare the source code.
+#
+%prep
+  build_top=$(pwd)
+
+  %source setup grub2 -q -n grub-%{grub2_version}
+
+  cd ${build_top}
+
+%build
+  build_top=$(pwd)
+
+  cd grub-%{grub2_version}
+
+  %{host_build_flags}
+
+  ./configure \
+    --build=%{_build} --host=%{_host} \
+    --verbose \
+    --prefix=%{_prefix} --bindir=%{_bindir} \
+    --exec-prefix=%{_exec_prefix} \
+    --includedir=%{_includedir} --libdir=%{_libdir} \
+    --mandir=%{_mandir} --infodir=%{_infodir} \
+    --with-platform=%{grub2_platform} \
+    --target=%{grub2_target} \
+    --disable-libzfs           # broken on FreeBSD and not needed at all
+
+  %{__make} %{?_smp_mflags} all
+
+  cd ${build_top}
+
+%install
+  build_top=$(pwd)
+
+  rm -rf $SB_BUILD_ROOT
+
+  cd grub-%{grub2_version}
+  %{__make} DESTDIR=$SB_BUILD_ROOT install
+
+  cd ${build_top}
+
+%endif
-- 
2.25.1



More information about the devel mailing list