All of lore.kernel.org
 help / color / mirror / Atom feed
* [MULTIBOOT2 SPEC PATCH v3 0/4] multiboot2: Clean up the example kernel
@ 2020-05-08  4:50 Hans Ulrich Niedermann
  2020-05-08  4:50 ` [MULTIBOOT2 SPEC PATCH v3 1/4] multiboot2: Allow autogen.sh to run with current gnulib Hans Ulrich Niedermann
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Hans Ulrich Niedermann @ 2020-05-08  4:50 UTC (permalink / raw)
  To: grub-devel; +Cc: Hans Ulrich Niedermann

This cleans up the Multiboot2 example kernel in a few ways:

  * It fixes the build with current gnulib.

  * Change from obsolete .bzrignore to .gitignore.

  * It fixes the build on non-MIPS systems such as x86.

  * It fixes the Multiboot2 header tag alignment in the
    assembly language boot_*.S files to 8 byte boundaries.

  * It fixes the alignment in boot_mips.S to align to 8 byte
    boundaries instead of 256 byte boundaries.

This is v3 of a previous patch set. The differences mainly are

  * improved .gitignore

  * fix the case logic for the ix86 matching pattern ([[]])

  * fix mb2 header tag alignment

  * fix alignment on mips

I am posting this right now to make clear that my previous patch
set version v1/v2 had issues, but this v3 certainly can use some
improvement as well. Also, this is not very urgent, so putting
this off until after the next GRUB release is very reasonable.

Hans Ulrich Niedermann (4):
  multiboot2: Allow autogen.sh to run with current gnulib
  multiboot2: Use .gitignore files
  multiboot2: Make example kernel build at least for i386
  multiboot2: fix example kernel header tag alignment

 .bzrignore                  | 30 -------------------
 .gitignore                  | 51 ++++++++++++++++++++++++++++++++
 configure.ac                | 37 +++++++++++++++++++----
 doc/.gitignore              |  2 ++
 doc/Makefile.am             |  9 +++---
 doc/{boot.S => boot_i386.S} |  9 ++++--
 doc/boot_mips.S             | 17 +++++++----
 doc/multiboot.texi          | 59 +++++++++++++++++++++++--------------
 8 files changed, 144 insertions(+), 70 deletions(-)
 delete mode 100644 .bzrignore
 create mode 100644 .gitignore
 create mode 100644 doc/.gitignore
 rename doc/{boot.S => boot_i386.S} (93%)

Interdiff:
diff --git a/.gitignore b/.gitignore
index bd387ea77..4de19ceee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-# Generated by autogen.sh
+# Generated by "autogen.sh"
 /gendocs.sh
 /lib/
 /m4/
@@ -6,6 +6,8 @@
 /NEWS
 /README
 
+Makefile.in
+
 /aclocal.m4
 /autom4te.cache/
 /compile
@@ -20,9 +22,7 @@
 /INSTALL
 /missing
 
-Makefile.in
-
-# Generated by configure
+# Generated by "configure"
 Makefile
 .deps/
 
@@ -31,7 +31,7 @@ Makefile
 /config.status
 /stamp-h1
 
-# Generated by make
+# Generated by "make"
 /doc/*.c.texi
 /doc/*.h.texi
 /doc/*.S.texi
@@ -40,4 +40,12 @@ Makefile
 /doc/version.texi
 
 *.o
+
 /doc/kernel
+
+# Generated by "make web-manual"
+/doc/manual/
+/doc/multiboot.aux
+/doc/multiboot.cp
+/doc/multiboot.log
+/doc/multiboot.toc
diff --git a/configure.ac b/configure.ac
index ee648f52a..5ddb16b72 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,17 +34,23 @@ AC_SUBST(CCAS)
 
 dnl Build the example Multiboot kernel (if possible on this host)
 AC_CANONICAL_HOST
-case "$host" in #(
-  i[3456]86-*) kernel_boot_arch=i386
-               ;; #(
-  x86_64-*)    kernel_boot_arch=i386
-               kernel_ccasflags="-m32"
-               kernel_cflags="-m32"
-	       ;; #(
-  mips-*)      kernel_boot_arch=mips
-               ;; #(
-  *)           kernel_boot_arch=unsupported
-               ;;
+kernel_ccasflags=
+kernel_cflags=
+case "$host_cpu" in #(
+  i[[3456]]86)
+    kernel_boot_arch=i386
+    ;; #(
+  x86_64)
+    kernel_boot_arch=i386
+    kernel_ccasflags="-m32"
+    kernel_cflags="-m32"
+    ;; #(
+  mips*)
+    kernel_boot_arch=mips
+    ;; #(
+  *)
+    kernel_boot_arch=unsupported
+    ;;
 esac
 AC_SUBST([kernel_boot_arch])
 AC_SUBST([kernel_ccasflags])
diff --git a/doc/boot_i386.S b/doc/boot_i386.S
index 9ab016612..1418afe1a 100644
--- a/doc/boot_i386.S
+++ b/doc/boot_i386.S
@@ -56,6 +56,7 @@ multiboot_header:
 	/* checksum */
 	.long	-(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT_ARCHITECTURE_I386 + (multiboot_header_end - multiboot_header))
 #ifndef __ELF__
+	.align	8
 address_tag_start:	
 	.short MULTIBOOT_HEADER_TAG_ADDRESS
 	.short MULTIBOOT_HEADER_TAG_OPTIONAL
@@ -69,6 +70,7 @@ address_tag_start:
 	/* bss_end_addr */
 	.long	_end
 address_tag_end:
+	.align	8
 entry_address_tag_start:	
 	.short MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS
 	.short MULTIBOOT_HEADER_TAG_OPTIONAL
@@ -77,6 +79,7 @@ entry_address_tag_start:
 	.long multiboot_entry
 entry_address_tag_end:
 #endif /* __ELF__ */
+	.align	8
 framebuffer_tag_start:	
 	.short MULTIBOOT_HEADER_TAG_FRAMEBUFFER
 	.short MULTIBOOT_HEADER_TAG_OPTIONAL
@@ -85,10 +88,12 @@ framebuffer_tag_start:
 	.long 768
 	.long 32
 framebuffer_tag_end:
+	.align	8
 	.short MULTIBOOT_HEADER_TAG_END
 	.short 0
 	.long 8
 multiboot_header_end:
+
 multiboot_entry:
 	/* Initialize the stack pointer.  */
 	movl	$(stack + STACK_SIZE), %esp
diff --git a/doc/boot_mips.S b/doc/boot_mips.S
index ed604214d..e7bb7df9f 100644
--- a/doc/boot_mips.S
+++ b/doc/boot_mips.S
@@ -46,8 +46,8 @@ _start:
 	 nop
 
 	/* Align 64 bits boundary.  */
-	.align	8
-	
+	.balign	8
+
 	/* Multiboot header.  */
 multiboot_header:
 	/* magic */
@@ -59,7 +59,8 @@ multiboot_header:
 	/* checksum */
 	.long	-(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT_ARCHITECTURE_MIPS32 + (multiboot_header_end - multiboot_header))
 #ifndef __ELF__
-address_tag_start:	
+	.balign	8
+address_tag_start:
 	.short MULTIBOOT_HEADER_TAG_ADDRESS
 	.short MULTIBOOT_HEADER_TAG_OPTIONAL
 	.long address_tag_end - address_tag_start
@@ -72,7 +73,8 @@ address_tag_start:
 	/* bss_end_addr */
 	.long	_end
 address_tag_end:
-entry_address_tag_start:	
+	.balign	8
+entry_address_tag_start:
 	.short MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS
 	.short MULTIBOOT_HEADER_TAG_OPTIONAL
 	.long entry_address_tag_end - entry_address_tag_start
@@ -80,7 +82,8 @@ entry_address_tag_start:
 	.long multiboot_entry
 entry_address_tag_end:
 #endif /* __ELF__ */
-framebuffer_tag_start:	
+	.balign	8
+framebuffer_tag_start:
 	.short MULTIBOOT_HEADER_TAG_FRAMEBUFFER
 	.short MULTIBOOT_HEADER_TAG_OPTIONAL
 	.long framebuffer_tag_end - framebuffer_tag_start
@@ -88,10 +91,12 @@ framebuffer_tag_start:
 	.long 768
 	.long 32
 framebuffer_tag_end:
+	.balign	8
 	.short MULTIBOOT_HEADER_TAG_END
 	.short 0
 	.long 8
 multiboot_header_end:
+
 multiboot_entry:
 	/* Initialize the stack pointer.  */
 	lui     $sp, %hi (stack + STACK_SIZE)
@@ -114,6 +119,6 @@ loop:	nop
 halt_message:
 	.asciz	"Halted."
 
-	.align 8
+	.balign 8
 	/* Our stack area.  */
 	.comm	stack, STACK_SIZE
diff --git a/doc/multiboot.texi b/doc/multiboot.texi
index c70d9239e..827a5c08d 100644
--- a/doc/multiboot.texi
+++ b/doc/multiboot.texi
@@ -1566,12 +1566,12 @@ executes @file{boot_*.S}, it initializes the stack pointer and
 
 If @code{cmain} returns to the callee, then it shows a message to
 inform the user of the halt state and stops forever until you push the
-reset key. The file @file{kernel.c} contains the function
+system reset button. The file @file{kernel.c} contains the function
 @code{cmain}, which checks if the magic number passed by the boot
 loader is valid and so on, and some functions to print messages on the
-screen. The file @file{multiboot2.h} defines some macros, such as the
-magic number for the Multiboot2 header, the Multiboot2 header
-structure and the Multiboot2 information structure.
+screen. The file @file{multiboot2.h} defines some C preprocessor
+macros, such as the magic number for the Multiboot2 header, the
+Multiboot2 header structure and the Multiboot2 information structure.
 
 @menu
 * multiboot2.h::
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [MULTIBOOT2 SPEC PATCH v3 1/4] multiboot2: Allow autogen.sh to run with current gnulib
  2020-05-08  4:50 [MULTIBOOT2 SPEC PATCH v3 0/4] multiboot2: Clean up the example kernel Hans Ulrich Niedermann
@ 2020-05-08  4:50 ` Hans Ulrich Niedermann
  2020-05-13 16:10   ` Daniel Kiper
  2020-05-08  4:50 ` [MULTIBOOT2 SPEC PATCH v3 2/4] multiboot2: Use .gitignore files Hans Ulrich Niedermann
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Hans Ulrich Niedermann @ 2020-05-08  4:50 UTC (permalink / raw)
  To: grub-devel; +Cc: 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.

Signed-off-by: Hans Ulrich Niedermann <hun@n-dimensional.de>

diff --git a/configure.ac b/configure.ac
index 585b37a36..8f21b1852 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,7 +12,7 @@ dnl "AS IS" CONDITION.  THE FREE SOFTWARE FOUNDATION DISCLAIMS ANY
 dnl LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
 dnl USE OF THIS SOFTWARE.
 
-AC_PREREQ(2.59)
+AC_PREREQ(2.63)
 AC_INIT([Multiboot], [2.0], [bug-grub@gnu.org])
 AC_CONFIG_SRCDIR([doc/multiboot.texi])
 AC_CONFIG_HEADER([config.h])
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [MULTIBOOT2 SPEC PATCH v3 2/4] multiboot2: Use .gitignore files
  2020-05-08  4:50 [MULTIBOOT2 SPEC PATCH v3 0/4] multiboot2: Clean up the example kernel Hans Ulrich Niedermann
  2020-05-08  4:50 ` [MULTIBOOT2 SPEC PATCH v3 1/4] multiboot2: Allow autogen.sh to run with current gnulib Hans Ulrich Niedermann
@ 2020-05-08  4:50 ` Hans Ulrich Niedermann
  2020-05-13 16:21   ` Daniel Kiper
  2020-05-08  4:50 ` [MULTIBOOT2 SPEC PATCH v3 3/4] multiboot2: Make example kernel build at least for i386 Hans Ulrich Niedermann
  2020-05-08  4:50 ` [MULTIBOOT2 SPEC PATCH v3 4/4] multiboot2: fix example kernel header tag alignment Hans Ulrich Niedermann
  3 siblings, 1 reply; 13+ messages in thread
From: Hans Ulrich Niedermann @ 2020-05-08  4:50 UTC (permalink / raw)
  To: grub-devel; +Cc: Hans Ulrich Niedermann

Add .gitignore file and remove the obsolete .bzrignore file.

The doc/.gitignore file is generated by gnulib-tool so we keep
that file in addition to the top-level .gitignore file which
covers everything else in the subdirectory tree.

Signed-off-by: Hans Ulrich Niedermann <hun@n-dimensional.de>

 delete mode 100644 .bzrignore
 create mode 100644 .gitignore
 create mode 100644 doc/.gitignore

diff --git a/.bzrignore b/.bzrignore
deleted file mode 100644
index fda459816..000000000
--- a/.bzrignore
+++ /dev/null
@@ -1,30 +0,0 @@
-gendocs.sh
-lib
-m4
-.deps
-Makefile
-autom4te.cache
-config.cache
-config.h
-config.log
-config.status
-stamp-h
-stamp-h1
-doc/Makefile
-doc/*.info*
-doc/.deps
-doc/gendocs_template
-doc/mdate-sh
-doc/Makefile.in
-doc/boot.S.texi
-doc/kernel
-doc/kernel.c.texi
-doc/multiboot.h.texi
-doc/texinfo.tex
-Makefile.in
-aclocal.m4
-config.h.in
-configure
-depcomp
-install-sh
-missing
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..01823be9c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,49 @@
+# Generated by "autogen.sh"
+/gendocs.sh
+/lib/
+/m4/
+
+/NEWS
+/README
+
+Makefile.in
+
+/aclocal.m4
+/autom4te.cache/
+/compile
+/config.h.in
+/configure
+/depcomp
+/doc/mdate-sh
+/doc/texinfo.tex
+/install-sh
+/INSTALL
+/missing
+
+# Generated by "configure"
+Makefile
+.deps/
+
+/config.h
+/config.log
+/config.status
+/stamp-h1
+
+# Generated by "make"
+/doc/*.c.texi
+/doc/*.h.texi
+/doc/*.S.texi
+/doc/multiboot.info*
+/doc/stamp-vti
+/doc/version.texi
+
+*.o
+
+/doc/kernel
+
+# Generated by "make web-manual"
+/doc/manual/
+/doc/multiboot.aux
+/doc/multiboot.cp
+/doc/multiboot.log
+/doc/multiboot.toc
diff --git a/doc/.gitignore b/doc/.gitignore
new file mode 100644
index 000000000..847f66f4d
--- /dev/null
+++ b/doc/.gitignore
@@ -0,0 +1,2 @@
+/gendocs_template
+/gendocs_template_min
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [MULTIBOOT2 SPEC PATCH v3 3/4] multiboot2: Make example kernel build at least for i386
  2020-05-08  4:50 [MULTIBOOT2 SPEC PATCH v3 0/4] multiboot2: Clean up the example kernel Hans Ulrich Niedermann
  2020-05-08  4:50 ` [MULTIBOOT2 SPEC PATCH v3 1/4] multiboot2: Allow autogen.sh to run with current gnulib Hans Ulrich Niedermann
  2020-05-08  4:50 ` [MULTIBOOT2 SPEC PATCH v3 2/4] multiboot2: Use .gitignore files Hans Ulrich Niedermann
@ 2020-05-08  4:50 ` Hans Ulrich Niedermann
  2020-05-13 16:24   ` Daniel Kiper
  2020-05-08  4:50 ` [MULTIBOOT2 SPEC PATCH v3 4/4] multiboot2: fix example kernel header tag alignment Hans Ulrich Niedermann
  3 siblings, 1 reply; 13+ messages in thread
From: Hans Ulrich Niedermann @ 2020-05-08  4:50 UTC (permalink / raw)
  To: grub-devel; +Cc: Hans Ulrich Niedermann

The example kernel has assembly language boot code for both
i386 and mips, but the mips assembly code used to be built
unconditionally, even if the build is using non-mips build
tools such as for x86_64 or i386.

This makes the example kernel build at least for i386, both
on i386 and on x86_64 hosts.

  * renames the i386 boot code from boot.S to boot_i386.S
    to go along with the mips boot code in boot_mips.S

  * adds AC_CANONICAL_HOST to select the proper boot code:

      * i386 if building on x86_64 (adds -m32) or on i[3456]86
      * mips if building for mips*
      * do not build the kernel if building for another system

  * adds m4 quoting and uses AS_HELP_STRING use in configure.ac

  * fixes the name of the constants used in boot_i386.S
    to use the actual constant names from multiboot2.h

  * documents both boot_i386.S and boot_mips.S in the
    multiboot.texi page

Building the example kernel for mips still needs some work, as
I have not managed to build for mips yet with either my
mips64-linux-gnu cross-compilation toolchain on Fedora 32 or
on my Debian 10.3 MIPS install running in qemu-system-mips.

Signed-off-by: Hans Ulrich Niedermann <hun@n-dimensional.de>

 rename doc/{boot.S => boot_i386.S} (94%)

diff --git a/.gitignore b/.gitignore
index 01823be9c..4de19ceee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,7 +11,9 @@ Makefile.in
 /aclocal.m4
 /autom4te.cache/
 /compile
+/config.guess
 /config.h.in
+/config.sub
 /configure
 /depcomp
 /doc/mdate-sh
diff --git a/configure.ac b/configure.ac
index 8f21b1852..5ddb16b72 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,11 +32,36 @@ dnl Because recent automake complains about AS, set it here.
 CCAS="$CC"
 AC_SUBST(CCAS)
 
-dnl Build the example Multiboot kernel.
-AC_ARG_ENABLE(example-kernel,
-  [  --enable-example-kernel
-                          build the example Multiboot kernel])
-AM_CONDITIONAL(BUILD_EXAMPLE_KERNEL, test "x$enable_example_kernel" = xyes)
+dnl Build the example Multiboot kernel (if possible on this host)
+AC_CANONICAL_HOST
+kernel_ccasflags=
+kernel_cflags=
+case "$host_cpu" in #(
+  i[[3456]]86)
+    kernel_boot_arch=i386
+    ;; #(
+  x86_64)
+    kernel_boot_arch=i386
+    kernel_ccasflags="-m32"
+    kernel_cflags="-m32"
+    ;; #(
+  mips*)
+    kernel_boot_arch=mips
+    ;; #(
+  *)
+    kernel_boot_arch=unsupported
+    ;;
+esac
+AC_SUBST([kernel_boot_arch])
+AC_SUBST([kernel_ccasflags])
+AC_SUBST([kernel_cflags])
+
+AC_ARG_ENABLE([example-kernel], [dnl
+AS_HELP_STRING([--enable-example-kernel],
+               [build the example Multiboot2 kernel])])
+
+AM_CONDITIONAL([BUILD_EXAMPLE_KERNEL],
+               [test "x$enable_example_kernel" = xyes && test "x$kernel_boot_arch" != "xunsupported"])
 
 dnl Because recent automake complains about CCASFLAGS, set it here.
 CCASFLAGS='$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)'
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 2a5afd95d..0d896fe10 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,6 +1,6 @@
 info_TEXINFOS = multiboot.texi
-EXAMPLES = boot_mips.S kernel.c multiboot2.h
-multiboot_TEXINFOS = boot.S.texi kernel.c.texi multiboot2.h.texi
+EXAMPLES = boot_i386.S boot_mips.S kernel.c multiboot2.h
+multiboot_TEXINFOS = boot_i386.S.texi boot_mips.S.texi kernel.c.texi multiboot2.h.texi
 SRC2TEXI = src2texi
 noinst_SCRIPTS = $(SRC2TEXI)
 EXTRA_PROGRAMS = kernel
@@ -9,8 +9,9 @@ pkginclude_HEADERS = multiboot2.h
 # The example kernel is built if you specify --enable-example-kernel.
 if BUILD_EXAMPLE_KERNEL
 noinst_PROGRAMS = kernel
-kernel_SOURCES = $(EXAMPLES)
-kernel_CFLAGS = -fno-builtin -nostdinc -O -g -Wall \
+kernel_SOURCES = boot_$(kernel_boot_arch).S kernel.c multiboot2.h
+kernel_CCASFLAGS = $(kernel_ccasflags)
+kernel_CFLAGS = $(kernel_cflags) -fno-builtin -nostdinc -O -g -Wall \
 	-imacros $(top_builddir)/config.h
 kernel_LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,80100000 -Wl,--build-id=none
 
diff --git a/doc/boot.S b/doc/boot_i386.S
similarity index 94%
rename from doc/boot.S
rename to doc/boot_i386.S
index 8f6f66fcc..9ab016612 100644
--- a/doc/boot.S
+++ b/doc/boot_i386.S
@@ -50,11 +50,11 @@ multiboot_header:
 	/* magic */
 	.long	MULTIBOOT2_HEADER_MAGIC
 	/* ISA: i386 */
-	.long   GRUB_MULTIBOOT_ARCHITECTURE_I386
+	.long   MULTIBOOT_ARCHITECTURE_I386
 	/* Header length.  */
 	.long	multiboot_header_end - multiboot_header
 	/* checksum */
-	.long	-(MULTIBOOT2_HEADER_MAGIC + GRUB_MULTIBOOT_ARCHITECTURE_I386 + (multiboot_header_end - multiboot_header))
+	.long	-(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT_ARCHITECTURE_I386 + (multiboot_header_end - multiboot_header))
 #ifndef __ELF__
 address_tag_start:	
 	.short MULTIBOOT_HEADER_TAG_ADDRESS
diff --git a/doc/multiboot.texi b/doc/multiboot.texi
index df8a0d056..827a5c08d 100644
--- a/doc/multiboot.texi
+++ b/doc/multiboot.texi
@@ -1553,26 +1553,31 @@ Multiboot2-compliant boot loader and for reference to how to implement a
 Multiboot2 kernel. The source files can be found under the directory
 @file{doc} in the Multiboot2 source distribution.
 
-The kernel @file{kernel} consists of only three files: @file{boot.S},
-@file{kernel.c} and @file{multiboot2.h}. The assembly source
-@file{boot.S} is written in GAS (@pxref{Top, , GNU assembler, as.info,
-The GNU assembler}), and contains the Multiboot2 information structure to
-comply with the specification. When a Multiboot2-compliant boot loader
-loads and execute it, it initialize the stack pointer and @code{EFLAGS},
-and then call the function @code{cmain} defined in @file{kernel.c}. If
-@code{cmain} returns to the callee, then it shows a message to inform
-the user of the halt state and stops forever until you push the reset
-key. The file @file{kernel.c} contains the function @code{cmain},
-which checks if the magic number passed by the boot loader is valid and
-so on, and some functions to print messages on the screen. The file
-@file{multiboot2.h} defines some macros, such as the magic number for the
-Multiboot2 header, the Multiboot2 header structure and the Multiboot2
-information structure.
+The kernel @file{kernel} consists of only three files:
+@file{boot_i386.S} or @file{boot_mips.S} (depending on the kernel
+architecture), @file{kernel.c}, and @file{multiboot2.h}. The assembly
+sources @file{boot_i386.S} and @file{boot_mips.S} are written in GAS
+(@pxref{Top, , GNU assembler, as.info, The GNU assembler}) and
+contain the Multiboot2 information structure to comply with the
+specification. When a Multiboot2-compliant boot loader loads and
+executes @file{boot_*.S}, it initializes the stack pointer and
+@code{EFLAGS}, and then calls the function @code{cmain} defined in
+@file{kernel.c}.
+
+If @code{cmain} returns to the callee, then it shows a message to
+inform the user of the halt state and stops forever until you push the
+system reset button. The file @file{kernel.c} contains the function
+@code{cmain}, which checks if the magic number passed by the boot
+loader is valid and so on, and some functions to print messages on the
+screen. The file @file{multiboot2.h} defines some C preprocessor
+macros, such as the magic number for the Multiboot2 header, the
+Multiboot2 header structure and the Multiboot2 information structure.
 
 @menu
-* multiboot2.h::                 
-* boot.S::                      
-* kernel.c::                    
+* multiboot2.h::
+* boot_i386.S::
+* boot_mips.S::
+* kernel.c::
 * Other Multiboot2 kernels::
 @end menu
 
@@ -1587,13 +1592,23 @@ This is the source code in the file @file{multiboot2.h}:
 @end example
 
 
-@node boot.S
-@subsection boot.S
+@node boot_i386.S
+@subsection boot_i386.S
+
+In the file @file{boot_i386.S}:
+
+@example
+@include boot_i386.S.texi
+@end example
+
+
+@node boot_mips.S
+@subsection boot_mips.S
 
-In the file @file{boot.S}:
+In the file @file{boot_mips.S}:
 
 @example
-@include boot.S.texi
+@include boot_mips.S.texi
 @end example
 
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [MULTIBOOT2 SPEC PATCH v3 4/4] multiboot2: fix example kernel header tag alignment
  2020-05-08  4:50 [MULTIBOOT2 SPEC PATCH v3 0/4] multiboot2: Clean up the example kernel Hans Ulrich Niedermann
                   ` (2 preceding siblings ...)
  2020-05-08  4:50 ` [MULTIBOOT2 SPEC PATCH v3 3/4] multiboot2: Make example kernel build at least for i386 Hans Ulrich Niedermann
@ 2020-05-08  4:50 ` Hans Ulrich Niedermann
  2020-05-13 16:34   ` Daniel Kiper
  3 siblings, 1 reply; 13+ messages in thread
From: Hans Ulrich Niedermann @ 2020-05-08  4:50 UTC (permalink / raw)
  To: grub-devel; +Cc: 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" aligns to a 256 byte boundary!

Therefore, this changes boot_mips.S to use ".balign 8"
where it had mistakenly used ".align 8" before.

The boot_i386.S file keeps using ".align 8".

Note also that the Multiboot2 header termination tag
(unfortunately unlabeled in the source) actually needs
that extra alignment to an 8 byte boundary, as the
preceding tag (framebuffer_tag_start) is 20 bytes long
which is not a multiple of 8.

You can add "-Wa,-adhlns=$(@:.o=.lst)" to kernel_CCASFLAGS
to generate a listing file which shows the offsets of the
labels in the boot_*.S files to verify the alignment issues.

Note also that the "grub-file --is-x86-multiboot2" utility
does not recognize the wrong alignment of the Multiboot2
header tags, as it only considers the beginning of the
Multiboot2 header and completely ignores the Multiboot2
header tags.

Signed-off-by: Hans Ulrich Niedermann <hun@n-dimensional.de>

diff --git a/doc/boot_i386.S b/doc/boot_i386.S
index 9ab016612..1418afe1a 100644
--- a/doc/boot_i386.S
+++ b/doc/boot_i386.S
@@ -56,6 +56,7 @@ multiboot_header:
 	/* checksum */
 	.long	-(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT_ARCHITECTURE_I386 + (multiboot_header_end - multiboot_header))
 #ifndef __ELF__
+	.align	8
 address_tag_start:	
 	.short MULTIBOOT_HEADER_TAG_ADDRESS
 	.short MULTIBOOT_HEADER_TAG_OPTIONAL
@@ -69,6 +70,7 @@ address_tag_start:
 	/* bss_end_addr */
 	.long	_end
 address_tag_end:
+	.align	8
 entry_address_tag_start:	
 	.short MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS
 	.short MULTIBOOT_HEADER_TAG_OPTIONAL
@@ -77,6 +79,7 @@ entry_address_tag_start:
 	.long multiboot_entry
 entry_address_tag_end:
 #endif /* __ELF__ */
+	.align	8
 framebuffer_tag_start:	
 	.short MULTIBOOT_HEADER_TAG_FRAMEBUFFER
 	.short MULTIBOOT_HEADER_TAG_OPTIONAL
@@ -85,10 +88,12 @@ framebuffer_tag_start:
 	.long 768
 	.long 32
 framebuffer_tag_end:
+	.align	8
 	.short MULTIBOOT_HEADER_TAG_END
 	.short 0
 	.long 8
 multiboot_header_end:
+
 multiboot_entry:
 	/* Initialize the stack pointer.  */
 	movl	$(stack + STACK_SIZE), %esp
diff --git a/doc/boot_mips.S b/doc/boot_mips.S
index ed604214d..e7bb7df9f 100644
--- a/doc/boot_mips.S
+++ b/doc/boot_mips.S
@@ -46,8 +46,8 @@ _start:
 	 nop
 
 	/* Align 64 bits boundary.  */
-	.align	8
-	
+	.balign	8
+
 	/* Multiboot header.  */
 multiboot_header:
 	/* magic */
@@ -59,7 +59,8 @@ multiboot_header:
 	/* checksum */
 	.long	-(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT_ARCHITECTURE_MIPS32 + (multiboot_header_end - multiboot_header))
 #ifndef __ELF__
-address_tag_start:	
+	.balign	8
+address_tag_start:
 	.short MULTIBOOT_HEADER_TAG_ADDRESS
 	.short MULTIBOOT_HEADER_TAG_OPTIONAL
 	.long address_tag_end - address_tag_start
@@ -72,7 +73,8 @@ address_tag_start:
 	/* bss_end_addr */
 	.long	_end
 address_tag_end:
-entry_address_tag_start:	
+	.balign	8
+entry_address_tag_start:
 	.short MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS
 	.short MULTIBOOT_HEADER_TAG_OPTIONAL
 	.long entry_address_tag_end - entry_address_tag_start
@@ -80,7 +82,8 @@ entry_address_tag_start:
 	.long multiboot_entry
 entry_address_tag_end:
 #endif /* __ELF__ */
-framebuffer_tag_start:	
+	.balign	8
+framebuffer_tag_start:
 	.short MULTIBOOT_HEADER_TAG_FRAMEBUFFER
 	.short MULTIBOOT_HEADER_TAG_OPTIONAL
 	.long framebuffer_tag_end - framebuffer_tag_start
@@ -88,10 +91,12 @@ framebuffer_tag_start:
 	.long 768
 	.long 32
 framebuffer_tag_end:
+	.balign	8
 	.short MULTIBOOT_HEADER_TAG_END
 	.short 0
 	.long 8
 multiboot_header_end:
+
 multiboot_entry:
 	/* Initialize the stack pointer.  */
 	lui     $sp, %hi (stack + STACK_SIZE)
@@ -114,6 +119,6 @@ loop:	nop
 halt_message:
 	.asciz	"Halted."
 
-	.align 8
+	.balign 8
 	/* Our stack area.  */
 	.comm	stack, STACK_SIZE
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [MULTIBOOT2 SPEC PATCH v3 1/4] multiboot2: Allow autogen.sh to run with current gnulib
  2020-05-08  4:50 ` [MULTIBOOT2 SPEC PATCH v3 1/4] multiboot2: Allow autogen.sh to run with current gnulib Hans Ulrich Niedermann
@ 2020-05-13 16:10   ` Daniel Kiper
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Kiper @ 2020-05-13 16:10 UTC (permalink / raw)
  To: Hans Ulrich Niedermann; +Cc: grub-devel

On Fri, May 08, 2020 at 06:50:46AM +0200, Hans Ulrich Niedermann wrote:
> 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.
>
> Signed-off-by: Hans Ulrich Niedermann <hun@n-dimensional.de>

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [MULTIBOOT2 SPEC PATCH v3 2/4] multiboot2: Use .gitignore files
  2020-05-08  4:50 ` [MULTIBOOT2 SPEC PATCH v3 2/4] multiboot2: Use .gitignore files Hans Ulrich Niedermann
@ 2020-05-13 16:21   ` Daniel Kiper
  2020-05-13 20:55     ` Hans Ulrich Niedermann
  2020-05-13 21:11     ` Hans Ulrich Niedermann
  0 siblings, 2 replies; 13+ messages in thread
From: Daniel Kiper @ 2020-05-13 16:21 UTC (permalink / raw)
  To: Hans Ulrich Niedermann; +Cc: grub-devel

On Fri, May 08, 2020 at 06:50:47AM +0200, Hans Ulrich Niedermann wrote:
> Add .gitignore file and remove the obsolete .bzrignore file.
>
> The doc/.gitignore file is generated by gnulib-tool so we keep
> that file in addition to the top-level .gitignore file which
> covers everything else in the subdirectory tree.

If it is generated by gnulib-tool why do we need to create it?

> Signed-off-by: Hans Ulrich Niedermann <hun@n-dimensional.de>
>
>  delete mode 100644 .bzrignore
>  create mode 100644 .gitignore
>  create mode 100644 doc/.gitignore
>
> diff --git a/.bzrignore b/.bzrignore
> deleted file mode 100644
> index fda459816..000000000
> --- a/.bzrignore
> +++ /dev/null
> @@ -1,30 +0,0 @@
> -gendocs.sh
> -lib
> -m4
> -.deps
> -Makefile
> -autom4te.cache
> -config.cache
> -config.h
> -config.log
> -config.status
> -stamp-h
> -stamp-h1
> -doc/Makefile
> -doc/*.info*
> -doc/.deps
> -doc/gendocs_template
> -doc/mdate-sh
> -doc/Makefile.in
> -doc/boot.S.texi
> -doc/kernel
> -doc/kernel.c.texi
> -doc/multiboot.h.texi
> -doc/texinfo.tex
> -Makefile.in
> -aclocal.m4
> -config.h.in
> -configure
> -depcomp
> -install-sh
> -missing
> diff --git a/.gitignore b/.gitignore
> new file mode 100644
> index 000000000..01823be9c
> --- /dev/null
> +++ b/.gitignore
> @@ -0,0 +1,49 @@
> +# Generated by "autogen.sh"
> +/gendocs.sh
> +/lib/
> +/m4/
> +
> +/NEWS
> +/README
> +
> +Makefile.in
> +
> +/aclocal.m4
> +/autom4te.cache/
> +/compile
> +/config.h.in
> +/configure
> +/depcomp
> +/doc/mdate-sh
> +/doc/texinfo.tex
> +/install-sh
> +/INSTALL
> +/missing
> +
> +# Generated by "configure"
> +Makefile
> +.deps/

Slash, "/", prefix?

> +
> +/config.h
> +/config.log
> +/config.status
> +/stamp-h1
> +
> +# Generated by "make"
> +/doc/*.c.texi
> +/doc/*.h.texi
> +/doc/*.S.texi
> +/doc/multiboot.info*
> +/doc/stamp-vti
> +/doc/version.texi
> +
> +*.o

Could you be more consistent and list prefixed and not prefixed variants
in the same order in each section?

Daniel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [MULTIBOOT2 SPEC PATCH v3 3/4] multiboot2: Make example kernel build at least for i386
  2020-05-08  4:50 ` [MULTIBOOT2 SPEC PATCH v3 3/4] multiboot2: Make example kernel build at least for i386 Hans Ulrich Niedermann
@ 2020-05-13 16:24   ` Daniel Kiper
  2020-05-14  5:26     ` Hans Ulrich Niedermann
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Kiper @ 2020-05-13 16:24 UTC (permalink / raw)
  To: Hans Ulrich Niedermann; +Cc: grub-devel

On Fri, May 08, 2020 at 06:50:48AM +0200, Hans Ulrich Niedermann wrote:
> The example kernel has assembly language boot code for both
> i386 and mips, but the mips assembly code used to be built
> unconditionally, even if the build is using non-mips build
> tools such as for x86_64 or i386.
>
> This makes the example kernel build at least for i386, both
> on i386 and on x86_64 hosts.
>
>   * renames the i386 boot code from boot.S to boot_i386.S
>     to go along with the mips boot code in boot_mips.S
>
>   * adds AC_CANONICAL_HOST to select the proper boot code:
>
>       * i386 if building on x86_64 (adds -m32) or on i[3456]86
>       * mips if building for mips*
>       * do not build the kernel if building for another system
>
>   * adds m4 quoting and uses AS_HELP_STRING use in configure.ac
>
>   * fixes the name of the constants used in boot_i386.S
>     to use the actual constant names from multiboot2.h
>
>   * documents both boot_i386.S and boot_mips.S in the
>     multiboot.texi page

May I ask you to split this patch into logical parts?

> Building the example kernel for mips still needs some work, as
> I have not managed to build for mips yet with either my
> mips64-linux-gnu cross-compilation toolchain on Fedora 32 or
> on my Debian 10.3 MIPS install running in qemu-system-mips.

This is not big deal. We can fix it later.

Daniel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [MULTIBOOT2 SPEC PATCH v3 4/4] multiboot2: fix example kernel header tag alignment
  2020-05-08  4:50 ` [MULTIBOOT2 SPEC PATCH v3 4/4] multiboot2: fix example kernel header tag alignment Hans Ulrich Niedermann
@ 2020-05-13 16:34   ` Daniel Kiper
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Kiper @ 2020-05-13 16:34 UTC (permalink / raw)
  To: Hans Ulrich Niedermann; +Cc: grub-devel

On Fri, May 08, 2020 at 06:50:49AM +0200, Hans Ulrich Niedermann wrote:
> 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" aligns to a 256 byte boundary!
>
> Therefore, this changes boot_mips.S to use ".balign 8"
> where it had mistakenly used ".align 8" before.
>
> The boot_i386.S file keeps using ".align 8".

I would use ".balign 8" everywhere to avoid confusion.

> Note also that the Multiboot2 header termination tag
> (unfortunately unlabeled in the source) actually needs
> that extra alignment to an 8 byte boundary, as the
> preceding tag (framebuffer_tag_start) is 20 bytes long
> which is not a multiple of 8.
>
> You can add "-Wa,-adhlns=$(@:.o=.lst)" to kernel_CCASFLAGS
> to generate a listing file which shows the offsets of the
> labels in the boot_*.S files to verify the alignment issues.
>
> Note also that the "grub-file --is-x86-multiboot2" utility
> does not recognize the wrong alignment of the Multiboot2
> header tags, as it only considers the beginning of the
> Multiboot2 header and completely ignores the Multiboot2
> header tags.

Please also mention here that you are additionally fixing
some formatting errors.

Daniel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [MULTIBOOT2 SPEC PATCH v3 2/4] multiboot2: Use .gitignore files
  2020-05-13 16:21   ` Daniel Kiper
@ 2020-05-13 20:55     ` Hans Ulrich Niedermann
  2020-05-13 21:11     ` Hans Ulrich Niedermann
  1 sibling, 0 replies; 13+ messages in thread
From: Hans Ulrich Niedermann @ 2020-05-13 20:55 UTC (permalink / raw)
  To: grub-devel

On Wed, 13 May 2020 18:21:11 +0200
Daniel Kiper <dkiper@net-space.pl> wrote:

> On Fri, May 08, 2020 at 06:50:47AM +0200, Hans Ulrich Niedermann
> wrote:

[... lots of gitignore stuff again ... ]

> > +/doc/mdate-sh
> > +/doc/texinfo.tex
> > +/install-sh
> > +/INSTALL
> > +/missing
> > +
> > +# Generated by "configure"
> > +Makefile
> > +.deps/  
> 
> Slash, "/", prefix?

Trailing slash just means "match directory" as opposed to "match file
or directory", so ".deps/" matches every directory named ".deps", while
the ".deps" pattern also matches files called ".deps". I'd rather such
a file showed up in "git status" so such a weird thing would be noticed.

The leading slash to match only relative to the .gitignore file's
directory is only implied with slashes somewhere within the pattern,
e.g. "doc/texinfo.tex" and "/doc/textinfo.tex" have the identical
meaning.

> > +
> > +/config.h
> > +/config.log
> > +/config.status
> > +/stamp-h1
> > +
> > +# Generated by "make"
> > +/doc/*.c.texi
> > +/doc/*.h.texi
> > +/doc/*.S.texi
> > +/doc/multiboot.info*
> > +/doc/stamp-vti
> > +/doc/version.texi
> > +
> > +*.o  
> 
> Could you be more consistent and list prefixed and not prefixed
> variants in the same order in each section?

Good point.

Uli


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [MULTIBOOT2 SPEC PATCH v3 2/4] multiboot2: Use .gitignore files
  2020-05-13 16:21   ` Daniel Kiper
  2020-05-13 20:55     ` Hans Ulrich Niedermann
@ 2020-05-13 21:11     ` Hans Ulrich Niedermann
  2020-05-14  5:49       ` Hans Ulrich Niedermann
  1 sibling, 1 reply; 13+ messages in thread
From: Hans Ulrich Niedermann @ 2020-05-13 21:11 UTC (permalink / raw)
  To: grub-devel

On Wed, 13 May 2020 18:21:11 +0200
Daniel Kiper <dkiper@net-space.pl> wrote:

> On Fri, May 08, 2020 at 06:50:47AM +0200, Hans Ulrich Niedermann
> wrote:
> > Add .gitignore file and remove the obsolete .bzrignore file.
> >
> > The doc/.gitignore file is generated by gnulib-tool so we keep
> > that file in addition to the top-level .gitignore file which
> > covers everything else in the subdirectory tree.  
> 
> If it is generated by gnulib-tool why do we need to create it?

The alternatives to adding doc/.gitignore to the version controlled
files are to either

  a) have the top-level .gitignore file ignore "/doc/.gitignore"

  b) have the gnulib-generated doc/.gitignore file just flying around,
     neither .gitignored like all other generated files, nor under
     version control

Option a) sounds like the beginning of a road into world of very weird
and unexpected things, and option b) defeats the purpose of having any
.gitignore or .bzrignore etc. files at all.

I much prefer ignoring a few patterns which gnulib is considering
useful to be ignored at this time by adding doc/.gitignore. Well, now
that I am thinking about this...

  c) Maybe gnulib would recognize when the top-level .gitignore files
     does the job gnulib would create the doc/.gitignore file for. Then
     we would just have two more patterns in our top-level .gitignore
     file, and gnulib would not create a doc/.gitignore file.

I will have to investigate option c). I would prefer that over my
original option from the patch (adding the doc/.gitignore file as
generated by gnulib).

Uli


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [MULTIBOOT2 SPEC PATCH v3 3/4] multiboot2: Make example kernel build at least for i386
  2020-05-13 16:24   ` Daniel Kiper
@ 2020-05-14  5:26     ` Hans Ulrich Niedermann
  0 siblings, 0 replies; 13+ messages in thread
From: Hans Ulrich Niedermann @ 2020-05-14  5:26 UTC (permalink / raw)
  To: grub-devel

On Wed, 13 May 2020 18:24:28 +0200
Daniel Kiper <dkiper@net-space.pl> wrote:

> On Fri, May 08, 2020 at 06:50:48AM +0200, Hans Ulrich Niedermann
> wrote:
> > The example kernel has assembly language boot code for both
> > i386 and mips, but the mips assembly code used to be built
> > unconditionally, even if the build is using non-mips build
> > tools such as for x86_64 or i386.
> >
> > This makes the example kernel build at least for i386, both
> > on i386 and on x86_64 hosts.
> >
> >   * renames the i386 boot code from boot.S to boot_i386.S
> >     to go along with the mips boot code in boot_mips.S
> >
> >   * adds AC_CANONICAL_HOST to select the proper boot code:
> >
> >       * i386 if building on x86_64 (adds -m32) or on i[3456]86
> >       * mips if building for mips*
> >       * do not build the kernel if building for another system
> >
> >   * adds m4 quoting and uses AS_HELP_STRING use in configure.ac
> >
> >   * fixes the name of the constants used in boot_i386.S
> >     to use the actual constant names from multiboot2.h
> >
> >   * documents both boot_i386.S and boot_mips.S in the
> >     multiboot.texi page  
> 
> May I ask you to split this patch into logical parts?

Being a little slow on the uptake, I only just figured out why I ended
up with that big of a patch.

When given a building and working source tree, I usually make my commits
such that they are small, self-contained and keep the source tree in a
building and working state.

That is why I usually add changes until it finally builds/works.

However, that is a useless argument here, as the state of the source
tree *before* my change is non-building maybe-working, so if the source
tree does not build *after* my small, self-contained change, my change
has not made it worse and can thusly still be considered good.

Changing my normal modus operandi accordingly; considering failing
builds as normal for now.

Expect a good dozen patches in a day or two.

Uli


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [MULTIBOOT2 SPEC PATCH v3 2/4] multiboot2: Use .gitignore files
  2020-05-13 21:11     ` Hans Ulrich Niedermann
@ 2020-05-14  5:49       ` Hans Ulrich Niedermann
  0 siblings, 0 replies; 13+ messages in thread
From: Hans Ulrich Niedermann @ 2020-05-14  5:49 UTC (permalink / raw)
  To: grub-devel

On Wed, 13 May 2020 23:11:03 +0200
Hans Ulrich Niedermann <hun@n-dimensional.de> wrote:

> On Wed, 13 May 2020 18:21:11 +0200
> Daniel Kiper <dkiper@net-space.pl> wrote:
> 
> > On Fri, May 08, 2020 at 06:50:47AM +0200, Hans Ulrich Niedermann
> > wrote:  
> > > Add .gitignore file and remove the obsolete .bzrignore file.
> > >
> > > The doc/.gitignore file is generated by gnulib-tool so we keep
> > > that file in addition to the top-level .gitignore file which
> > > covers everything else in the subdirectory tree.    
> > 
> > If it is generated by gnulib-tool why do we need to create it?  
> 
> The alternatives to adding doc/.gitignore to the version controlled
> files are to either
> 
>   a) have the top-level .gitignore file ignore "/doc/.gitignore"
> 
>   b) have the gnulib-generated doc/.gitignore file just flying around,
>      neither .gitignored like all other generated files, nor under
>      version control
> 
> Option a) sounds like the beginning of a road into world of very weird
> and unexpected things, and option b) defeats the purpose of having any
> .gitignore or .bzrignore etc. files at all.
> 
> I much prefer ignoring a few patterns which gnulib is considering
> useful to be ignored at this time by adding doc/.gitignore. Well, now
> that I am thinking about this...
> 
>   c) Maybe gnulib would recognize when the top-level .gitignore files
>      does the job gnulib would create the doc/.gitignore file for.
> Then we would just have two more patterns in our top-level .gitignore
>      file, and gnulib would not create a doc/.gitignore file.
> 
> I will have to investigate option c). I would prefer that over my
> original option from the patch (adding the doc/.gitignore file as
> generated by gnulib).

No luck here. I have just examined what gnulib-tool does in the presence
of the proper patterns having been added to the top-level .gitignore
file with an absent doc/.gitignore file: gnulib-tool creates a new file
doc/.gitignore to which it adds its patterns.

So option c) is out, option a) and option b) both create unnecessary
friction in the day to day use of git, I am therefore still convinced
the best way to go is to have a top-level .gitignore with our own stuff,
and a doc/.gitignore file with whatever patterns gnulib-tool wants to
put in there together with the scripts it puts into doc/.

Note that gnulib-tool creates a few more subdirectory .gitignore files
in /lib/ and /m4/. We just do not notice those as we .gitignore the
whole subdirectory for those two anyway. The only thing from gnulib we
are interested in are the scripts generating HTML from
doc/multiboot.texi, not m4 macros or C source files.

Uli


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-05-14  5:50 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08  4:50 [MULTIBOOT2 SPEC PATCH v3 0/4] multiboot2: Clean up the example kernel Hans Ulrich Niedermann
2020-05-08  4:50 ` [MULTIBOOT2 SPEC PATCH v3 1/4] multiboot2: Allow autogen.sh to run with current gnulib Hans Ulrich Niedermann
2020-05-13 16:10   ` Daniel Kiper
2020-05-08  4:50 ` [MULTIBOOT2 SPEC PATCH v3 2/4] multiboot2: Use .gitignore files Hans Ulrich Niedermann
2020-05-13 16:21   ` Daniel Kiper
2020-05-13 20:55     ` Hans Ulrich Niedermann
2020-05-13 21:11     ` Hans Ulrich Niedermann
2020-05-14  5:49       ` Hans Ulrich Niedermann
2020-05-08  4:50 ` [MULTIBOOT2 SPEC PATCH v3 3/4] multiboot2: Make example kernel build at least for i386 Hans Ulrich Niedermann
2020-05-13 16:24   ` Daniel Kiper
2020-05-14  5:26     ` Hans Ulrich Niedermann
2020-05-08  4:50 ` [MULTIBOOT2 SPEC PATCH v3 4/4] multiboot2: fix example kernel header tag alignment Hans Ulrich Niedermann
2020-05-13 16:34   ` Daniel Kiper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.