All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Bug#593467: grub-pc: add support for root ext2/xfs on GNU/kFreeBSD
       [not found] <20100818130757.88123.80791.reportbug@kfreebsd-amd64.aurel32.net>
@ 2010-08-18 14:16 ` Colin Watson
  2010-08-18 15:46   ` Aurelien Jarno
  2010-08-20 11:33   ` Robert Millan
  0 siblings, 2 replies; 5+ messages in thread
From: Colin Watson @ 2010-08-18 14:16 UTC (permalink / raw)
  To: grub-devel; +Cc: 593467-forwarded, Aurelien Jarno

On Wed, Aug 18, 2010 at 03:07:57PM +0200, Aurelien Jarno wrote:
> Since GNU/kFreeBSD switch to grub as the default bootloader, it is 
> almost possible to use an ext2 or xfs root filesystem. While there
> is not a lot of interest in doing that, the patch to do it is quite
> small. Could you please apply it in the next upload?

Sending upstream first.  Does this require copyright assignment?

> --- grub2-1.98+20100804.orig/util/grub.d/10_kfreebsd.in
> +++ grub2-1.98+20100804/util/grub.d/10_kfreebsd.in
> @@ -75,6 +75,22 @@
>    fi
>  
>    case "${kfreebsd_fs}" in
> +    ext2fs)
> +      test -e "${module_dir}/ext2fs.ko"
> +
> +      printf '%s\n' "${prepare_module_dir_cache}"
> +      cat << EOF
> +	kfreebsd_module_elf	${module_dir_rel}/ext2fs.ko
> +EOF
> +    ;;
> +    xfs)
> +      test -e "${module_dir}/xfs.ko"
> +
> +      printf '%s\n' "${prepare_module_dir_cache}"
> +      cat << EOF
> +	kfreebsd_module_elf	${module_dir_rel}/xfs.ko
> +EOF
> +    ;;
>      zfs)
>        test -e "${module_dir}/opensolaris.ko"
>        test -e "${module_dir}/zfs.ko"
> @@ -121,6 +137,7 @@
>  
>    case ${GRUB_FS} in
>      ufs1 | ufs2)        kfreebsd_fs=ufs ;;
> +    ext2)               kfreebsd_fs=ext2fs ;;
>      *)                  kfreebsd_fs=${GRUB_FS} ;;
>    esac
>  

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]


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

* Re: Bug#593467: grub-pc: add support for root ext2/xfs on GNU/kFreeBSD
  2010-08-18 14:16 ` Bug#593467: grub-pc: add support for root ext2/xfs on GNU/kFreeBSD Colin Watson
@ 2010-08-18 15:46   ` Aurelien Jarno
  2010-08-20 10:09     ` Aurelien Jarno
  2010-08-20 11:33   ` Robert Millan
  1 sibling, 1 reply; 5+ messages in thread
From: Aurelien Jarno @ 2010-08-18 15:46 UTC (permalink / raw)
  To: grub-devel; +Cc: 593467, Colin Watson

On Wed, Aug 18, 2010 at 03:16:03PM +0100, Colin Watson wrote:
> On Wed, Aug 18, 2010 at 03:07:57PM +0200, Aurelien Jarno wrote:
> > Since GNU/kFreeBSD switch to grub as the default bootloader, it is 
> > almost possible to use an ext2 or xfs root filesystem. While there
> > is not a lot of interest in doing that, the patch to do it is quite
> > small. Could you please apply it in the next upload?
> 
> Sending upstream first.  Does this require copyright assignment?
> 

As I have been told on IRC, XFS support is only read-only, so there is
no point on adding root support for it yet. ext2 support works in read
write mode, and has been tested as root. Please find an updated patch 
below.

--- grub2-1.98+20100804.orig/util/grub.d/10_kfreebsd.in
+++ grub2-1.98+20100804/util/grub.d/10_kfreebsd.in
@@ -75,6 +75,14 @@
   fi
 
   case "${kfreebsd_fs}" in
+    ext2fs)
+      test -e "${module_dir}/ext2fs.ko"
+
+      printf '%s\n' "${prepare_module_dir_cache}"
+      cat << EOF
+	kfreebsd_module_elf	${module_dir_rel}/ext2fs.ko
+EOF
+    ;;
     zfs)
       test -e "${module_dir}/opensolaris.ko"
       test -e "${module_dir}/zfs.ko"
@@ -121,6 +129,7 @@
 
   case ${GRUB_FS} in
     ufs1 | ufs2)        kfreebsd_fs=ufs ;;
+    ext2)               kfreebsd_fs=ext2fs ;;
     *)                  kfreebsd_fs=${GRUB_FS} ;;
   esac
 

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net


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

* Re: Bug#593467: grub-pc: add support for root ext2/xfs on GNU/kFreeBSD
  2010-08-18 15:46   ` Aurelien Jarno
@ 2010-08-20 10:09     ` Aurelien Jarno
  0 siblings, 0 replies; 5+ messages in thread
From: Aurelien Jarno @ 2010-08-20 10:09 UTC (permalink / raw)
  To: grub-devel

On Wed, Aug 18, 2010 at 05:46:23PM +0200, Aurelien Jarno wrote:
> On Wed, Aug 18, 2010 at 03:16:03PM +0100, Colin Watson wrote:
> > On Wed, Aug 18, 2010 at 03:07:57PM +0200, Aurelien Jarno wrote:
> > > Since GNU/kFreeBSD switch to grub as the default bootloader, it is 
> > > almost possible to use an ext2 or xfs root filesystem. While there
> > > is not a lot of interest in doing that, the patch to do it is quite
> > > small. Could you please apply it in the next upload?
> > 
> > Sending upstream first.  Does this require copyright assignment?
> > 
> 
> As I have been told on IRC, XFS support is only read-only, so there is
> no point on adding root support for it yet. ext2 support works in read
> write mode, and has been tested as root. Please find an updated patch 
> below.

And here is the same patch with a changelog entry as requested on IRC.

2010-08-20  Aurelien Jarno  <aurelien@aurel32.net>

	* util/grub.d/10_kfreebsd.in: Translate ext2 into ext2fs.
	(kfreebsd_entry): On ext2 root, load `ext2fs.ko'

--- grub2-1.98+20100804.orig/util/grub.d/10_kfreebsd.in
+++ grub2-1.98+20100804/util/grub.d/10_kfreebsd.in
@@ -75,6 +75,14 @@
   fi
 
   case "${kfreebsd_fs}" in
+    ext2fs)
+      test -e "${module_dir}/ext2fs.ko"
+
+      printf '%s\n' "${prepare_module_dir_cache}"
+      cat << EOF
+	kfreebsd_module_elf	${module_dir_rel}/ext2fs.ko
+EOF
+    ;;
     zfs)
       test -e "${module_dir}/opensolaris.ko"
       test -e "${module_dir}/zfs.ko"
@@ -121,6 +129,7 @@
 
   case ${GRUB_FS} in
     ufs1 | ufs2)        kfreebsd_fs=ufs ;;
+    ext2)               kfreebsd_fs=ext2fs ;;
     *)                  kfreebsd_fs=${GRUB_FS} ;;
   esac
 

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net


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

* Re: Bug#593467: grub-pc: add support for root ext2/xfs on GNU/kFreeBSD
  2010-08-18 14:16 ` Bug#593467: grub-pc: add support for root ext2/xfs on GNU/kFreeBSD Colin Watson
  2010-08-18 15:46   ` Aurelien Jarno
@ 2010-08-20 11:33   ` Robert Millan
  2010-08-20 14:41     ` Robert Millan
  1 sibling, 1 reply; 5+ messages in thread
From: Robert Millan @ 2010-08-20 11:33 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: 593467-forwarded, Aurelien Jarno

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

2010/8/18, Colin Watson <cjwatson@ubuntu.com>:
> On Wed, Aug 18, 2010 at 03:07:57PM +0200, Aurelien Jarno wrote:
>> Since GNU/kFreeBSD switch to grub as the default bootloader, it is
>> almost possible to use an ext2 or xfs root filesystem. While there
>> is not a lot of interest in doing that, the patch to do it is quite
>> small. Could you please apply it in the next upload?
>
> Sending upstream first.  Does this require copyright assignment?

I'd rather make it generic, something like this.  Does it work for you?

This has interesting side-effects, like for example it would be possible to
build UFS as a module.

-- 
Robert Millan

[-- Attachment #2: fs.diff --]
[-- Type: text/x-patch, Size: 984 bytes --]

2010-08-20  Robert Millan  <rmh@gnu.org>

	* util/grub.d/10_kfreebsd.in (kfreebsd_entry): Add generic module
	load routine.
	Map GRUB `ext2' to kFreeBSD `ext2fs'.

=== modified file 'util/grub.d/10_kfreebsd.in'
--- util/grub.d/10_kfreebsd.in	2010-08-08 14:27:58 +0000
+++ util/grub.d/10_kfreebsd.in	2010-08-19 21:54:59 +0000
@@ -92,6 +92,14 @@ EOF
 	kfreebsd_module		${rel_dirname}/zfs/zpool.cache type=/boot/zfs/zpool.cache
 EOF
     ;;
+    *)
+      ls "${module_dir}/${kfreebsd_fs}.ko" > /dev/null
+
+      printf '%s\n' "${prepare_module_dir_cache}"
+      cat << EOF
+	kfreebsd_module_elf	${module_dir_rel}/${kfreebsd_fs}.ko
+EOF
+    ;;
   esac
 
   cat << EOF
@@ -121,8 +129,9 @@ while [ "x$list" != "x" ] ; do
   fi
 
   case ${GRUB_FS} in
-    ufs1 | ufs2)        kfreebsd_fs=ufs ;;
-    *)                  kfreebsd_fs=${GRUB_FS} ;;
+    ufs1 | ufs2)	kfreebsd_fs=ufs ;;
+    ext2)		kfreebsd_fs=ext2fs ;;
+    *)			kfreebsd_fs=${GRUB_FS} ;;
   esac
 
   case ${GRUB_FS} in


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

* Re: Bug#593467: grub-pc: add support for root ext2/xfs on GNU/kFreeBSD
  2010-08-20 11:33   ` Robert Millan
@ 2010-08-20 14:41     ` Robert Millan
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Millan @ 2010-08-20 14:41 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: 593467-forwarded, Aurelien Jarno

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

After discussing it with Vladimir I commited this.  I refactored module load
routine while at it, making code a bit more readable.

I tested it, but only with ZFS.  I also verified that loading ufs.ko when
it has been built into kernel doesn't lead to trouble (duplicate modules
are discarded).  Let me know if there were a problem with other filesystems.

-- 
Robert Millan

[-- Attachment #2: fs.diff --]
[-- Type: text/x-patch, Size: 3322 bytes --]

=== modified file 'ChangeLog'
--- ChangeLog	2010-08-19 23:15:23 +0000
+++ ChangeLog	2010-08-20 14:34:56 +0000
@@ -1,3 +1,13 @@
+2010-08-20  Robert Millan  <rmh@gnu.org>
+
+	Make kFreeBSD code more generic to support ext2fs as root, ufs as
+	a separate module and maybe other interesting combinations.
+
+	* util/grub.d/10_kfreebsd.in (load_kfreebsd_module): New function.
+	(kfreebsd_entry): Use load_kfreebsd_module() to load modules.
+	(kfreebsd_entry): Add generic filesystem module load routine.
+	Map GRUB `ext2' to kFreeBSD `ext2fs'.
+
 2010-08-20  Colin Watson  <cjwatson@ubuntu.com>
 
 	* commands/i386/pc/sendkey.c (keysym_table): Rename "numlock" to

=== modified file 'util/grub.d/10_kfreebsd.in'
--- util/grub.d/10_kfreebsd.in	2010-08-08 14:27:58 +0000
+++ util/grub.d/10_kfreebsd.in	2010-08-20 14:29:50 +0000
@@ -39,6 +39,31 @@ case "${GRUB_DISTRIBUTOR}" in
   ;;
 esac
 
+load_kfreebsd_module ()
+{
+  mod="$1"
+  allow_fail="$2"
+
+  if ! test -e "${module_dir}/${mod}.ko" ; then
+    if [ "${allow_fail}" = "true" ] ; then
+      # Return silently
+      return
+    else
+      # Print an error and fail.
+      ls "${module_dir}/${mod}.ko" > /dev/null
+    fi
+  fi
+
+  if [ -z "${prepare_module_dir_cache}" ]; then
+    prepare_module_dir_cache="$(prepare_grub_to_access_device $(grub-probe -t device "${module_dir}") | sed -e "s/^/\t/")"
+  fi
+
+  printf '%s\n' "${prepare_module_dir_cache}"
+  cat << EOF
+	kfreebsd_module_elf	${module_dir_rel}/${mod}.ko
+EOF
+}
+
 kfreebsd_entry ()
 {
   os="$1"
@@ -51,9 +76,6 @@ kfreebsd_entry ()
   if [ -z "${prepare_boot_cache}" ]; then
     prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
   fi
-  if [ -z "${prepare_module_dir_cache}" ]; then
-    prepare_module_dir_cache="$(prepare_grub_to_access_device $(grub-probe -t device "${module_dir}") | sed -e "s/^/\t/")"
-  fi
 
   printf '%s\n' "${prepare_boot_cache}"
   cat << EOF
@@ -67,26 +89,13 @@ EOF
 EOF
   fi
 
-  if test -e "${module_dir}/acpi.ko" ; then
-    printf '%s\n' "${prepare_module_dir_cache}"
-    cat << EOF
-	kfreebsd_module_elf	${module_dir_rel}/acpi.ko
-EOF
-  fi
+  load_kfreebsd_module acpi true
 
   case "${kfreebsd_fs}" in
     zfs)
-      for i in "${module_dir}/opensolaris.ko" "${module_dir}/zfs.ko" \
-          "${dirname}/zfs/zpool.cache" ; do
-        ls "$i" > /dev/null
-      done
-
-      printf '%s\n' "${prepare_module_dir_cache}"
-      cat << EOF
-	kfreebsd_module_elf	${module_dir_rel}/opensolaris.ko
-	kfreebsd_module_elf	${module_dir_rel}/zfs.ko
-EOF
+      load_kfreebsd_module opensolaris false
 
+      ls "${dirname}/zfs/zpool.cache" > /dev/null
       printf '%s\n' "${prepare_boot_cache}"
   cat << EOF
 	kfreebsd_module		${rel_dirname}/zfs/zpool.cache type=/boot/zfs/zpool.cache
@@ -94,6 +103,8 @@ EOF
     ;;
   esac
 
+  load_kfreebsd_module ${kfreebsd_fs} false
+
   cat << EOF
 	set kFreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${kfreebsd_device}
 	set kFreeBSD.vfs.root.mountfrom.options=rw
@@ -121,8 +132,9 @@ while [ "x$list" != "x" ] ; do
   fi
 
   case ${GRUB_FS} in
-    ufs1 | ufs2)        kfreebsd_fs=ufs ;;
-    *)                  kfreebsd_fs=${GRUB_FS} ;;
+    ufs1 | ufs2)	kfreebsd_fs=ufs ;;
+    ext2)		kfreebsd_fs=ext2fs ;;
+    *)			kfreebsd_fs=${GRUB_FS} ;;
   esac
 
   case ${GRUB_FS} in


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

end of thread, other threads:[~2010-08-20 14:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20100818130757.88123.80791.reportbug@kfreebsd-amd64.aurel32.net>
2010-08-18 14:16 ` Bug#593467: grub-pc: add support for root ext2/xfs on GNU/kFreeBSD Colin Watson
2010-08-18 15:46   ` Aurelien Jarno
2010-08-20 10:09     ` Aurelien Jarno
2010-08-20 11:33   ` Robert Millan
2010-08-20 14:41     ` 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.