Re: Bug#586358: grub-pc: Please handle DOS line endings in "cat"
On Fri, Jun 18, 2010 at 11:34:08AM -0700, Josh Triplett wrote: > The "cat" command, if given a file with DOS line endings, will show the > \r at the end of every line as a control character. For convenience, > please consider adding support for this in "cat", ideally automatically. Makes sense to me. grub-devel, how about this patch? 2010-06-20 Colin Watson * commands/cat.c (grub_cmd_cat): Print DOS "\r\n" line endings as simple newlines. === modified file 'commands/cat.c' --- commands/cat.c 2010-03-01 19:24:34 + +++ commands/cat.c 2010-06-20 22:11:37 + @@ -54,6 +54,11 @@ grub_cmd_cat (grub_command_t cmd __attri if ((grub_isprint (c) || grub_isspace (c)) && c != '\r') grub_putchar (c); + else if (c == '\r' && buf[i + 1] == '\n') + { + grub_putchar ('\n'); + i++; + } else { grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); Thanks, -- Colin Watson [cjwat...@ubuntu.com] ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: [Patch] Simple USB hub support
On Sun, Jun 20, 2010 at 4:21 AM, Aleš Nesrsta wrote: > Hi, > > included patch should make USB hubs operational. > > It works in the same simple way as whole GRUB2 USB support, i.e. USB hub > and device must be connected to computer BEFORE uhci/ohci module is > loaded. > > Note (mainly for Vladimir): > Via hub are normally working also devices which I reported to be not > functional on UHCI. So, from my point of view it looks like there is > surely some problem in powering of UHCI root hubs on my computer. But I > still don't know why only some devices are sensitive to this problem > (all of them are not big consumers of power). When connected via USB-HS hub, even low-speed and full-speed devices enumerate under the EHCI, not UHCI. So it's not surprising that the behavior changes and the devices start working. Can you verify the speed of the devices in question, and that the hub is USB 2.0 high-speed? > > Best regards > Ales > > > ___ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel > > ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: Changes needed in grub-mkimage for UEFI
Thanks. A blank prefix parameter fixed the problem. > On the contrary. Now we use the same defaults on all platforms which > simplifies maintaining and packaging. To get old behaviour add > -p "" > to grub-mkimage line What about this request? Is this feasible? >> I have one more feature request :- >> >> Is it possible to specify which config file should be read by grub >> instead of a hard-coded grub.cfg ? For example :- If I have a > SYSTEM PARTITION>/efi/grub2/ folder with grub1.efi grub2.efi grub3.efi >> (each having different set of modules with normal and other basic >> modules included) etc., and I have grub.cfg grub5.cfg grub4.cfg, I >> want grub1.efi to use grub.cfg, grub2.efi to use grub5.cfg and >> grub3.efi to use grub4.cfg (the config file name can be user choice). >> One efi app should not load any other cfg file even if many cfg files >> are present in the prefix folder. >> >> I noticed an option of embedding a config file in grub-mkimage . >> Instead of embedding, I just want the generated image to load a >> different config file with a filename of my choice which can be >> specified as a parameter in grub-mkimage. Is this possible? This can >> also be an option for core.img of grub2 BIOS, but this option is more >> useful for UEFI where multiple grub efi apps can be created. >> >> Finally, just a matter of interest, what non-Apple UEFI (2.x spec, not >> 1.1 spec) systems do you guys use primarily for developing grub2 UEFI? >> Any Intel Motherboard or some UEFI based laptop (HP Elitebook or Sony >> Vaio) or USB based Tianocore EDK or EDK2 DUET (the firmware I use)? >> The only place where the config file name is hardcoded to be "grub.cfg" is (grub2-source)/normal/main.c config = grub_xasprintf ("%s/grub.cfg", prefix); (line 519) Can this be made as a grub-mkimage option instead of hardcoding or even embedding a config file in the generated image. Although it is possible to replace the filename in the mentioned line and compiled, I need something that can be defined while creating the grub2 boot image or the efi app. Regards ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: Grub-devel Digest, Vol 76, Issue 30
Thanks. A blank prefix parameter fixed the problem. > On the contrary. Now we use the same defaults on all platforms which > simplifies maintaining and packaging. To get old behaviour add > -p "" > to grub-mkimage line What about this request? Is this feasible? >> I have one more feature request :- >> >> Is it possible to specify which config file should be read by grub >> instead of a hard-coded grub.cfg ? For example :- If I have a > SYSTEM PARTITION>/efi/grub2/ folder with grub1.efi grub2.efi grub3.efi >> (each having different set of modules with normal and other basic >> modules included) etc., and I have grub.cfg grub5.cfg grub4.cfg, I >> want grub1.efi to use grub.cfg, grub2.efi to use grub5.cfg and >> grub3.efi to use grub4.cfg (the config file name can be user choice). >> One efi app should not load any other cfg file even if many cfg files >> are present in the prefix folder. >> >> I noticed an option of embedding a config file in grub-mkimage . >> Instead of embedding, I just want the generated image to load a >> different config file with a filename of my choice which can be >> specified as a parameter in grub-mkimage. Is this possible? This can >> also be an option for core.img of grub2 BIOS, but this option is more >> useful for UEFI where multiple grub efi apps can be created. >> >> Finally, just a matter of interest, what non-Apple UEFI (2.x spec, not >> 1.1 spec) systems do you guys use primarily for developing grub2 UEFI? >> Any Intel Motherboard or some UEFI based laptop (HP Elitebook or Sony >> Vaio) or USB based Tianocore EDK or EDK2 DUET (the firmware I use)? >> >> Regards. The only place where the config file name is hardcoded to be "grub.cfg" is (grub2-source)/normal/main.c config = grub_xasprintf ("%s/grub.cfg", prefix); (line 519) Can this be made as a grub-mkimage option instead of hardcoding or even embedding a config file in the generated image. Although it is possible to replace the filename in the mentioned line and compiled, I need something that can be defined while creating the grub2 boot image or the efi app. Regards ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
[Patch] USB UHCI portstatus correction
Hi, I found some mistake in uhci.c in grub_uhci_portstatus when enable=0. There is proposal of correction. Without correction portstatus reported false timeout when enable=0 because it is waiting for reset to be done but none is performed... Best regards Ales diff -urB ./usb/bus/usb/uhci.c ./usb_patched/bus/usb/uhci.c --- ./usb/bus/usb/uhci.c 2010-06-20 10:20:58.0 +0200 +++ ./usb_patched/bus/usb/uhci.c 2010-06-20 10:59:03.0 +0200 @@ -612,8 +612,23 @@ status = grub_uhci_readreg16 (u, reg); grub_dprintf ("uhci", "detect=0x%02x\n", status); + if (!enable) /* We don't need reset port */ +{ + /* Disable the port. */ + grub_uhci_writereg16 (u, reg, 0 << 2); + grub_dprintf ("uhci", "waiting for the port to be disabled\n"); + endtime = grub_get_time_ms () + 1000; + while ((grub_uhci_readreg16 (u, reg) & (1 << 2))) +if (grub_get_time_ms () > endtime) + return grub_error (GRUB_ERR_IO, "UHCI Timed out"); + + status = grub_uhci_readreg16 (u, reg); + grub_dprintf ("uhci", ">3detect=0x%02x\n", status); + return GRUB_ERR_NONE; +} + /* Reset the port. */ - grub_uhci_writereg16 (u, reg, enable << 9); + grub_uhci_writereg16 (u, reg, 1 << 9); /* Wait for the reset to complete. XXX: How long exactly? */ grub_millisleep (50); /* For root hub should be nominaly 50ms */ @@ -623,7 +638,7 @@ grub_millisleep (10); /* Enable the port. */ - grub_uhci_writereg16 (u, reg, enable << 2); + grub_uhci_writereg16 (u, reg, 1 << 2); grub_millisleep (10); grub_dprintf ("uhci", "waiting for the port to be enabled\n"); ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
[Patch] Simple USB hub support
Hi, included patch should make USB hubs operational. It works in the same simple way as whole GRUB2 USB support, i.e. USB hub and device must be connected to computer BEFORE uhci/ohci module is loaded. Note (mainly for Vladimir): Via hub are normally working also devices which I reported to be not functional on UHCI. So, from my point of view it looks like there is surely some problem in powering of UHCI root hubs on my computer. But I still don't know why only some devices are sensitive to this problem (all of them are not big consumers of power). Best regards Ales diff -urB ./usb/bus/usb/usbhub.c ./usb_patched/bus/usb/usbhub.c --- ./usb/bus/usb/usbhub.c 2010-06-20 10:20:58.0 +0200 +++ ./usb_patched/bus/usb/usbhub.c 2010-06-18 22:34:56.0 +0200 @@ -87,14 +87,47 @@ struct grub_usb_usb_hubdesc hubdesc; grub_err_t err; int i; + grub_uint64_t timeout; + grub_usb_device_t next_dev; + + err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN + | GRUB_USB_REQTYPE_CLASS + | GRUB_USB_REQTYPE_TARGET_DEV), + GRUB_USB_REQ_GET_DESCRIPTOR, + (GRUB_USB_DESCRIPTOR_HUB << 8) | 0, + 0, sizeof (hubdesc), (char *) &hubdesc); + if (err) +return err; + grub_dprintf ("usb", "Hub descriptor:\n\t\t len:%d, typ:0x%02x, cnt:%d, char:0x%02x, pwg:%d, curr:%d\n", +hubdesc.length, hubdesc.type, hubdesc.portcnt, +hubdesc.characteristics, hubdesc.pwdgood, +hubdesc.current); + + /* Activate the first configuration. Hubs should have only one conf. */ + grub_dprintf ("usb", "Hub set configuration\n"); + grub_usb_set_configuration (dev, 1); - grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN - | GRUB_USB_REQTYPE_CLASS - | GRUB_USB_REQTYPE_TARGET_DEV), - GRUB_USB_REQ_GET_DESCRIPTOR, - (GRUB_USB_DESCRIPTOR_HUB << 8) | 0, - 0, sizeof (hubdesc), (char *) &hubdesc); - + /* Power on all Hub ports. */ + for (i = 1; i <= hubdesc.portcnt; i++) +{ + grub_dprintf ("usb", "Power on - port %d\n", i); + /* Power on the port and wait for possible device connect */ + err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT + | GRUB_USB_REQTYPE_CLASS + | GRUB_USB_REQTYPE_TARGET_OTHER), + GRUB_USB_REQ_SET_FEATURE, + GRUB_USB_HUB_FEATURE_PORT_POWER, + i, 0, NULL); + /* Just ignore the device if some error happened */ + if (err) + continue; +} + /* Wait for port power-on */ + if (hubdesc.pwdgood >= 50) +grub_millisleep (hubdesc.pwdgood * 2); + else +grub_millisleep (100); + /* Iterate over the Hub ports. */ for (i = 1; i <= hubdesc.portcnt; i++) { @@ -104,9 +137,8 @@ err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN | GRUB_USB_REQTYPE_CLASS | GRUB_USB_REQTYPE_TARGET_OTHER), - GRUB_USB_REQ_HUB_GET_PORT_STATUS, + GRUB_USB_REQ_GET_STATUS, 0, i, sizeof (status), (char *) &status); - /* Just ignore the device if the Hub does not report the status. */ if (err) @@ -111,7 +143,8 @@ status. */ if (err) continue; - + grub_dprintf ("usb", "Hub port %d status: 0x%02x\n", i, status); + /* If connected, reset and enable the port. */ if (status & GRUB_USB_HUB_STATUS_CONNECTED) { @@ -128,21 +161,46 @@ speed = GRUB_USB_SPEED_FULL; } - /* A device is actually connected to this port, not enable - the port. XXX: Why 0x03? According to some docs it - should be 0x0. Check the specification! */ + /* A device is actually connected to this port. + * Now do reset of port. */ + grub_dprintf ("usb", "Reset hub port - port %d\n", i); err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT | GRUB_USB_REQTYPE_CLASS | GRUB_USB_REQTYPE_TARGET_OTHER), - 0x3, 0x4, i, 0, 0); - + GRUB_USB_REQ_SET_FEATURE, + GRUB_USB_HUB_FEATURE_PORT_RESET, + i, 0, 0); /* If the Hub does not cooperate for this port, just skip the port. */ if (err) continue; + /* Wait for reset procedure done */ + timeout = grub_get_time_ms () + 1000; + do +{ + /* Get the port status. */ + err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN + | GRUB_USB_REQTYPE_CLASS + | GRUB_USB_REQTYPE_TARGET_OTHER), + GRUB_USB_REQ_GET_STATUS, + 0, i, sizeof (status), (char *) &status); +} + while (!err && + !(status & GRUB_USB_HUB_STATUS_C_PORT_RESET) && + (grub_get_time_ms() < timeout) ); + if (err || !(status & GRUB_USB_HUB_STATUS_C_PORT_RESET) ) +continue; + /* Add the device and assign a device address to it. */ - grub_usb_hub_add_dev (&dev->controller, speed); + grub_dprintf ("usb", "Call hub_add_dev - port %d\n", i); + next_dev = grub_usb
Multiboot integration into the Linux kernel
Hi, I tried googling about this, but beside a patch (around 2005?) on lkml without a thread why it's not there I couldn't find much... What I'd like to a achieve is the possibility to override ACPI BIOS tables via boot loader and IMO the module loading as specified in the multiboot spec is perfect to do this. DSDT overriding via initrd existed (as a hack, never mainline), but DSDT parsing is done earlier in the boot process and it gets harder/impossible to do this with the current approach. With multiboot it should be possible to access files passed by the boot loader early and implementing the possibility to override arbitrary ACPI tables (also the more than a dozen static ones, e.g. SRAT, APIC, DMAR, ...) which are needed really early in the boot process for debugging purposes should be possible? Does there exist an out of tree multiboot Linux kernel project/repository I couldn't find with the aim to get things merged mainline at some point? What are the reasons/arguments multiboot does not exist in the Linux kernel? Thanks for any hint, Thomas ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel