All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: grub-devel@gnu.org
Subject: [PATCH] convert biosdisk into a module
Date: Fri, 19 Oct 2007 22:07:26 +0200	[thread overview]
Message-ID: <20071019200726.GA12105@thorin> (raw)

[-- Attachment #1: Type: text/plain, Size: 458 bytes --]


This patch converts biosdisk into a module.

In the future, maybe we can also move some of the grub_biosdisk_* functions
in kern/i386/pc/startup.S into this module, but it seems the build system
reacts very adversely to modules containing standalone assembly files, so
I fixed one bug (see followup) and gave up.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)

[-- Attachment #2: biosdisk.diff --]
[-- Type: text/x-diff, Size: 4255 bytes --]

2007-10-19  Robert Millan  <rmh@aybabtu.com>

	* conf/i386-pc.rmk (kernel_img_SOURCES): Remove `disk/i386/pc/biosdisk.c'.
	(pkgdata_MODULES): Add `biosdisk.mod'.
	(biosdisk_mod_SOURCES, biosdisk_mod_CFLAGS, biosdisk_mod_LDFLAGS): New
	variables.

	* disk/i386/pc/biosdisk.c: Include `<grub/dl.h>'.
	(grub_biosdisk_init): Replace with ...
	(GRUB_MOD_INIT(biosdisk)): ... this.
	(grub_biosdisk_fini): Replace with ...
	(GRUB_MOD_FINI(biosdisk)): ... this.

	* kern/i386/pc/init.c: Remove `<grub/machine/biosdisk.h>'.
	(grub_machine_init): Remove call to grub_biosdisk_init().
	(grub_machine_fini): Remove call to grub_machine_fini().

	* util/i386/pc/grub-install.in (modules): Add `biosdisk'.

diff -urp grub2/conf/i386-pc.rmk grub2.biosdisk/conf/i386-pc.rmk
--- grub2/conf/i386-pc.rmk	2007-10-01 17:50:34.000000000 +0200
+++ grub2.biosdisk/conf/i386-pc.rmk	2007-10-19 22:00:34.000000000 +0200
@@ -27,7 +27,7 @@ kernel_img_SOURCES = kern/i386/pc/startu
 	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
 	kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \
 	kern/i386/dl.c kern/i386/pc/init.c kern/parser.c kern/partition.c \
-	kern/env.c disk/i386/pc/biosdisk.c \
+	kern/env.c \
 	term/i386/pc/console.c \
 	symlist.c
 kernel_img_HEADERS = arg.h boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
@@ -127,11 +127,16 @@ grub_install_SOURCES = util/i386/pc/grub
 grub_mkrescue_SOURCES = util/i386/pc/grub-mkrescue.in
 
 # Modules.
-pkgdata_MODULES = _chain.mod _linux.mod linux.mod normal.mod \
+pkgdata_MODULES = biosdisk.mod _chain.mod _linux.mod linux.mod normal.mod \
 	_multiboot.mod chain.mod multiboot.mod reboot.mod halt.mod	\
 	vbe.mod vbetest.mod vbeinfo.mod video.mod gfxterm.mod \
 	videotest.mod play.mod bitmap.mod tga.mod cpuid.mod serial.mod
 
+# For biosdisk.mod.
+biosdisk_mod_SOURCES = disk/i386/pc/biosdisk.c
+biosdisk_mod_CFLAGS = $(COMMON_CFLAGS)
+biosdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
 # For _chain.mod.
 _chain_mod_SOURCES = loader/i386/pc/chainloader.c
 _chain_mod_CFLAGS = $(COMMON_CFLAGS)
diff -urp grub2/disk/i386/pc/biosdisk.c grub2.biosdisk/disk/i386/pc/biosdisk.c
--- grub2/disk/i386/pc/biosdisk.c	2007-07-22 01:32:20.000000000 +0200
+++ grub2.biosdisk/disk/i386/pc/biosdisk.c	2007-10-19 22:00:34.000000000 +0200
@@ -19,6 +19,7 @@
 #include <grub/machine/biosdisk.h>
 #include <grub/machine/memory.h>
 #include <grub/disk.h>
+#include <grub/dl.h>
 #include <grub/mm.h>
 #include <grub/types.h>
 #include <grub/misc.h>
@@ -311,14 +312,12 @@ static struct grub_disk_dev grub_biosdis
     .next = 0
   };
 
-void
-grub_biosdisk_init (void)
+GRUB_MOD_INIT(biosdisk)
 {
   grub_disk_dev_register (&grub_biosdisk_dev);
 }
 
-void
-grub_biosdisk_fini (void)
+GRUB_MOD_FINI(biosdisk)
 {
   grub_disk_dev_unregister (&grub_biosdisk_dev);
 }
diff -urp grub2/kern/i386/pc/init.c grub2.biosdisk/kern/i386/pc/init.c
--- grub2/kern/i386/pc/init.c	2007-09-07 23:55:26.000000000 +0200
+++ grub2.biosdisk/kern/i386/pc/init.c	2007-10-19 22:00:34.000000000 +0200
@@ -21,7 +21,6 @@
 #include <grub/machine/init.h>
 #include <grub/machine/memory.h>
 #include <grub/machine/console.h>
-#include <grub/machine/biosdisk.h>
 #include <grub/machine/kernel.h>
 #include <grub/types.h>
 #include <grub/err.h>
@@ -226,9 +225,6 @@ grub_machine_init (void)
   
   if (! grub_os_area_addr)
     grub_fatal ("no upper memory");
-  
-  /* The memory system was initialized, thus register built-in devices.  */
-  grub_biosdisk_init ();
 }
 
 void
@@ -241,7 +237,6 @@ grub_machine_set_prefix (void)
 void
 grub_machine_fini (void)
 {
-  grub_biosdisk_fini ();
   grub_console_fini ();
 }
 
diff -urp grub2/util/i386/pc/grub-install.in grub2.biosdisk/util/i386/pc/grub-install.in
--- grub2/util/i386/pc/grub-install.in	2007-07-22 01:32:32.000000000 +0200
+++ grub2.biosdisk/util/i386/pc/grub-install.in	2007-10-19 22:00:34.000000000 +0200
@@ -224,7 +224,7 @@ fi
 partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
 
 # _chain is often useful
-modules="$modules $fs_module $partmap_module _chain"
+modules="$modules $fs_module $partmap_module biosdisk _chain"
 
 $grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
 

             reply	other threads:[~2007-10-19 20:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-19 20:07 Robert Millan [this message]
2007-10-22 20:05 ` [PATCH] convert biosdisk into a module Robert Millan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071019200726.GA12105@thorin \
    --to=rmh@aybabtu.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.