* [PATCH] Support FreeBSD in osdetect.lua
@ 2009-07-21 13:45 Vladimir 'phcoder' Serbinenko
2009-07-21 16:02 ` Pavel Roskin
0 siblings, 1 reply; 9+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-07-21 13:45 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 202 bytes --]
Support FreeBSD on both UFS and ZFS. Requires my zfs.mod for zfs and
my ufs uuid patch for UFS
--
Regards
Vladimir 'phcoder' Serbinenko
Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
[-- Attachment #2: freebsd_osdetect.diff --]
[-- Type: text/plain, Size: 2930 bytes --]
diff --git a/util/osdetect.lua b/util/osdetect.lua
index 38a9099..1d09500 100644
--- a/util/osdetect.lua
+++ b/util/osdetect.lua
@@ -40,6 +40,28 @@ function enum_device (device, fs, uuid)
b1, b2, b3, b4 = string.match (second, "(%d+)%.?(%d*).?(%d*)%-?(%d*)")
return (a1 > b1) or (a2 > b2) or (a3 > b3) or (a4 < b4);
end
+ local function freebsd_variants (title, header, footer)
+ normal = "\nset FreeBSD.acpi_load=YES" ..
+ "\nset FreeBSD.hint.acpi.0.disabled=0"
+ noacpi = "\nunset FreeBSD.acpi_load" ..
+ "\nset FreeBSD.hint.acpi.0.disabled=1" ..
+ "\nset FreeBSD.loader.acpi_disabled_by_user=1"
+ safe = "\nset FreeBSD.hint.apic.0.disabled=1" ..
+ "\nset FreeBSD.hw.ata.ata_dma=0" ..
+ "\nset FreeBSD.hw.ata.atapi_dma=0" ..
+ "\nset FreeBSD.hw.ata.wc=0" ..
+ "\nset FreeBSD.hw.eisa_slots=0" ..
+ "\nset FreeBSD.hint.kbdmux.0.disabled=1"
+ grub.add_menu (header .. normal .. footer, title)
+ grub.add_menu (header .. " single" .. normal .. footer,
+ title .. " (single)")
+ grub.add_menu (header .. " verbose" .. normal .. footer,
+ title .. " (verbose)")
+ grub.add_menu (header .. noacpi .. footer,
+ title .. " (without ACPI)")
+ grub.add_menu (header .. noacpi .. safe .. footer,
+ title .. " (safe mode)")
+ end
root = "(" .. device .. ")/"
source = "root (" .. device .. ")\nchainloader +1"
@@ -58,11 +80,26 @@ function enum_device (device, fs, uuid)
title = "MS-DOS"
elseif (grub.file_exist (root .. "kernel.sys")) then
title = "FreeDOS"
- elseif (grub.file_exist (root .. "boot/loader") and
+ elseif (fs == "ufs" and grub.file_exist (root .. "boot/kernel/kernel") and
grub.file_exist (root .. "boot/device.hints")) then
- source = "root (" .. device .. ")\nfreebsd /boot/loader" ..
- "\nfreebsd_loadenv /boot/device.hints"
- title = "FreeBSD"
+ header = "set root=" .. device .. "\nfreebsd /boot/kernel/kernel"
+ footer = "\nset FreeBSD.vfs.root.mountfrom=ufs:ufsid/" .. uuid ..
+ "\nfreebsd_loadenv /boot/device.hints"
+ title = "FreeBSD (on " .. fs .. " ".. device .. ")"
+ freebsd_variants (title, header, footer)
+ return 0
+ elseif (fs == "zfs" and grub.file_exist (root .. "@/boot/kernel/kernel") and
+ grub.file_exist (root .. "@/boot/device.hints")) then
+ header = "set root=" .. device .. "\nfreebsd /@/boot/kernel/kernel"
+ footer = "\nfreebsd_module_elf /@/boot/kernel/opensolaris.ko" ..
+ "\nfreebsd_module_elf /@/boot/kernel/zfs.ko" ..
+ "\nfreebsd_module /@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache" ..
+ "\nprobe -l -s name $root" ..
+ "\nset FreeBSD.vfs.root.mountfrom=zfs:$name" ..
+ "\nfreebsd_loadenv /@/boot/device.hints"
+ title = "FreeBSD (on " .. fs .. " ".. device .. ")"
+ freebsd_variants (title, header, footer)
+ return 0
else
grub.enum_file (enum_file, root .. "boot")
if kernel_num ~= 0 then
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] Support FreeBSD in osdetect.lua
2009-07-21 13:45 [PATCH] Support FreeBSD in osdetect.lua Vladimir 'phcoder' Serbinenko
@ 2009-07-21 16:02 ` Pavel Roskin
2009-07-21 20:17 ` Vladimir 'phcoder' Serbinenko
0 siblings, 1 reply; 9+ messages in thread
From: Pavel Roskin @ 2009-07-21 16:02 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, 2009-07-21 at 15:45 +0200, Vladimir 'phcoder' Serbinenko wrote:
> Support FreeBSD on both UFS and ZFS. Requires my zfs.mod for zfs and
> my ufs uuid patch for UFS
> + grub.add_menu (header .. normal .. footer, title)
> + grub.add_menu (header .. " single" .. normal .. footer,
> + title .. " (single)")
> + grub.add_menu (header .. " verbose" .. normal .. footer,
> + title .. " (verbose)")
> + grub.add_menu (header .. noacpi .. footer,
> + title .. " (without ACPI)")
> + grub.add_menu (header .. noacpi .. safe .. footer,
> + title .. " (safe mode)")
I hate to be "Mister No", but I think this change is not suitable for
the generic osdetect.lua. Most users don't have problems with FreeBSD
not working on their hardware. Getting five menu entries for different
options is too much. It may be OK for a FreeBSD installer, but not for
the generic script that also detects other OSes.
A reasonable middle ground would be to have one entry called "safe mode"
to would lead to a menu offering single mode, disabling ACPI, disabling
whatever else is potentially problematic. I think all entries under
"safe mode" can enable extra verbosity.
The implementation could remove the original menu, or it could insert
entries immediately below "safe mode". I don't know if it's possible,
but it could be useful.
Actually, I don't want osdetect.lua to be overengineered and overloaded
with intimate knowledge of different OSes. It's an example for others
to extend, not a complete solution.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Support FreeBSD in osdetect.lua
2009-07-21 16:02 ` Pavel Roskin
@ 2009-07-21 20:17 ` Vladimir 'phcoder' Serbinenko
2009-07-21 21:25 ` Pavel Roskin
0 siblings, 1 reply; 9+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-07-21 20:17 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jul 21, 2009 at 6:02 PM, Pavel Roskin<proski@gnu.org> wrote:
> On Tue, 2009-07-21 at 15:45 +0200, Vladimir 'phcoder' Serbinenko wrote:
>> Support FreeBSD on both UFS and ZFS. Requires my zfs.mod for zfs and
>> my ufs uuid patch for UFS
>
>> + grub.add_menu (header .. normal .. footer, title)
>> + grub.add_menu (header .. " single" .. normal .. footer,
>> + title .. " (single)")
>> + grub.add_menu (header .. " verbose" .. normal .. footer,
>> + title .. " (verbose)")
>> + grub.add_menu (header .. noacpi .. footer,
>> + title .. " (without ACPI)")
>> + grub.add_menu (header .. noacpi .. safe .. footer,
>> + title .. " (safe mode)")
>
> I hate to be "Mister No", but I think this change is not suitable for
> the generic osdetect.lua. Most users don't have problems with FreeBSD
> not working on their hardware. Getting five menu entries for different
> options is too much. It may be OK for a FreeBSD installer, but not for
> the generic script that also detects other OSes.
>
> A reasonable middle ground would be to have one entry called "safe mode"
> to would lead to a menu offering single mode, disabling ACPI, disabling
> whatever else is potentially problematic. I think all entries under
> "safe mode" can enable extra verbosity.
>
Actually this menu is done to match the default one of FreeBSD loader.
I'm not a FreeBSD expert so I prefered to stick to the same menu as
default bootloader.
> The implementation could remove the original menu, or it could insert
> entries immediately below "safe mode". I don't know if it's possible,
> but it could be useful.
>
Bean proposed something like this but I don't know his progress
> Actually, I don't want osdetect.lua to be overengineered and overloaded
> with intimate knowledge of different OSes. It's an example for others
> to extend, not a complete solution.
We put it into our repository this means that we accept improvements.
I also think that there will be distributions similar to Super GRUB
Disk and other recovery tools based on osdetect.lua. Unless we provide
a good reference osdetect.lua there will be a bitrot between such
distributions every one neglecting some OSes
>
> --
> Regards,
> Pavel Roskin
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'phcoder' Serbinenko
Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Support FreeBSD in osdetect.lua
2009-07-21 20:17 ` Vladimir 'phcoder' Serbinenko
@ 2009-07-21 21:25 ` Pavel Roskin
2009-07-21 21:50 ` Vladimir 'phcoder' Serbinenko
0 siblings, 1 reply; 9+ messages in thread
From: Pavel Roskin @ 2009-07-21 21:25 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, 2009-07-21 at 22:17 +0200, Vladimir 'phcoder' Serbinenko wrote:
> Actually this menu is done to match the default one of FreeBSD loader.
> I'm not a FreeBSD expert so I prefered to stick to the same menu as
> default bootloader.
I see.
> > The implementation could remove the original menu, or it could insert
> > entries immediately below "safe mode". I don't know if it's possible,
> > but it could be useful.
> >
> Bean proposed something like this but I don't know his progress
> > Actually, I don't want osdetect.lua to be overengineered and overloaded
> > with intimate knowledge of different OSes. It's an example for others
> > to extend, not a complete solution.
> We put it into our repository this means that we accept improvements.
> I also think that there will be distributions similar to Super GRUB
> Disk and other recovery tools based on osdetect.lua. Unless we provide
> a good reference osdetect.lua there will be a bitrot between such
> distributions every one neglecting some OSes
I don't fee strongly against your change. However, I would hate to see
five lines for every Linux kernel (although it would be nice to have
safe mode for Windows in the GRUB menu). So this should not be an
example for other OSes.
Obviously, the zfs part shouldn't go in yet.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Support FreeBSD in osdetect.lua
2009-07-21 21:25 ` Pavel Roskin
@ 2009-07-21 21:50 ` Vladimir 'phcoder' Serbinenko
2009-07-22 17:51 ` Robert Millan
0 siblings, 1 reply; 9+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-07-21 21:50 UTC (permalink / raw)
To: The development of GRUB 2
>> We put it into our repository this means that we accept improvements.
>> I also think that there will be distributions similar to Super GRUB
>> Disk and other recovery tools based on osdetect.lua. Unless we provide
>> a good reference osdetect.lua there will be a bitrot between such
>> distributions every one neglecting some OSes
>
> I don't fee strongly against your change. However, I would hate to see
> five lines for every Linux kernel (although it would be nice to have
> safe mode for Windows in the GRUB menu).
You can have a look at my sendkey branch
> So this should not be an
> example for other OSes.
We need two-level menu. However I prefer to merge gfxmenu first.
>
> Obviously, the zfs part shouldn't go in yet.
>
We discussed with Robert Millan the issue and decided that zfs.mod
will go to grub-extras. Just I had no time to upload it yet. As zfs
part of osdetect.lua is harmless and effectless if no zfs.mod is
present I see no reason for it not to be in mainstream
> --
> Regards,
> Pavel Roskin
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'phcoder' Serbinenko
Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Support FreeBSD in osdetect.lua
2009-07-21 21:50 ` Vladimir 'phcoder' Serbinenko
@ 2009-07-22 17:51 ` Robert Millan
2009-07-22 18:02 ` Vladimir 'phcoder' Serbinenko
0 siblings, 1 reply; 9+ messages in thread
From: Robert Millan @ 2009-07-22 17:51 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jul 21, 2009 at 11:50:12PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> >
> > Obviously, the zfs part shouldn't go in yet.
> >
> We discussed with Robert Millan the issue and decided that zfs.mod
> will go to grub-extras. Just I had no time to upload it yet. As zfs
> part of osdetect.lua is harmless and effectless if no zfs.mod is
> present I see no reason for it not to be in mainstream
Well, this gets a bit more complicated. grub-extras is not part of GNU GRUB,
but osdetect.lua is (currently). I'm not sure if we should make GRUB
components depend on grub-extras this way (I think this is Pavel's point).
I think we should contemplate to put LUA scripting in grub-extras too. Like
other components of grub-extras, we don't have copyright assignment for it,
so it would fit well the purpose of grub-extras. This would render the
question about zfs moot.
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Support FreeBSD in osdetect.lua
2009-07-22 17:51 ` Robert Millan
@ 2009-07-22 18:02 ` Vladimir 'phcoder' Serbinenko
2009-07-25 16:10 ` Robert Millan
0 siblings, 1 reply; 9+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-07-22 18:02 UTC (permalink / raw)
To: The development of GRUB 2
> Well, this gets a bit more complicated. grub-extras is not part of GNU GRUB,
> but osdetect.lua is (currently). I'm not sure if we should make GRUB
> components depend on grub-extras this way (I think this is Pavel's point).
Well this part is just inactive if zfs.mod isn't present
>
> I think we should contemplate to put LUA scripting in grub-extras too. Like
> other components of grub-extras, we don't have copyright assignment for it,
> so it would fit well the purpose of grub-extras. This would render the
> question about zfs moot.
LUA will probably be important for graphics. If we put LUA in
grub-extras we will have 2 distinct videosystems and we're already
short on ressources to maintain one
>
> --
> Robert Millan
>
> The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
> how) you may access your data; but nobody's threatening your freedom: we
> still allow you to remove your data and not access it at all."
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'phcoder' Serbinenko
Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Support FreeBSD in osdetect.lua
2009-07-22 18:02 ` Vladimir 'phcoder' Serbinenko
@ 2009-07-25 16:10 ` Robert Millan
2009-07-25 16:46 ` Vladimir 'phcoder' Serbinenko
0 siblings, 1 reply; 9+ messages in thread
From: Robert Millan @ 2009-07-25 16:10 UTC (permalink / raw)
To: The development of GRUB 2
On Wed, Jul 22, 2009 at 08:02:02PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> > I think we should contemplate to put LUA scripting in grub-extras too. Like
> > other components of grub-extras, we don't have copyright assignment for it,
> > so it would fit well the purpose of grub-extras. This would render the
> > question about zfs moot.
> LUA will probably be important for graphics.
It can be useful, yes, but not essential. Native scripting should continue
to be supported, since the whole grub-mkconfig stack relies on it.
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Support FreeBSD in osdetect.lua
2009-07-25 16:10 ` Robert Millan
@ 2009-07-25 16:46 ` Vladimir 'phcoder' Serbinenko
0 siblings, 0 replies; 9+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-07-25 16:46 UTC (permalink / raw)
To: The development of GRUB 2
>> LUA will probably be important for graphics.
>
> It can be useful, yes, but not essential. Native scripting should continue
> to be supported, since the whole grub-mkconfig stack relies on it.
Yes, but graphics itself isn't essential either. And I also agree that
sh should be privelegied. But sh is inappropriate for handling
graphics especially advanced ones. What I want to avoid is the
maintainance burden if video subsystem has to work both with and
without lua present. Anyway standard menus even graphical ones will be
available without LUA too.
>
> --
> Robert Millan
>
> The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
> how) you may access your data; but nobody's threatening your freedom: we
> still allow you to remove your data and not access it at all."
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'phcoder' Serbinenko
Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-07-25 16:46 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-21 13:45 [PATCH] Support FreeBSD in osdetect.lua Vladimir 'phcoder' Serbinenko
2009-07-21 16:02 ` Pavel Roskin
2009-07-21 20:17 ` Vladimir 'phcoder' Serbinenko
2009-07-21 21:25 ` Pavel Roskin
2009-07-21 21:50 ` Vladimir 'phcoder' Serbinenko
2009-07-22 17:51 ` Robert Millan
2009-07-22 18:02 ` Vladimir 'phcoder' Serbinenko
2009-07-25 16:10 ` Robert Millan
2009-07-25 16:46 ` Vladimir 'phcoder' Serbinenko
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.