NTFS file system driver for grub2
百 万 同 时 在 线,人 山 人 海 同 玩 梦 幻 西 游 ntfs.c.gz Description: application/gzip-compressed ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
map command for grub2 draft
I want to implement the map command for grub2 as long as it is an interesting thing for stupid windows oses and because it's the clue for making an "usbshift" equivalent command (See Super Grub Disk usbshift command for more details). 1st) Where to save an array? = If I mimic the grub legacy map command I need to save an array with the map definitions. static unsigned short bios_drive_map[DRIVE_MAP_SIZE + 1]; So that each time I call something like: map (hd0) (hd1) it modifies this vector. Any example on where should I define this vector so that I can use it from each command ? 2nd) boot_func and actual mapping If you look at grub legacy boot command case KERNEL_TYPE_CHAINLOADER: /* Chainloader */ /* Check if we should set the int13 handler. */ if (bios_drive_map[0] != 0) { int i; /* Search for SAVED_DRIVE. */ for (i = 0; i < DRIVE_MAP_SIZE; i++) { if (! bios_drive_map[i]) break; else if ((bios_drive_map[i] & 0xFF) == saved_drive) { /* Exchage SAVED_DRIVE with the mapped drive. */ saved_drive = (bios_drive_map[i] >> 8) & 0xFF; break; } } /* Set the handler. This is somewhat dangerous. */ set_int13_handler (bios_drive_map); } gateA20 (0); boot_drive = saved_drive; chain_stage1 (0, BOOTSEC_LOCATION, boot_part_addr); break; you will see that among other things it detects if you want to do a chainloader boot. If you do a chainloader boot it checks the bios_drive_map array,... run some BIOS calls so that there's an actual map and then it finally boots. When I told marco_g that I want to modificy grub2's boot command he became scared because the boot command was arquitecture specific (or maybe not, I actually did not understood what he meant) and as long as I understood I was not meant to modify it. how should I implement this then? adrian15 ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
grub2 miscelanea questions #2
1) search command file not found: = If you search for an inexistant file like: search -f /boot/grub/und-video it complains: error: no such device Shouldn't it be: error: no such file /boot/grub/und-video I mean it has to talk about files not devices and it has also to prompt the file you have searched for... or maybe not, I do not know. I ask marco_g if I am going to be able to use this command inside an if statement. if `search -f /boot/grub/grub2.cfg` then 2) chainload a device It seems that if I run: chainloader (hd0)+1 boot It boots my hard disk installed bootloader. However chainloader help only prompts: chainloader [-f] FILE I think the help should be: chainloader [-f] FILE|DEVICE 3) DEVICE vs DEVICENAME If you check the loopback command help you will see that you can use a DEVICENAME as an argument. Should we choose DEVICE or DEVICENAME when talking about a DEVICE ? 4) About linux command I do not like the linux command too much. What happens with bsd and other kernels that are not multiboot? why don't we have something as: kernel --type linux whatever kernel --type bsd whateverelse ? Or maybe is better to have a bsd command or bsd will become at last a multiboot os? 5) windows command === Can we add a windows command that does: chainloader (hd0,0)+1 boot A question for marco_g... which it is the best way so that a command can call other commands? Using grub_cmd_name where name is the name of the command or can I write a grub.cfg file on the fly and then send it to some cfg interpreter function? 6) boot command boots also boot loaders = If we can use chainloader for preparing to boot another boot loader... then boot help should read: Boot an operating system or another boot loader. instead of: Boot an operating system. adrian15 ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: Grub Loading Linux? kernel
On Wed, Jun 06, 2007 at 08:04:43PM +0200, adrian15 wrote: > When you boot Grub... it prompts something like: > > Grub loading kernel > > then you see: > > Welcome to GRUB. > > and then you see the prompt. > > Let's see an irc conversation of the future. > > noob> Hey My Grub loads the linux kernel but then nothing happens. > master> noob, if Grub loads the linux kernel then if it does not boot > it's usually a linux kernel problem not a grub one. > noob> What should I do then? > master> Go to #linux channel and ask there please. I think this is just another variant of the same "Linux" / "kernel" confusion that makes users think of Linux as the whole OS. This is confusing and contradictory, and this confusion is exposed in other areas. For example, because Linux "is" the whole OS, they can't use "Linux" to refer to the real Linux (i.e. the kernel), so they call it "Kernel". That is also contradictory, and the confusion spreads again. Now if you say "kernel", it turns out you must be talking about Linux! I don't think that GRUB nomenclature should be modelled around this scheme that is based on misconceptions. Rather, precisely because GRUB exposes these contradictions, this should encourage other people to realise about them. OTOH, if you replace: "GRUB loading kernel" with: "Loading GRUB kernel" Maybe this archieves to resolve both concerns? -- Robert Millan My spam trap is [EMAIL PROTECTED] Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list. ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
pager (Re: grub2 miscelanea questions (1/2))
On Tue, Jun 05, 2007 at 08:26:35PM +0200, Marco Gerards wrote: > > 5.1) pager > > - > > > > When I want to do a big ls the output does not stop screen by screen... > > Is there any hidden pager that I do not know? > > Maybe is not implemented yet? > > set pager=1 > > It just isn't documented :-/ How come it isn't default? Is there any drawback to this? -- Robert Millan My spam trap is [EMAIL PROTECTED] Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list. ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: grub2 miscelanea questions (1/2)
On Sat, Jun 09, 2007 at 09:34:55AM +0200, adrian15 wrote: > 6) Compulsory Argument dilemma > > If I run help I can seen things like this: > > ls [-f|-l|-s] NAME > > and > > [ EXPRESSION ] > > > If [ ] means optional it should also mean optional in the case of the > test alias [ .!!! Yes, this is inconsistent, but both bracket sets come from very stablished usage (the [ command at least is ancient). Also, this inconsistency is not specific to GRUB, and cannot be fixed without adding another (IMHO worse) inconsistency, which is not being analogous to the GNU command-line environment. -- Robert Millan My spam trap is [EMAIL PROTECTED] Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list. ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
boot on amd64
Hello all, I 'm building a (non linux) kernel natively on i386 and on amd64. My linker script defines the first section to be one called 'boot'. This is where i put multiboot headers so that they are within the first 8 bytes of the kernel image. Grub2 succesfully retrieves the headers from the i386 build but not from the amd64 build. On amd64, i use the additional gcc flags '-mcmodel=kernel -mno-red-zone'. Grub2 complaints that 'no multiboot headers found'. This is very interesting because they are found when booting an i386 image. What can possibly confuse grub2 on amd64?? Thanks, Constantine This is the beginning of my boot.S: .section .boot, "ax" ENTRY(start) jmp realstart /* * Multiboot header. */ .align 4 .long MULTIBOOT_MAGIC_OS /* 0x2badb002 */ .long MULTIBOOT_FLAGS /* 0x0 */ .long -(MULTIBOOT_FLAGS + MULTIBOOT_MAGIC_OS) realstart: ... Here's my linker script for amd64. The same linker script is used on i386 with a different kernel_offset. start_offset = 0x10; kernel_offset = 0x8000; real_start = start - kernel_offset; boot_stack_size = 4096; ENTRY(real_start) SECTIONS { . = (start_offset + kernel_offset); .boot ALIGN(4096) : AT(ADDR(.boot) - kernel_offset) { _boot = .; *(.boot) _eboot = .; } .bootdata ALIGN(4) : AT(ADDR(.bootdata) - kernel_offset) { _bootdata = .; *(.bootdata) _ebootdata = .; } .bootstack ALIGN(4096) : AT(ADDR(.bootstack) - kernel_offset) { _bootstack = .; . += boot_stack_size; _ebootstack = .; } .text ALIGN(4096) : AT(ADDR(.text) - kernel_offset) { _text = .; *(.text) _etext = .; } .rodata ALIGN(4) : AT(ADDR(.rodata) - kernel_offset) { _rodata = .; *(.rodata) _erodata = .; } .data ALIGN(4096) : AT(ADDR(.data) - kernel_offset) { _data = .; *(.data) _edata = .; } .bss ALIGN(4) : AT(ADDR(.bss) - kernel_offset) { _bss = .; *(.bss) _ebss = .; } _end = .; } ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: grub2 miscelanea questions (2/2)
On Sat, Jun 09, 2007 at 09:35:10AM +0200, adrian15 wrote: > 23) set read only variables > == > unset prefix lets me "delete" the prefix variable. > unset root does not let me the "root" variable. > > I remember that bash has an option to set read only variables. > Maybe the root variable is a read only variable? I have manually overriden both of these some times. It's useful for debugging (i.e. not completely breaking your system when prefix wasn't set properly). -- Robert Millan My spam trap is [EMAIL PROTECTED] Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list. ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: GSoC: CD-ROM booting options
On 05/06/07, adrian15 <[EMAIL PROTECTED]> wrote: GRUB 2 needs to support both cases, but I prefer to see something not present in GRUB Legacy implemented in GRUB 2 first. Good point... In any case there's some commonality between the two cases and for now I'm working to see if I can read some ElTorito data structures from a bootable CD... Which brings me to the question: Is it possible to call int 13h functions from a GRUB2 module? If yes, what is the (preferred?) way to do it? Thanks in advance! -- Alex Roman <[EMAIL PROTECTED]> ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
grub-mkrescue: Make GRUB rescue image
I'm attaching a small utility to generate a floppy or cdrom (based on floppy emulation) rescue image, that takes all the hassle of generating the image and doesn't need root permissions. If nobody objects, I'd like to put this in CVS. -- Robert Millan My spam trap is [EMAIL PROTECTED] Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list. Binary files grub2-1.95+20070604.old/- and grub2-1.95+20070604/- differ diff -x i386-pc.mk -Nur grub2-1.95+20070604.old/conf/i386-pc.rmk grub2-1.95+20070604/conf/i386-pc.rmk --- grub2-1.95+20070604.old/conf/i386-pc.rmk 2007-06-04 21:48:53.0 +0200 +++ grub2-1.95+20070604/conf/i386-pc.rmk 2007-06-07 21:34:46.0 +0200 @@ -114,10 +114,19 @@ # Scripts. sbin_SCRIPTS = grub-install +bin_SCRIPTS = grub-mkrescue # For grub-install. grub_install_SOURCES = util/i386/pc/grub-install.in +# For grub-mkrescue. +grub_mkrescue_SOURCES = util/i386/pc/grub-mkrescue.in +CLEANFILES += grub-mkrescue + +grub-mkrescue: util/i386/pc/grub-mkrescue.in config.status + ./config.status --file=grub-mkrescue:util/i386/pc/grub-mkrescue.in + chmod +x $@ + # Modules. pkgdata_MODULES = _chain.mod _linux.mod linux.mod normal.mod \ _multiboot.mod chain.mod multiboot.mod reboot.mod halt.mod \ diff -x i386-pc.mk -Nur grub2-1.95+20070604.old/Makefile.in grub2-1.95+20070604/Makefile.in --- grub2-1.95+20070604.old/Makefile.in 2007-05-20 11:10:06.0 +0200 +++ grub2-1.95+20070604/Makefile.in 2007-06-07 21:36:42.0 +0200 @@ -88,7 +88,7 @@ DATA = $(pkgdata_IMAGES) $(pkgdata_MODULES) $(pkgdata_PROGRAMS) \ $(pkgdata_DATA) $(lib_DATA) PROGRAMS = $(bin_UTILITIES) $(sbin_UTILITIES) -SCRIPTS = $(sbin_SCRIPTS) $(update-grub_SCRIPTS) +SCRIPTS = $(bin_SCRIPTS) $(sbin_SCRIPTS) $(update-grub_SCRIPTS) CLEANFILES = MOSTLYCLEANFILES = @@ -149,6 +149,11 @@ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ $(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \ done + @list='$(bin_SCRIPTS)'; for file in $$list; do \ + if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ + dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ + $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \ + done @list='$(sbin_SCRIPTS)'; for file in $$list; do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ @@ -182,7 +187,7 @@ dest="`echo $$file | sed 's,.*/,,'`"; \ rm -f $(DESTDIR)$(pkglibdir)/$$dest; \ done - @list='$(bin_UTILITIES)'; for file in $$list; do \ + @list='$(bin_UTILITIES) $(bin_SCRIPTS)'; for file in $$list; do \ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ rm -f $(DESTDIR)$(bindir)/$$dest; \ done Binary files grub2-1.95+20070604.old/tmp/floppy and grub2-1.95+20070604/tmp/floppy differ diff -x i386-pc.mk -Nur grub2-1.95+20070604.old/util/i386/pc/grub-mkrescue.in grub2-1.95+20070604/util/i386/pc/grub-mkrescue.in --- grub2-1.95+20070604.old/util/i386/pc/grub-mkrescue.in 1970-01-01 01:00:00.0 +0100 +++ grub2-1.95+20070604/util/i386/pc/grub-mkrescue.in 2007-06-07 21:41:22.0 +0200 @@ -0,0 +1,119 @@ +#! /bin/sh + +# Make GRUB rescue image +# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St - Suite 330, Boston, MA 02110, USA. + +# Initialize some variables. +transform="@program_transform_name@" + [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ +pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}` + +grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}` + +# Usage: usage +# Print the usage. +usage () { +cat <. +EOF +} + +image_type=cdrom + +# Check the arguments. +for option in "$@"; do +case "$option" in +-h | --help) + usage + exit 0 ;; +-v | --version) + echo "grub-install (GNU GRUB ${PACKAGE_VERSION})" + exit 0 ;; +--modules=*) + modules=`echo "$option" | sed 's/--modules=//'` ;; +--grub-mkimage=*) + grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; +--image-type=*) + image_type=`echo "$option" | sed 's/--image-type=//'` +case "$image_t
Re: NTFS file system driver for grub2
Really nice! I tested it on filesystems from win2k, winxp and vista, and works fine for listing directories and reading small files. On Thu, Jun 07, 2007 at 08:30:07PM +0800, [EMAIL PROTECTED] wrote: > > 百 万 同 时 在 线,人 山 人 海 同 玩 梦 幻 西 游 My font can't display this.. is it Chinese? -- Robert Millan My spam trap is [EMAIL PROTECTED] Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list. ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: GSoC: CD-ROM booting options
Alex Roman wrote: > On 05/06/07, adrian15 <[EMAIL PROTECTED]> wrote: >> GRUB 2 needs to support both cases, but I prefer to see something not >> present in GRUB Legacy implemented in GRUB 2 first. > > Good point... In any case there's some commonality between the two > cases and for now I'm working to see if I can read some ElTorito data > structures from a bootable CD... Which brings me to the question: > > Is it possible to call int 13h functions from a GRUB2 module? If yes, > what is the (preferred?) way to do it? You need to add new kernel thunk(s) to grub2/kern/i386/pc/startup.S and then make them jump to 16b real mode and then return back to protected mode. There are lots of examples in that file. Then make proper include file for your calls (most likely you can add it to existing one in this include file grub2/include/grub/i386/pc/biosdisk.h). I would suggest to make testing command that accesses those kernel thunks. This way it is easier to test out those API calls. ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: Re: NTFS file system driver for grub2
在2007-06-08,"Robert Millan" <[EMAIL PROTECTED]> 写道: From: "Robert Millan" To: "The development of GRUB 2" Date: Fri, 8 Jun 2007 04:08:10 +0800 (CST) Subject: Re: NTFS file system driver for grub2 > > Really nice! I tested it on filesystems from win2k, winxp and vista, and > works > fine for listing directories and reading small files. > > On Thu, Jun 07, 2007 at 08:30:07PM +0800, [EMAIL PROTECTED] wrote: > > > > 百 万 同 时 在 线,人 山 人 海 同 玩 梦 幻 西 游 > > My font can't display this.. is it Chinese? > > -- > Robert Millan > > My spam trap is [EMAIL PROTECTED] Note: this address is only intended > for spam harvesters. Writing to it will get you added to my black list. > > > ___ > 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: NTFS file system driver for grub2
fix a small bug, also implement the label function. ntfs.c.gz Description: Binary data ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Alternative booting method for grub2
It's possible to boot grub2 using the grub4dos boot loader. 1. create a kernel: grub-mkimage -d . -o core.img pc fat ntfs make sure you include the necessary file system driver. 2. add a header to core.img. cat g2hdr.bin core.img > g2ldr g2hdr.bin can be found in the grubutil package. 3. copy g2ldr to the root directory of any FAT/NTFS/EXT2 partition, and extra modules to /boot/grub/ in the same partition. 4. install the grub4dos boot loader. You need grubinst, which can be downloaded at: http://download.gna.org/grubutil/ The latest build is grubutil-1.1-bin-w32-15.zip. 1) Boot using the Windows NT boot manager Generate boot file with grubinst: grubinst -2 -o C:\g2ldr.mbr Then add a line to boot.ini: C:\g2ldr.mbr="GRUB2" This is the safest method, no modification to MBR or boot sector is required. 2) Install to MBR grubinst -2 --save=mbr.sav (hd0) Be careful, backup important data before install to MBR. 3) Install to boot sector grubinst -2 --save=bs.sav (hd0,0) or grubinst -2 --save=bs.sav -p=0 (hd0) Be careful, backup important data before install to boot sector. Currently, grub4dos boot loader support FAT, NTFS and EXT2. The advantage of using grub4dos boot loader is that the location of g2ldr is calculated at boot time, this means you can move it without causing problem. ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: GSoC: CD-ROM booting options
That's what I plan on doing... I want to write a module that for now just allows me to test various int 13h calls, look at their return values and get a general idea of how things work. Thanks for the idea Vesa! Cheers! On 07/06/07, Vesa Jääskeläinen <[EMAIL PROTECTED]> wrote: Alex Roman wrote: > On 05/06/07, adrian15 <[EMAIL PROTECTED]> wrote: >> GRUB 2 needs to support both cases, but I prefer to see something not >> present in GRUB Legacy implemented in GRUB 2 first. > > Good point... In any case there's some commonality between the two > cases and for now I'm working to see if I can read some ElTorito data > structures from a bootable CD... Which brings me to the question: > > Is it possible to call int 13h functions from a GRUB2 module? If yes, > what is the (preferred?) way to do it? You need to add new kernel thunk(s) to grub2/kern/i386/pc/startup.S and then make them jump to 16b real mode and then return back to protected mode. There are lots of examples in that file. Then make proper include file for your calls (most likely you can add it to existing one in this include file grub2/include/grub/i386/pc/biosdisk.h). I would suggest to make testing command that accesses those kernel thunks. This way it is easier to test out those API calls. ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel -- Alex Roman <[EMAIL PROTECTED]> ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel