Skip to contentSkip to conversation

Kernel 'vga=' parameter wierdness

DISCUSSION Asfand Yar Qazi 4 participants 11 messages Feb 22, 2006 – Feb 24, 2006

lore
Share & tools
lore
#0 lore raw

'Scuse my noobness, but when I supply the following parameter to the arguments
of my kernel through GRUB, I get an 'undefined mode' error:

vga=0164

But then, when the prompt comes up asking me which mode I want I type in:

0164

and I get the required mode!

What's happening? On 2.4 kernel, I used to boot with vga=0x0a (which is the same mode as 0164) and it would boot fine. Not anymore...

Help?

#1 lore raw
Quoted 10 lines · Asfand Yar Qazi

'Scuse my noobness, but when I supply the following parameter to the arguments
of my kernel through GRUB, I get an 'undefined mode' error:

vga=0164

But then, when the prompt comes up asking me which mode I want I type in:

0164

and I get the required mode!

vga parameter is not passed to kernel itself, it is parsed by bootloader. Previously, booploaders had bugs versus vga=NN specified in hex and/or octal. Try entering decimal value.

Quoted 2 lines

What's happening? On 2.4 kernel, I used to boot with vga=0x0a (which is the same mode as 0164) and it would boot fine. Not anymore...

0x0a != 0164, that's for sure
--
vda

#2 lore raw
Quoted 9 lines · Denis Vlasenko
Quoted 7 lines · Asfand Yar Qazi

'Scuse my noobness, but when I supply the following parameter to the arguments
of my kernel through GRUB, I get an 'undefined mode' error:

vga=0164

But then, when the prompt comes up asking me which mode I want I type in:

Quoted 8 lines
Quoted 3 lines

0164

and I get the required mode!

vga parameter is not passed to kernel itself, it is parsed by bootloader. Previously, booploaders had bugs versus vga=NN specified in hex and/or octal. Try entering decimal value.

OK, will try that. decimal of octal(0164) = decimal(116)

Quoted 9 lines
Quoted 3 lines

What's happening? On 2.4 kernel, I used to boot with vga=0x0a (which is the same mode as 0164) and it would boot fine. Not anymore...

0x0a != 0164, that's for sure
--
vda

OK, allow me to explain:

When the modes come up on screen, they are numbered (0, 1, 2, ... a, b, etc.)
This is what the 'a' refers to. Hey, it worked through LILO on 2.4 kernels.

Before I type in scan, the number for the 132x60 mode is actually 030C. After I've typed in 'scan', then it comes up as 0164. If I enter 0164 BEFORE I type in 'scan' at the vid mode, it still works. But not if I give it as argument to GRUB. As I said, will try giving decimal equivalent (116) as argument to GRUB.

#3 lore raw

Hello!

Quoted 1 line

OK, will try that. decimal of octal(0164) = decimal(116)

This won't work -- the mode numbers are hexadecimal, not octal. Use 356 (decimal).

Quoted 3 lines

When the modes come up on screen, they are numbered (0, 1, 2, ... a, b, etc.) This is what the 'a' refers to. Hey, it worked through LILO on 2.4
kernels.

Beware, these menu item numbers are _not_ meant to be stable across kernel upgrades. Better use the "long" mode numbers like 0164 or 030c.

Quoted 5 lines

Before I type in scan, the number for the 132x60 mode is actually 030C. After I've typed in 'scan', then it comes up as 0164. If I enter 0164 BEFORE I type in 'scan' at the vid mode, it still works. But not if I give it as argument to GRUB. As I said, will try giving decimal equivalent
(116) as argument to GRUB.

You can also try giving 0x164 to GRUB.

Have a nice fortnight

Signature · 3 lines
Martin `MJ' Mares   <[email protected]>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"Computers are useless. They can only give you answers."  -- Pablo Picasso
#4 lore raw
Quoted 8 lines · Martin Mares

Hello!

Quoted 1 line

OK, will try that. decimal of octal(0164) = decimal(116)

This won't work -- the mode numbers are hexadecimal, not octal. Use 356 (decimal).

You're right. I thought '0164' was octal - 0 prefix.

Quoted 7 lines
Quoted 3 lines

When the modes come up on screen, they are numbered (0, 1, 2, ... a, b, etc.) This is what the 'a' refers to. Hey, it worked through LILO on 2.4 kernels.

Beware, these menu item numbers are _not_ meant to be stable across kernel upgrades. Better use the "long" mode numbers like 0164 or 030c.

Yep, I realise that now :-)

Quoted 6 lines
Quoted 3 lines

Before I type in scan, the number for the 132x60 mode is actually 030C. After I've typed in 'scan', then it comes up as 0164. If I enter 0164 BEFORE I type in 'scan' at the vid mode, it still works. But not if I give it as argument to GRUB. As I said, will try giving decimal equivalent (116) as argument to GRUB.

You can also try giving 0x164 to GRUB.

I'll try that as well.

Quoted 2 lines

Have a nice fortnight

err... you too :-)

#5 lore raw
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

OK, will try that. decimal of octal(0164) = decimal(116)

This won't work -- the mode numbers are hexadecimal, not octal. Use 356 (decimal).

You're right. I thought '0164' was octal - 0 prefix.

Quite misleading. This should be fixed.

Jan Engelhardt

#6 lore raw

Hello!

Quoted 3 lines
Quoted 2 lines

You're right. I thought '0164' was octal - 0 prefix.

Quite misleading. This should be fixed.

What fix do you propose?

Have a nice fortnight

Signature · 3 lines
Martin `MJ' Mares   <[email protected]>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
Air conditioned environment -- Do not open Windows.
#7 lore raw
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

You're right. I thought '0164' was octal - 0 prefix.

Quite misleading. This should be fixed.

What fix do you propose?

That /^0[xX][0-9a-fA-F]+$/ is required to interpret $_ as a hexadecimal number, that /^0[0-7]+$/ is required to interpret it as an octal, and everything else for a normal decimal number.
IOW, using strtol(my_vga_string, NULL, 0) everywhere (GRUB, as well as the "vga selector" in the kernel).
And making sure the vga selector (i.e. when booting with vga=ask) always prefix numbers with 0x when they are supposed to be in hexadecimal, i.e. e.g.
for(i=0; ...)

      printf("%#x   %dx%d\n", i, vga_modes[i].width, vga_modes[i].height);
instead of currently
      printf("%x    %dx%d\n", ...)

Jan Engelhardt

#8 lore raw

Hello!

Quoted 9 lines

That /^0[xX][0-9a-fA-F]+$/ is required to interpret $_ as a hexadecimal number, that /^0[0-7]+$/ is required to interpret it as an octal, and everything else for a normal decimal number.
IOW, using strtol(my_vga_string, NULL, 0) everywhere (GRUB, as well as the "vga selector" in the kernel).
And making sure the vga selector (i.e. when booting with vga=ask) always prefix numbers with 0x when they are supposed to be in hexadecimal, i.e. e.g.
for(i=0; ...)

Quoted 3 lines
      printf("%#x   %dx%d\n", i, vga_modes[i].width, vga_modes[i].height);
instead of currently
      printf("%x    %dx%d\n", ...)

However, this would change meaning of numbers entered at the video mode prompt (with vga=ask), which doesn't look good.

Have a nice fortnight

Signature · 3 lines
Martin `MJ' Mares   <[email protected]>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
Uncle Ed's Rule of Thumb:  Never use your thumb for a rule.
#9 lore raw
Quoted 11 lines
Quoted 7 lines

And making sure the vga selector (i.e. when booting with vga=ask) always prefix numbers with 0x when they are supposed to be in hexadecimal, i.e. e.g.
for(i=0; ...)

      printf("%#x   %dx%d\n", i, vga_modes[i].width, vga_modes[i].height);
instead of currently
      printf("%x    %dx%d\n", ...)

However, this would change meaning of numbers entered at the video mode prompt (with vga=ask), which doesn't look good.

Add a warning ;-)

Jan Engelhardt

#10 lore raw
Quoted 4 lines
Quoted 3 lines

However, this would change meaning of numbers entered at the video mode prompt (with vga=ask), which doesn't look good.

Add a warning ;-)

Well, the same thing can be said about the vga= parameter in LILO and GRUB :-)

I think that the kernel documentation (svga.txt) is pretty clear and explicit on the meaning of the numbers and I don't see any reasons to change the behavior of the mode selector.

What IMHO needs updating is the documentation on the vga parameter in LILO and GRUB docs, which doesn't explain well what's going on.

Have a nice fortnight

Signature · 3 lines
Martin `MJ' Mares   <[email protected]>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"A semicolon. Another line ends in the dance of camel." -- Kabir Ahuja