Re: [RFC PATCH] efi: Add build error for new EFI arches that do not specify INITRD_MAX_ADDRESS_OFFSET
On Mon, 10 Jul 2023 at 20:33, Glenn Washburn wrote: > > Non-x86 EFI architectures were using a INITRD_MAX_ADDRESS_OFFSET defined > by the aarch64 architecture. This seems to generally work, as in no one > has complained about this. However, the code is misleading. Architectures > should explicitly set INITRD_MAX_ADDRESS_OFFSET. To avoid breaking current > EFI architectures, set to GRUB_EFI_MAX_USABLE_ADDRESS, effectively allowing > the entire address range. New architectures will fail to build until this > macro is set. > > Signed-off-by: Glenn Washburn > --- > My reading of a reply on the list[1] is that RISCV has no limit for the > initrd. But I think it would be good to point to documentation describing > limitations as in the ARM comments. > AIUI, RISC-V may support 3, 4 or 5 levels of paging, and it may depend on the kernel configuration which of those are actually supported. This may affect the addressability of the linear region, and given EDK2's tendency to allocate from the top of memory downwards, imposing no limit at all may result allocations that the kernel cannot access. That said, is this even an issue for RISC-V? As far as I remember, the LoadFile2 based initrd loading method was supported from the beginning, and so this is mostly dead code anyway on RISC-V, and perhaps it would be better to simply disable it. > > [1] https://lists.gnu.org/archive/html/grub-devel/2021-07/msg1.html > --- > grub-core/loader/efi/linux.c | 18 ++ > 1 file changed, 14 insertions(+), 4 deletions(-) > > diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c > index ab8fb35adb05..8f5460ba11e0 100644 > --- a/grub-core/loader/efi/linux.c > +++ b/grub-core/loader/efi/linux.c > @@ -28,6 +28,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -290,21 +291,30 @@ grub_linux_unload (void) > } > > #if !defined(__i386__) && !defined(__x86_64__) > +#if defined (__arm__) > /* > * As per linux/Documentation/arm/Booting > * ARM initrd needs to be covered by kernel linear mapping, > * so place it in the first 512MB of DRAM. > - * > + */ > +#define INITRD_MAX_ADDRESS_OFFSET (512U * 1024 * 1024) > +#elif defined (__aarch64__) > +/* > * As per linux/Documentation/arm64/booting.txt > * ARM64 initrd needs to be contained entirely within a 1GB aligned window > * of up to 32GB of size that covers the kernel image as well. > * Since the EFI stub loader will attempt to load the kernel near start of > * RAM, place the buffer in the first 32GB of RAM. > */ > -#ifdef __arm__ > -#define INITRD_MAX_ADDRESS_OFFSET (512U * 1024 * 1024) > -#else /* __aarch64__ */ > #define INITRD_MAX_ADDRESS_OFFSET (32ULL * 1024 * 1024 * 1024) > +#elif defined (__ia64__) || defined (__riscv) || defined (__loongarch_lp64) > +/* > + * There has been no investigation into constraints on the initrd address > + * for these platforms. Allow all the available address space for now. > + */ > +#define INITRD_MAX_ADDRESS_OFFSET GRUB_EFI_MAX_USABLE_ADDRESS > +#else > +#error "Unknown INITRD_MAX_ADDRESS_OFFSET for architecture" > #endif > > /* > -- > 2.34.1 > ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: How to detect the amount of RAM on non-EFI platforms?
Hi again, On 2023/7/11 10:08, Cyan via Grub-devel wrote: > static int > traverse_mmap_hook (grub_uint64_t addr, grub_uint64_t size, > grub_memory_type_t type, > void *data __attribute__ ((unused))) > { > total_mem_bytes += size; > } > I discovered a huge problem in my hook function: missing a return at the end of the hook function. Without this return the hook function will execute only once. And, regions with type GRUB_MEMORY_RESERVED should be skipped. So the hook function body should look like this: if (type != GRUB_MEMORY_RESERVED) { total_mem_bytes += size; } return GRUB_ERR_NONE; After this change the result looks fine. Regards, Cinhi ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH] util/grub.d/25_bli.in: fix shebang on unmerged-usr
On Mon, 10 Jul 2023 23:55:43 -0500 Oskari Pirhonen wrote: > On an unmerged-usr system, grub-mkconfig errors out with the following > error due to /usr/bin/sh not existing: > > /usr/sbin/grub-mkconfig: /etc/grub.d/25_bli: /usr/bin/sh: bad interpreter: No > such file or directory > > Use a /bin/sh shebang to fix the error as well as match the other > existing files. > > Signed-off-by: Oskari Pirhonen > --- > util/grub.d/25_bli.in | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/util/grub.d/25_bli.in b/util/grub.d/25_bli.in > index 6e4538716..26e27a019 100644 > --- a/util/grub.d/25_bli.in > +++ b/util/grub.d/25_bli.in > @@ -1,4 +1,4 @@ > -#!/usr/bin/sh > +#! /bin/sh > set -e > > # grub-mkconfig helper script. Reviewed-by: Glenn Washburn Glenn ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
[PATCH v4] docs: Add missing assumption
Also reword a prior sentence to be more clear. Fixes: 5a3d2b4742df (docs: Add debugging chapter to development documentation) Signed-off-by: Glenn Washburn --- Range-diff against v3: 1: 437c408b31cb ! 1: c228e0412720 docs: Add missing assumption @@ docs/grub-dev.texi: GDB is started from the @file{grub-core} directory in the GR -If not building GRUB, the distribution may have a package which installs +When using a pre-built GRUB, the distribution may have a package which installs this GDB script along with debug symbol binaries, such as Debian's --@samp{grub-pc-dbg} package. The GDB script is intended to be used + @samp{grub-pc-dbg} package. The GDB script is intended to be used -like so, assuming: -+@samp{grub-pc-dbg} package. The GDB script is intended to by used +like so, assuming that @samp{/path/to/script} is the path to the directory +containing the gdb_grub script and debug symbol files: docs/grub-dev.texi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi index 0834ca562ad6..a695b02f06df 100644 --- a/docs/grub-dev.texi +++ b/docs/grub-dev.texi @@ -660,10 +660,11 @@ GDB is started from the @file{grub-core} directory in the GRUB2 build directory. GRUB2 developers have made this more simple by including a GDB script which does much of the setup. This file is at @file{grub-core/gdb_grub} in the build directory and is also installed via @command{make install}. -If not building GRUB, the distribution may have a package which installs +When using a pre-built GRUB, the distribution may have a package which installs this GDB script along with debug symbol binaries, such as Debian's @samp{grub-pc-dbg} package. The GDB script is intended to be used -like so, assuming: +like so, assuming that @samp{/path/to/script} is the path to the directory +containing the gdb_grub script and debug symbol files: @example cd $(dirname /path/to/script/gdb_grub) -- 2.34.1 ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH v3] docs: Add missing assumption
On Mon, 10 Jul 2023 22:34:58 -0500 Oskari Pirhonen wrote: > On Mon, Jul 10, 2023 at 12:14:48 -0500, Glenn Washburn wrote: > > Also reword a prior sentence to be more clear. > > > > Fixes: 5a3d2b4742df (docs: Add debugging chapter to development > > documentation) > > Signed-off-by: Glenn Washburn > > --- > > v3: Fix rebase merge error (scripts -> script) > > v2: rebase > > --- > > docs/grub-dev.texi | 7 --- > > 1 file changed, 4 insertions(+), 3 deletions(-) > > > > diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi > > index 0834ca562ad6..f7c944dc9e20 100644 > > --- a/docs/grub-dev.texi > > +++ b/docs/grub-dev.texi > > @@ -660,10 +660,11 @@ GDB is started from the @file{grub-core} directory in > > the GRUB2 build > > directory. GRUB2 developers have made this more simple by including a GDB > > script which does much of the setup. This file is at > > @file{grub-core/gdb_grub} > > in the build directory and is also installed via @command{make install}. > > -If not building GRUB, the distribution may have a package which installs > > +When using a pre-built GRUB, the distribution may have a package which > > installs > > this GDB script along with debug symbol binaries, such as Debian's > > -@samp{grub-pc-dbg} package. The GDB script is intended to be used > > -like so, assuming: > > +@samp{grub-pc-dbg} package. The GDB script is intended to by used > > Aw man, it seems to have picked up the original "by" which was changed > to "be". Looking back at v2 it was there as well, but I only commented > on the "script/scripts" portion. My bad on that. > > Thanks for putting up with all these tiny changes. I've made sure to > read over it multiple times. The next one should be the final one. Thanks for the sharp eye. I should have caught that also, but wasn't looking. Glenn > > - Oskari > > > +like so, assuming that @samp{/path/to/script} is the path to the directory > > +containing the gdb_grub script and debug symbol files: > > > > @example > > cd $(dirname /path/to/script/gdb_grub) > > -- > > 2.34.1 > > ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH v4] docs: Add missing assumption
On Tue, Jul 11, 2023 at 12:07:29 -0500, Glenn Washburn wrote: > Also reword a prior sentence to be more clear. > > Fixes: 5a3d2b4742df (docs: Add debugging chapter to development documentation) > Signed-off-by: Glenn Washburn LGTM, thanks. Reviewed-by: Oskari Pirhonen - Oskari > --- > Range-diff against v3: > 1: 437c408b31cb ! 1: c228e0412720 docs: Add missing assumption > @@ docs/grub-dev.texi: GDB is started from the @file{grub-core} directory > in the GR > -If not building GRUB, the distribution may have a package which installs > +When using a pre-built GRUB, the distribution may have a package which > installs > this GDB script along with debug symbol binaries, such as Debian's > --@samp{grub-pc-dbg} package. The GDB script is intended to be used > + @samp{grub-pc-dbg} package. The GDB script is intended to be used > -like so, assuming: > -+@samp{grub-pc-dbg} package. The GDB script is intended to by used > +like so, assuming that @samp{/path/to/script} is the path to the > directory > +containing the gdb_grub script and debug symbol files: > > > docs/grub-dev.texi | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi > index 0834ca562ad6..a695b02f06df 100644 > --- a/docs/grub-dev.texi > +++ b/docs/grub-dev.texi > @@ -660,10 +660,11 @@ GDB is started from the @file{grub-core} directory in > the GRUB2 build > directory. GRUB2 developers have made this more simple by including a GDB > script which does much of the setup. This file is at > @file{grub-core/gdb_grub} > in the build directory and is also installed via @command{make install}. > -If not building GRUB, the distribution may have a package which installs > +When using a pre-built GRUB, the distribution may have a package which > installs > this GDB script along with debug symbol binaries, such as Debian's > @samp{grub-pc-dbg} package. The GDB script is intended to be used > -like so, assuming: > +like so, assuming that @samp{/path/to/script} is the path to the directory > +containing the gdb_grub script and debug symbol files: > > @example > cd $(dirname /path/to/script/gdb_grub) > -- > 2.34.1 > signature.asc Description: PGP signature ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel