[MULTIBOOT2 SPEC PATCH v4 26/27] multiboot2: Generate symbol lists and disassembly file

2020-05-14 Thread Hans Ulrich Niedermann
Generate symbol lists (kernel.sym with nm and kernel.vsym with objdump) and a complete disassembly of the finished kernel image. This helps with examining how the built kernel image is actually linked and what parts of the code and data have ended up where. This makes the example kernel more educ

[MULTIBOOT2 SPEC PATCH v4 25/27] multiboot2: Generate gcc temp files (*.i and *.s)

2020-05-14 Thread Hans Ulrich Niedermann
Generate gcc temporary files for each object file, showing the intermediate steps after the C preprocessor and immediately before assembly. This helps with examining how the example kernel code is generated, making the example kernel more educational. Signed-off-by: Hans Ulrich Niedermann diff

[MULTIBOOT2 SPEC PATCH v4 21/27] multiboot2: "make distcheck" with example kernel enabled

2020-05-14 Thread Hans Ulrich Niedermann
Even if no one ever does a tarball release of the Multiboot2 spec, "make distcheck" is a good way of checking the build system's integrity. Signed-off-by: Hans Ulrich Niedermann diff --git a/Makefile.am b/Makefile.am index 70eec9cd0..38e797aa7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +

[MULTIBOOT2 SPEC PATCH v4 19/27] multiboot2: Set -nostdlib before AC_PROG_CC for x-compile

2020-05-14 Thread Hans Ulrich Niedermann
Set -nostdlib in CFLAGS and LDFLAGS before AC_PROG_CC if we appear to be cross-compiling. This makes the example kernel build work on my x86_64 system with both * native compile to generate i386 example kernel ./configure --enable-example-kernel * cross-compile to generate mips exampl

[MULTIBOOT2 SPEC PATCH v4 22/27] multiboot2: Always define the kernel_* vars

2020-05-14 Thread Hans Ulrich Niedermann
Always define the kernel_* vars independent of the BUILD_EXAMPLE_KERNEL conditional. This should make sure that we actually distribute the kernel sources even when we are not building the example kernel. Note that this does not mean we always *build* the example kernel. EXTRA_PROGRAMS are *not* bu

[MULTIBOOT2 SPEC PATCH v4 23/27] multiboot2: Generate per object file listings

2020-05-14 Thread Hans Ulrich Niedermann
Generate one listing file *.lst per object file *.o. This allows easy examination of the generated machine code, making the example kernel more educational. Signed-off-by: Hans Ulrich Niedermann diff --git a/.gitignore b/.gitignore index e27a3e0e2..7a035c267 100644 --- a/.gitignore +++ b/.gitig

[MULTIBOOT2 SPEC PATCH v4 20/27] multiboot2: mips build wants __start symbol

2020-05-14 Thread Hans Ulrich Niedermann
When building the example kernel for mips, there is a warning about __start being undefined and some default address being chosen as start address. As this does not inspire confidence, we add a __start symbol at the same place where start and _start are already defined. Now the mips build builds

[MULTIBOOT2 SPEC PATCH v4 12/27] multiboot2: Add boot_mips.S example code to docs

2020-05-14 Thread Hans Ulrich Niedermann
Add the boot_mips.S file to the example code documentation. Before this, while boot_mips.S was the boot code always built, boot_i386.S was the only documented boot code. Now both boot_i386.S and boot_mips.S are in the docs, with the build situation remaining unchanged. Signed-off-by: Hans Ulrich

[MULTIBOOT2 SPEC PATCH v4 14/27] multiboot2: Fix example kernel header tag alignment

2020-05-14 Thread Hans Ulrich Niedermann
Properly align all Multiboot2 header tags to 8 byte boundaries as per the Multiboot2 specification. Note that the assembler directive ".align 8" is machine dependent: On i386, it means "align to 8 byte boundary". On mips, it means that the lower 8 bits of address must be zero, i.e. ".align 8" alig

[MULTIBOOT2 SPEC PATCH v4 27/27] multiboot2: Add labels around the termination tag

2020-05-14 Thread Hans Ulrich Niedermann
For code consistency and more clarity as to what these .short and .long values actually are, use the same system for labeling the terminator header tag as for labeling all other header tags. This improves the readability of the code, without changing the actual output. Signed-off-by: Hans Ulrich

[MULTIBOOT2 SPEC PATCH v4 18/27] multiboot2: Use predefined #ifdef __ASSEMBLER__

2020-05-14 Thread Hans Ulrich Niedermann
GCC already predefines __ASSEMBLER__ for .S files (assembly with C preprocessor), so we can just use that instead of defining our own ASM_FILE macro. Signed-off-by: Hans Ulrich Niedermann diff --git a/doc/boot_i386.S b/doc/boot_i386.S index 14dc14660..2aa2a92b6 100644 --- a/doc/boot_i386.S +++ b

[MULTIBOOT2 SPEC PATCH v4 17/27] multiboot2: Clean up stack (cdecl calling conventions)

2020-05-14 Thread Hans Ulrich Niedermann
Clean up the stack after calling C functions according to the i386 cdecl calling conventions. Signed-off-by: Hans Ulrich Niedermann diff --git a/doc/boot_i386.S b/doc/boot_i386.S index 20a600a6e..14dc14660 100644 --- a/doc/boot_i386.S +++ b/doc/boot_i386.S @@ -101,10 +101,12 @@ multiboot_entry:

[MULTIBOOT2 SPEC PATCH v4 10/27] multiboot2: Rename boot.S to boot_i386.S

2020-05-14 Thread Hans Ulrich Niedermann
The file boot.S contains only i386 specific code. Rename the file to boot_i386.S following the pattern of having the mips specific code in the boot_mips.S file. Signed-off-by: Hans Ulrich Niedermann rename doc/{boot.S => boot_i386.S} (100%) diff --git a/doc/Makefile.am b/doc/Makefile.am index

[MULTIBOOT2 SPEC PATCH v4 15/27] multiboot2: Remove unreferenced AOUT_KLUDGE

2020-05-14 Thread Hans Ulrich Niedermann
Remove unreferenced AOUT_KLUDGE from both boot_i386.S and boot_mips.S. There is no reference in the example kernel to AOUT_KLUDGE or MULTIBOOT_AOUT_KLUDGE, so this has never had a function in the Multiboot 2 example kernel. I presume this was something left over from the Multiboot 1 specification

[MULTIBOOT2 SPEC PATCH v4 13/27] multiboot2: Build arch specific boot code

2020-05-14 Thread Hans Ulrich Niedermann
Choose the arch specific bootcode for i386 or mips, depending on what --host is being built for. Before this, boot_i386.S and boot_mips.S were both in the docs, but boot_mips.S was the boot code always built regardless of the actual system being built for. If the --host system is neither i386 (or

[MULTIBOOT2 SPEC PATCH v4 24/27] multiboot2: Generate a kernel.map map file

2020-05-14 Thread Hans Ulrich Niedermann
Generate a kernel.map map file for the example kernel. This helps with examining the generated machine code, making the example kernel more educational. Signed-off-by: Hans Ulrich Niedermann diff --git a/.gitignore b/.gitignore index 7a035c267..889e17f69 100644 --- a/.gitignore +++ b/.gitignore

[MULTIBOOT2 SPEC PATCH v4 06/27] multiboot2: Remove unnecessary definition of CC

2020-05-14 Thread Hans Ulrich Niedermann
Remove the unnecessary separate definition of CC by AC_CHECK_TOOL. AC_CHECK_TOOL(CC, gcc) might have been necessary back in 1999 when this line has been written, but AC_PROG_CC has since taken over defining CC so we do not need AC_CHECK_TOOL for this any more. Signed-off-by: Hans Ulrich Niederman

[MULTIBOOT2 SPEC PATCH v4 09/27] multiboot2: Use the constants by their proper names

2020-05-14 Thread Hans Ulrich Niedermann
In the i386 boot.S file, use the constants with the names multiboot2.h actually defines them as, and which boot_mips.S has been using already. Signed-off-by: Hans Ulrich Niedermann diff --git a/doc/boot.S b/doc/boot.S index 8f6f66fcc..9ab016612 100644 --- a/doc/boot.S +++ b/doc/boot.S @@ -50,11

[MULTIBOOT2 SPEC PATCH v4 11/27] multiboot2: Add boot_i386.S to shipped files

2020-05-14 Thread Hans Ulrich Niedermann
Ship the boot_i386.S file in the dist tarball as well, not just the boot_mips.S file. Signed-off-by: Hans Ulrich Niedermann diff --git a/doc/Makefile.am b/doc/Makefile.am index d9efe8116..e88f4d271 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,5 +1,5 @@ info_TEXINFOS = multiboot.texi

[MULTIBOOT2 SPEC PATCH v4 00/27] multiboot2: Clean up the example kernel

2020-05-14 Thread Hans Ulrich Niedermann
This patch series cleans up the Multiboot2 build system and example kernel: * Fix initializing the source tree with autogen.sh when using current gnulib. * Change from obsolete .bzrignore to .gitignore. * Fix the Multiboot2 header tag alignment in the assembly language boot_*.S fil

[MULTIBOOT2 SPEC PATCH v4 08/27] multiboot2: Automake cleans built programs automatically

2020-05-14 Thread Hans Ulrich Niedermann
The "CLEANFILES = $(noinst_PROGRAMS)" definition is from 2001-01, and Automake has learned to clean up generated files automatically since, so we can remove this. Signed-off-by: Hans Ulrich Niedermann diff --git a/doc/Makefile.am b/doc/Makefile.am index a65b452cf..dc7816d9f 100644 --- a/doc/Make

[MULTIBOOT2 SPEC PATCH v4 04/27] multiboot2: Remove obsolete compat code for ancient Autoconf

2020-05-14 Thread Hans Ulrich Niedermann
The remark about "older versions of Autoconf" was added in 2001. We already AC_PREREQ(2.63) which is from 2008, so we need not worry about pre-2008 versions of Autoconf, much less about pre-2001 versions. Signed-off-by: Hans Ulrich Niedermann diff --git a/configure.ac b/configure.ac index 5bfc0

[MULTIBOOT2 SPEC PATCH v4 16/27] multiboot2: Change "Multiboot" in comments to "Multiboot2"

2020-05-14 Thread Hans Ulrich Niedermann
In source code comments, change "Multiboot" to "Multiboot2". This forced us to touch the completely wrongly placed comment on the 'flags' in multiboot2.h, so we have moved that comment where it belongs and added comments for the groups of macro definitions which now had no comments at all. Signed

[MULTIBOOT2 SPEC PATCH v4 03/27] multiboot2: Use m4 quoting and AS_HELP_STRING

2020-05-14 Thread Hans Ulrich Niedermann
Use proper m4 quoting throughout configure.ac and use AS_HELP_STRING for the --enable-example-kernel argument. Signed-off-by: Hans Ulrich Niedermann diff --git a/configure.ac b/configure.ac index 8f21b1852..5bfc0ee5b 100644 --- a/configure.ac +++ b/configure.ac @@ -12,7 +12,7 @@ dnl "AS IS" COND

[MULTIBOOT2 SPEC PATCH v4 05/27] multiboot2: Remove CCAS workarounds for pre-2005 Automake

2020-05-14 Thread Hans Ulrich Niedermann
The "recent automake" remark is from 2001, and the AM_PROG_AS issues with CCAS and CCASFLAGS appear to have been solved in the first half of the 2000s. Just to make sure, require Automake 1.10.1 which was tagged on 2008-08-19 which is a similar vintage as the Autoconf 2.63 version which we already

[MULTIBOOT2 SPEC PATCH v4 07/27] multiboot2: Automake generates dependencies automatically

2020-05-14 Thread Hans Ulrich Niedermann
Remove manual dependency line for boot.o. This line was written in 2001-01. Some time after that, Automake has gained the capability of automatically tracking source code dependencies. Also, the actual object file Automake builds would be called kernel-boot.o, so a dependency rule for boot.o is u

[MULTIBOOT2 SPEC PATCH v4 02/27] multiboot2: Use .gitignore files

2020-05-14 Thread Hans Ulrich Niedermann
Add .gitignore file and remove the obsolete .bzrignore file. As gnulib-tool (called from autogen.sh) insists on creating doc/.gitignore (if it does not exist) or updating it (if it is missing some patterns gnulib-tool wants ignored by git), we add a doc/.gitignore file and the gnulib patterns ther

[MULTIBOOT2 SPEC PATCH v4 01/27] multiboot2: Allow autogen.sh to run with current gnulib

2020-05-14 Thread Hans Ulrich Niedermann
Current gnulib's gnulib-tool (which is called by autogen.sh) only runs if configure.ac contains at least AC_PREREQ(2.63). Requiring Autoconf 2.63 (release tagged in 2008-09) instead of Autoconf 2.59 (release 2.59 tagged in 2003-11, 2.59d in 2006-06) should not affect too many systems in 2020. Si

Re: [PATCH v3 2/5] configure: Set gnu99 C language standard by default

2020-05-14 Thread Daniel Axtens
Hi Daniel, > Commit d5a32255d (misc: Make grub_strtol() "end" pointers have safer > const qualifiers) introduced "restrict" keyword into some functions > definitions. This keyword was introduced in C99 standard. However, some > compilers by default may use C89 or something different. This behavior

Re: [PATCH v3 5/5] autogen: Replace -iname with -ipath in find command

2020-05-14 Thread Daniel Axtens
Daniel Kiper writes: > ..because -iname cannot be used to match paths. > > Signed-off-by: Daniel Kiper > Reviewed-by: Javier Martinez Canillas > --- > autogen.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/autogen.sh b/autogen.sh > index ef43270fc..31b0ced7e 100755

make check / grub_func_test issues

2020-05-14 Thread Daniel Axtens
Hi all, I'm having some trouble with the grub tests run by `make check`. In particular, grub_func_test is failing for me in every configuration I try. I've tried various combinations of: - master, grub-2.04 and grub-2.02 tags, as well as the grub-2.04 tarball. - configuring for platform em