* Command extension suggestions
@ 2007-06-14 3:46 Bean
2007-06-14 6:08 ` Robert Millan
0 siblings, 1 reply; 10+ messages in thread
From: Bean @ 2007-06-14 3:46 UTC (permalink / raw)
To: The development of GRUB 2
These ideas are mostly from grub4dos, I think they can be useful in GRUB2.
1. cat
In addition to the current function, cat can also generate hexadecimal dump,
and it can optionally choose the range of bytes to display. For example:
cat [--hex] [--skip=S] [--length=L] FILE
Sometimes it's useful to dump the content of physical memory, it can be
implemented with a special option --mem. For example,
cat [--mem] [--skip=S] [--length=L] base_address
It can also be implemented with virtual device (md). For example,
cat --hex (md)+2
dump the first 1K of memory.
But It seems a waste to add a new device just for cat.
The cat module can export function dump:
dump(unsigned long base, char* buf, int len);
other module can use it to generate hexadecimal dump.
2. find
Find command is missing in GRUB2. It's used to find the device which contains
a certain file.
find [--set=var_name] FILENAME
If the device is found, it's name will be copied to var_name. For example,
find --set=root /io.sys
chainloader +1
Boot from the partition that has io.sys in the root directory.
3. chainloader
It can be useful if chainloader can load multiple sector file.
chainloader [--force] [--load-addr=SEG:OFS] [--boot-addr=CS:IP] FILE
The default load address and boot address is 0:0x7C00.
With this extension, chainloader can load grldr, ntldr, io.sys, kernel.sys,
etc.
--
Bean <bean123@126.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Command extension suggestions
2007-06-14 3:46 Command extension suggestions Bean
@ 2007-06-14 6:08 ` Robert Millan
2007-06-14 6:24 ` Bean
0 siblings, 1 reply; 10+ messages in thread
From: Robert Millan @ 2007-06-14 6:08 UTC (permalink / raw)
To: The development of GRUB 2
On Thu, Jun 14, 2007 at 11:46:49AM +0800, Bean wrote:
> These ideas are mostly from grub4dos, I think they can be useful in GRUB2.
>
> 1. cat
>
> In addition to the current function, cat can also generate hexadecimal dump,
> and it can optionally choose the range of bytes to display. For example:
>
> cat [--hex] [--skip=S] [--length=L] FILE
Wouldn't it be more consistent to call it:
od [-j|--skip-bytes=S] [-N|--read-bytes=L] FILE
> Sometimes it's useful to dump the content of physical memory, it can be
> implemented with a special option --mem. For example,
>
> cat [--mem] [--skip=S] [--length=L] base_address
>
> It can also be implemented with virtual device (md). For example,
>
> cat --hex (md)+2
That sounds much cleaner IMHO. But IIRC (md) is already in use by the
RAID/LVM stuff ?
> 2. find
>
> Find command is missing in GRUB2. It's used to find the device which contains
> a certain file.
>
> find [--set=var_name] FILENAME
We have this already, only with different name:
search --set /file
(root is implicit, but it can be overriden)
--
Robert Millan
My spam trap is honeypot@aybabtu.com. Note: this address is only intended
for spam harvesters. Writing to it will get you added to my black list.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Command extension suggestions
2007-06-14 6:08 ` Robert Millan
@ 2007-06-14 6:24 ` Bean
2007-06-14 9:42 ` Marco Gerards
0 siblings, 1 reply; 10+ messages in thread
From: Bean @ 2007-06-14 6:24 UTC (permalink / raw)
To: The development of GRUB 2
On Thu, Jun 14, 2007 at 08:08:09AM +0200, Robert Millan wrote:
> On Thu, Jun 14, 2007 at 11:46:49AM +0800, Bean wrote:
> > These ideas are mostly from grub4dos, I think they can be useful in GRUB2.
> >
> > 1. cat
> >
> > In addition to the current function, cat can also generate hexadecimal dump,
> > and it can optionally choose the range of bytes to display. For example:
> >
> > cat [--hex] [--skip=S] [--length=L] FILE
>
> Wouldn't it be more consistent to call it:
>
> od [-j|--skip-bytes=S] [-N|--read-bytes=L] FILE
>
Good idea.
> > Sometimes it's useful to dump the content of physical memory, it can be
> > implemented with a special option --mem. For example,
> >
> > cat [--mem] [--skip=S] [--length=L] base_address
> >
> > It can also be implemented with virtual device (md). For example,
> >
> > cat --hex (md)+2
>
> That sounds much cleaner IMHO. But IIRC (md) is already in use by the
> RAID/LVM stuff ?
>
Maybe (mem) ?
Also, I don't know if GRUB2 kernel support initrd. You can start grub4dos
like this:
kernel /grub.exe
initrd /aa.img
Inside grub4dos, the initrd can be access using (rd). It would be nice if
grub2 support this kind of usage.
> > 2. find
> >
> > Find command is missing in GRUB2. It's used to find the device which contains
> > a certain file.
> >
> > find [--set=var_name] FILENAME
>
> We have this already, only with different name:
>
> search --set /file
>
> (root is implicit, but it can be overriden)
Thanks for pointing out.
--
Bean <bean123@126.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Command extension suggestions
2007-06-14 6:24 ` Bean
@ 2007-06-14 9:42 ` Marco Gerards
2007-06-14 10:24 ` Bean
0 siblings, 1 reply; 10+ messages in thread
From: Marco Gerards @ 2007-06-14 9:42 UTC (permalink / raw)
To: The development of GRUB 2
Bean <bean123@126.com> writes:
[...]
>> That sounds much cleaner IMHO. But IIRC (md) is already in use by the
>> RAID/LVM stuff ?
>>
>
> Maybe (mem) ?
When would this be useful?
> Also, I don't know if GRUB2 kernel support initrd. You can start grub4dos
> like this:
>
> kernel /grub.exe
> initrd /aa.img
>
> Inside grub4dos, the initrd can be access using (rd). It would be nice if
> grub2 support this kind of usage.
You can use the loopback command to do this, if you want to access a
filesystem image.
loopback (loop) /foo/bar.img
ls -l (loop)/
--
Marco
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Command extension suggestions
2007-06-14 9:42 ` Marco Gerards
@ 2007-06-14 10:24 ` Bean
2007-06-14 10:49 ` Marco Gerards
0 siblings, 1 reply; 10+ messages in thread
From: Bean @ 2007-06-14 10:24 UTC (permalink / raw)
To: The development of GRUB 2
On Thu, Jun 14, 2007 at 11:42:24AM +0200, Marco Gerards wrote:
> Bean <bean123@126.com> writes:
>
> [...]
>
> >> That sounds much cleaner IMHO. But IIRC (md) is already in use by the
> >> RAID/LVM stuff ?
> >>
> >
> > Maybe (mem) ?
>
> When would this be useful?
You can use it to dump physical memory, for example,
od (mem)+2
dump first 1K of memory
od --skip-bytes=0x413 --read-bytes=2 (mem)
dump the word at 0x413.
I can't think of other use at the moment.
>
> > Also, I don't know if GRUB2 kernel support initrd. You can start grub4dos
> > like this:
> >
> > kernel /grub.exe
> > initrd /aa.img
> >
> > Inside grub4dos, the initrd can be access using (rd). It would be nice if
> > grub2 support this kind of usage.
>
> You can use the loopback command to do this, if you want to access a
> filesystem image.
>
> loopback (loop) /foo/bar.img
> ls -l (loop)/
>
Initrd can still be useful. In some case, it's not easy to access the boot
media, such as, cdrom or pxe. To boot from such media, you can either put
everything in core.img, or you can create a minimum core.img, and put other
files, like *.mod, grub.cfg, font, etc, in an initrd. The initrd can be
loaded along with core.img, using loader such as isolinux or pxelinux.
--
Bean <bean123@126.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Command extension suggestions
2007-06-14 10:24 ` Bean
@ 2007-06-14 10:49 ` Marco Gerards
2007-06-14 11:31 ` Bean
0 siblings, 1 reply; 10+ messages in thread
From: Marco Gerards @ 2007-06-14 10:49 UTC (permalink / raw)
To: The development of GRUB 2
Bean <bean123@126.com> writes:
> On Thu, Jun 14, 2007 at 11:42:24AM +0200, Marco Gerards wrote:
>> Bean <bean123@126.com> writes:
>>
>> [...]
>>
>> >> That sounds much cleaner IMHO. But IIRC (md) is already in use by the
>> >> RAID/LVM stuff ?
>> >>
>> >
>> > Maybe (mem) ?
>>
>> When would this be useful?
>
> You can use it to dump physical memory, for example,
>
> od (mem)+2
>
> dump first 1K of memory
>
> od --skip-bytes=0x413 --read-bytes=2 (mem)
>
> dump the word at 0x413.
>
> I can't think of other use at the moment.
Right, so mainly debugging :)
>> > Also, I don't know if GRUB2 kernel support initrd. You can start grub4dos
>> > like this:
>> >
>> > kernel /grub.exe
>> > initrd /aa.img
>> >
>> > Inside grub4dos, the initrd can be access using (rd). It would be nice if
>> > grub2 support this kind of usage.
>>
>> You can use the loopback command to do this, if you want to access a
>> filesystem image.
>>
>> loopback (loop) /foo/bar.img
>> ls -l (loop)/
>
> Initrd can still be useful. In some case, it's not easy to access the boot
> media, such as, cdrom or pxe. To boot from such media, you can either put
> everything in core.img, or you can create a minimum core.img, and put other
> files, like *.mod, grub.cfg, font, etc, in an initrd. The initrd can be
> loaded along with core.img, using loader such as isolinux or pxelinux.
Well, I see the problem but I do not agree with the solution.
The problem for GRUB 2 is that initrd is very linux specific. It's
part of a loader. Perhaps we either have to extend loopback to load a
file into memory on beforehand. Or add a memdisk disk or so.
One problem with initrd is that it is very architecture specific.
Another problem is that the initrd is unloaded when you load another
kernel or OS. Besides that, reusing initrd appears hackish to me :-).
--
Marco
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Command extension suggestions
2007-06-14 10:49 ` Marco Gerards
@ 2007-06-14 11:31 ` Bean
2007-06-14 11:50 ` Marco Gerards
0 siblings, 1 reply; 10+ messages in thread
From: Bean @ 2007-06-14 11:31 UTC (permalink / raw)
To: The development of GRUB 2
On Thu, Jun 14, 2007 at 12:49:26PM +0200, Marco Gerards wrote:
> Well, I see the problem but I do not agree with the solution.
>
> The problem for GRUB 2 is that initrd is very linux specific. It's
> part of a loader. Perhaps we either have to extend loopback to load a
> file into memory on beforehand. Or add a memdisk disk or so.
>
> One problem with initrd is that it is very architecture specific.
> Another problem is that the initrd is unloaded when you load another
> kernel or OS. Besides that, reusing initrd appears hackish to me :-).
I have another idea on this subject. First, We can extend the function of
grub-mkimage so that it can handle data files. The data files embed in
core.img can be accessed using a special device such as (ed). Then, we can
put all necessary files, such as modules, grub.cfg and other data files in
a single core.img. This kernel is self-sustaining, no extra file is needed
for it to function properly.
Even if we don't create mono kernel, embeded data files can be usefully. For
example, moddep.lst, fs.lst and command.lst, these files are best placed in
core.img. Also, we can check the presence of embeded grub.cfg before loading
external one, this is similar to the preset menu concept in GRUB Legacy.
--
Bean <bean123@126.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Command extension suggestions
2007-06-14 11:31 ` Bean
@ 2007-06-14 11:50 ` Marco Gerards
2007-06-14 13:08 ` Bean
0 siblings, 1 reply; 10+ messages in thread
From: Marco Gerards @ 2007-06-14 11:50 UTC (permalink / raw)
To: The development of GRUB 2
Bean <bean123@126.com> writes:
> On Thu, Jun 14, 2007 at 12:49:26PM +0200, Marco Gerards wrote:
>> Well, I see the problem but I do not agree with the solution.
>>
>> The problem for GRUB 2 is that initrd is very linux specific. It's
>> part of a loader. Perhaps we either have to extend loopback to load a
>> file into memory on beforehand. Or add a memdisk disk or so.
>>
>> One problem with initrd is that it is very architecture specific.
>> Another problem is that the initrd is unloaded when you load another
>> kernel or OS. Besides that, reusing initrd appears hackish to me :-).
>
> I have another idea on this subject. First, We can extend the function of
> grub-mkimage so that it can handle data files. The data files embed in
> core.img can be accessed using a special device such as (ed). Then, we can
> put all necessary files, such as modules, grub.cfg and other data files in
> a single core.img. This kernel is self-sustaining, no extra file is needed
> for it to function properly.
This sounds good. In what way do you want to embed them? A
filesystem image (for example minixfs)? Some simple archive?
You don't have to put modules in there, they can be made part of
core.img.
> Even if we don't create mono kernel, embeded data files can be usefully. For
> example, moddep.lst, fs.lst and command.lst, these files are best placed in
> core.img. Also, we can check the presence of embeded grub.cfg before loading
> external one, this is similar to the preset menu concept in GRUB Legacy.
The problem with a too big core.img is that it won't fit in the first
cylinder. So we need to think carefully about what should go in there
and what shouldn't.
But making it possible to pack everything so it can be booted using
PXE or so sounds good. There was a feature for GRUB Legacy to add a
menu.lst at compile-time. But having something more generic and not
requiring a recompile is way better.
--
Marco
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Command extension suggestions
2007-06-14 11:50 ` Marco Gerards
@ 2007-06-14 13:08 ` Bean
2007-06-14 13:48 ` Marco Gerards
0 siblings, 1 reply; 10+ messages in thread
From: Bean @ 2007-06-14 13:08 UTC (permalink / raw)
To: The development of GRUB 2
On Thu, Jun 14, 2007 at 01:50:38PM +0200, Marco Gerards wrote:
> Bean <bean123@126.com> writes:
>
> > On Thu, Jun 14, 2007 at 12:49:26PM +0200, Marco Gerards wrote:
> >> Well, I see the problem but I do not agree with the solution.
> >>
> >> The problem for GRUB 2 is that initrd is very linux specific. It's
> >> part of a loader. Perhaps we either have to extend loopback to load a
> >> file into memory on beforehand. Or add a memdisk disk or so.
> >>
> >> One problem with initrd is that it is very architecture specific.
> >> Another problem is that the initrd is unloaded when you load another
> >> kernel or OS. Besides that, reusing initrd appears hackish to me :-).
> >
> > I have another idea on this subject. First, We can extend the function of
> > grub-mkimage so that it can handle data files. The data files embed in
> > core.img can be accessed using a special device such as (ed). Then, we can
> > put all necessary files, such as modules, grub.cfg and other data files in
> > a single core.img. This kernel is self-sustaining, no extra file is needed
> > for it to function properly.
>
> This sounds good. In what way do you want to embed them? A
> filesystem image (for example minixfs)? Some simple archive?
We can embed them the same way we embed modules. Just add a header:
SIGNATURE
FILENAME
DATA
SIGNATURE is used to distinguish data file from normal module, FILENAME is
used by the virtual device to identify the data.
--
Bean <bean123@126.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Command extension suggestions
2007-06-14 13:08 ` Bean
@ 2007-06-14 13:48 ` Marco Gerards
0 siblings, 0 replies; 10+ messages in thread
From: Marco Gerards @ 2007-06-14 13:48 UTC (permalink / raw)
To: The development of GRUB 2
Bean <bean123@126.com> writes:
> On Thu, Jun 14, 2007 at 01:50:38PM +0200, Marco Gerards wrote:
>> Bean <bean123@126.com> writes:
>>
>> > On Thu, Jun 14, 2007 at 12:49:26PM +0200, Marco Gerards wrote:
>> >> Well, I see the problem but I do not agree with the solution.
>> >>
>> >> The problem for GRUB 2 is that initrd is very linux specific. It's
>> >> part of a loader. Perhaps we either have to extend loopback to load a
>> >> file into memory on beforehand. Or add a memdisk disk or so.
>> >>
>> >> One problem with initrd is that it is very architecture specific.
>> >> Another problem is that the initrd is unloaded when you load another
>> >> kernel or OS. Besides that, reusing initrd appears hackish to me :-).
>> >
>> > I have another idea on this subject. First, We can extend the function of
>> > grub-mkimage so that it can handle data files. The data files embed in
>> > core.img can be accessed using a special device such as (ed). Then, we can
>> > put all necessary files, such as modules, grub.cfg and other data files in
>> > a single core.img. This kernel is self-sustaining, no extra file is needed
>> > for it to function properly.
>>
>> This sounds good. In what way do you want to embed them? A
>> filesystem image (for example minixfs)? Some simple archive?
>
> We can embed them the same way we embed modules. Just add a header:
>
> SIGNATURE
> FILENAME
> DATA
>
> SIGNATURE is used to distinguish data file from normal module, FILENAME is
> used by the virtual device to identify the data.
I will commit a patch soon that adds support for a dummy disk driver.
In that case we just have to add a filesystem which offers access to
this embedded data. I think this can even be done without changing
the kernel a lot and adding this support in a module :-).
I would welcome such patch :-)
--
Marco
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-06-14 13:42 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-14 3:46 Command extension suggestions Bean
2007-06-14 6:08 ` Robert Millan
2007-06-14 6:24 ` Bean
2007-06-14 9:42 ` Marco Gerards
2007-06-14 10:24 ` Bean
2007-06-14 10:49 ` Marco Gerards
2007-06-14 11:31 ` Bean
2007-06-14 11:50 ` Marco Gerards
2007-06-14 13:08 ` Bean
2007-06-14 13:48 ` Marco Gerards
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.