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 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel