Skip to contentSkip to conversation

config file

DISCUSSION Yoshinori K. Okuji 6 participants 19 messages Jan 23, 2005 – Feb 4, 2005

lore
Share & tools
lore
#0 lore raw

I'd like to raise an issue about the config file.

In GRUB Legacy, the structure of menu.lst is ugly, because it has a strange state when interpretting it. The semantics is that commands are executed until the first "title" is encounterred. Afterwards, commands are only "remembered" as boot entries. I think it would be more straightforward if commands are always executed.

I'd like to redesign it in GRUB 2. One example is to write a boot entry like this:

entry "GNU/Hurd" {
root=(hd0,0)
multiboot /boot/gnumach
module /boot/serverboot
...
}

This idea is to make a boot entry a kind of shell function.

What do you think?

Okuji

#1 lore raw
Quoted 7 lines · Yoshinori K. Okuji

entry "GNU/Hurd" {
root=(hd0,0)
multiboot /boot/gnumach
module /boot/serverboot
...
}

Quoted 7 lines

This idea is to make a boot entry a kind of shell function.

What do you think?

I would like to integrate this with function handling in my scripting engine and use the syntax like register_menu_entry <name> { list; }
unregister_menu_entry <name>
and
clear_menu_entries
Let me please realise it as now I'm writing scripting and there is nearly no difference between functions and menu entries

#3 lore raw
In reply to Yoshinori K. Okuji
Quoted 9 lines · Yoshinori K. Okuji

In GRUB Legacy, the structure of menu.lst is ugly, because it has a strange state when interpretting it. The semantics is that commands are executed until the first "title" is encounterred. Afterwards, commands are only "remembered" as boot entries. I think it would be more straightforward if commands are always executed.

I'd like to redesign it in GRUB 2. One example is to write a boot entry like this:

Quoted 8 lines

entry "GNU/Hurd" {
root=(hd0,0)
multiboot /boot/gnumach
module /boot/serverboot
...
}

This idea is to make a boot entry a kind of shell function.

It looks nice to me. How you you want to add the commands that should be run before the menu is shown? Just the same as it is for GRUB Legacy?

Thanks,
Marco

#2 lore raw
In reply to Serbinenko Vladimir

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Serbinenko Vladimir wrote:
| Let me please realise it as now I'm writing scripting and there is | nearly no difference between functions and menu entries

Maybe menu entries could be "exported functions", like entry points in modules, which could call "private" entries which would automate some tasks and could be shared among entries.

Vincent Pelletier
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB88IjFEQoKRQyjtURAiHMAJ0f4og5Zh7in8ejxOcPGac4m5CFCACgiLxS ue7QpSYIuva0hS5Q/HBlaEA=
=gxBq
-----END PGP SIGNATURE-----

#4 lore raw
In reply to Marco Gerards
Quoted 3 lines · Marco Gerards

It looks nice to me. How you you want to add the commands that should be run before the menu is shown? Just the same as it is for GRUB Legacy?

They can be put in anywhere:

timeout=10

entry "foo" {
...
}

splashimage (hd0,0)/boot/image.png

entry "bar" {
...
}

This looks ugly, though.

Okuji

#10 lore raw
In reply to Yoshinori K. Okuji
Quoted 9 lines · Yoshinori K. Okuji

I'd like to redesign it in GRUB 2. One example is to write a boot entry like this:

entry "GNU/Hurd" {
root=(hd0,0)
multiboot /boot/gnumach
module /boot/serverboot
...
}

Quoted 3 lines

This idea is to make a boot entry a kind of shell function.

What do you think?

I think it is good. Here is my idea how configuration files could be used to define menus:

splashimage (hd0,0)/boot/mainmenu.png

entry "Entry in main menu" {
...
}

entry "Load another config and execute it" {
loadconfig (hd0,0)/boot/custom-config
}

menu "Linux kernels" {
	splashimage (hd0,0)/boot/linuxmenu.png

	entry "2.4 series" {
	...
	}
	entry "2.6 series" {
	...
	}

	menu "Network boot kernels" {
	...
	}
}
menu "Other devices" {
	splashimage (hd0,0)/boot/devicemenu.png

	entry "Boot from Floppy" {
	...
	}
	entry "Boot from CD/DVD" {
	...
	}

	menuback "Back to mainmenu"
}

When someone enters to menu item it will execute commands specified there. Like loading a new splashimage or constructing new menu.

btw. is anyone working with that VESA support? :)... Last time there were couple of people that stated that they would work on it so as I had limited time then I didn't start.

I might be interested working on other GFX topics too.

Thanks,
Vesa Jääskeläinen

#5 lore raw
In reply to Yoshinori K. Okuji

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yoshinori K. Okuji wrote:
| This looks ugly, though.

What about a special block ?

entry "foo" {
~ ...
}

init {
~ timeout=10
~ splashimage (hd0,0)/boot/image.png
}

entry "bar" {
~ ...
}

Vincent Pelletier
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB89C2FEQoKRQyjtURAnnmAJ9aGxV3qpPeJ25rc3uLbBWu4fYfUwCgrgfI IL3+8XjfmZKPrwkEec/RdHI=
=TCM3
-----END PGP SIGNATURE-----

#6 lore raw
Quoted 14 lines · Vincent Pelletier

What about a special block ?

entry "foo" {
~ ...
}

init {
~ timeout=10
~ splashimage (hd0,0)/boot/image.png
}

Bad idea. Because in syntax proposed by Yoshinori K. Okuji configuration file is parsed the same way as you would enter the same commands from shell that is our goal

#11 lore raw
In reply to chaac
Quoted 3 lines · chaac

btw. is anyone working with that VESA support? :)... Last time there were couple of people that stated that they would work on it so as I had limited time then I didn't start.

I planned working on it, but feel free to work on it. Please tell me if you do so.

Quoted 1 line

I might be interested working on other GFX topics too.

What do you have in mind?

Thanks,
Marco

#14 lore raw
In reply to chaac

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

chaac wrote:
| menuback "Back to mainmenu"

Maybe that could be handled automaticaly (on each menu, add an entry to go to the previous menu level) as we have a "nested" arg in menu functions to know wether we are on root level or not.

Vincent Pelletier
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB89b6FEQoKRQyjtURAjIwAKC3n5k1/xXFn7XWLifgn8z3KrrsGQCfcI6j 7Rpeu5zFeIwYL9nhZEfdkOs=
=8nKO
-----END PGP SIGNATURE-----

#15 lore raw
Quoted 6 lines · Vincent Pelletier

chaac wrote:
| menuback "Back to mainmenu"

Maybe that could be handled automaticaly (on each menu, add an entry to go to the previous menu level) as we have a "nested" arg in menu functions to know wether we are on root level or not.

On GRUB Legacy I just used configfile to get nested menus.

--
Marco

#16 lore raw
In reply to Vincent Pelletier
Quoted 3 lines · Vincent Pelletier

Maybe that could be handled automaticaly (on each menu, add an entry to go to the previous menu level) as we have a "nested" arg in menu functions to know wether we are on root level or not.

However, I don't think you use it, because pressing ESC is easier.

Okuji

#12 lore raw
In reply to Marco Gerards
Quoted 6 lines · Marco Gerards
Quoted 3 lines · chaac

btw. is anyone working with that VESA support? :)... Last time there were couple of people that stated that they would work on it so as I had limited time then I didn't start.

Quoted 6 lines

I planned working on it, but feel free to work on it. Please tell me if you do so.

Quoted 1 line

I might be interested working on other GFX topics too.

What do you have in mind?

I haven't checked recently a code base, but better Unicode font support would be a nice idea. Maybe to add some kind of eye candy when processing or waiting something. If you look at SuSE's modified version of GRUB-legacy there are some animations on it and some menus to select language and help. In help there are some sub help pages with selectable links.

Thanks,
Vesa Jääskeläinen

#13 lore raw
Quoted 9 lines · chaac
Quoted 2 lines
Quoted 1 line

I might be interested working on other GFX topics too.

What do you have in mind?

I haven't checked recently a code base, but better Unicode font support would be a nice idea. Maybe to add some kind of eye candy when processing or waiting something. If you look at SuSE's modified version of GRUB-legacy there are some animations on it and some menus to select language and help. In help there are some sub help pages with selectable links.

Such things will be neat, of course. There is font support in GRUB 2, I think it is unicode capable already, you could have a look at it.

Thanks,
Marco

#7 lore raw

menu variable

In reply to Serbinenko Vladimir

I have already written function and menu entries parsing an found out that passing menu as a parameter was a bad idea. Some examples: if I call other script from config file with source command it can't add menu entries anymore as command_script as any grub command doesn't receive menu as a parameter. Yes I can make separate handling of source command but I think it's ugly. Can I declare menu variable as global one?

#8 lore raw

Re: menu variable

Quoted 1 line · Serbinenko Vladimir

Can I declare menu variable as global one?

No problem.

Okuji

#9 lore raw

Re: menu variable

Quoted 4 lines · Yoshinori K. Okuji
Quoted 1 line · Serbinenko Vladimir

Can I declare menu variable as global one?

No problem.

BTW, even if you make it global, please use a local variable or a function argument whenever possible. This makes the code modular.

Okuji

#17 lore raw
In reply to Yoshinori K. Okuji

Yoshinori K. Okuji [Sun, Jan 23, 2005 at 03:28:59PM +0100]:

Quoted 10 lines

[...]
I'd like to redesign it in GRUB 2. One example is to write a boot entry like this:

entry "GNU/Hurd" {
root=(hd0,0)
multiboot /boot/gnumach
module /boot/serverboot
...
}

Why re-invent the wheel?
I would propose the ini-samba-style:

----------------------------------------------------------------------

[global]

timeout = 10
hd0 = /dev/hda

[Linux 2.6]
root =
kernel = (hd0)/usr/src/linux/vmlinuz
kernel_args = root=/dev/hda12
password = my-sha1-hash

----------------------------------------------------------------------

Nico

Signature · 3 lines
Keep it simple & stupid, use what's available.
Please use pgp encryption: 8D0E 27A4 is my id.
http://nico.schotteli.us | http://linux.schottelius.org
#18 lore raw
Quoted 5 lines · Nico -telmich- Schottelius

---------------------------------------------------------------------
-

[global]

Quoted 9 lines

timeout = 10
hd0 = /dev/hda

[Linux 2.6]
root =
kernel = (hd0)/usr/src/linux/vmlinuz
kernel_args = root=/dev/hda12
password = my-sha1-hash

Quite incompatible against the shell syntax.

Okuji