* [PATCH] convert biosdisk into a module
@ 2007-10-19 20:07 Robert Millan
2007-10-22 20:05 ` Robert Millan
0 siblings, 1 reply; 2+ messages in thread
From: Robert Millan @ 2007-10-19 20:07 UTC (permalink / raw)
To: grub-devel
[-- 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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] convert biosdisk into a module
2007-10-19 20:07 [PATCH] convert biosdisk into a module Robert Millan
@ 2007-10-22 20:05 ` Robert Millan
0 siblings, 0 replies; 2+ messages in thread
From: Robert Millan @ 2007-10-22 20:05 UTC (permalink / raw)
To: grub-devel
Committed.
On Fri, Oct 19, 2007 at 10:07:26PM +0200, Robert Millan wrote:
>
> 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 /.)
> 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
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
--
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 /.)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-10-22 20:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-19 20:07 [PATCH] convert biosdisk into a module Robert Millan
2007-10-22 20:05 ` Robert Millan
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.