Skip to contentSkip to conversation

make partition active

PATCH In review phcoder 4 participants 7 messages Feb 11, 2009 – Mar 4, 2009

lore
Share & tools
lore

phcoder

author
#0 lore raw

PATCH 1/1 make partition active

Here's the patch to add a replacement for old "makeactive" command New syntax is
activate PARTITION
E.g.
activate hd0,1

Regards
Vladimir 'phcoder' Serbinenko

ChangeLog +8 -0
Index: ChangeLog
===================================================================
@@ -1,3 +1,11 @@
+2009-02-11  Vladimir Serbinenko  <[email protected]>
+
+	New command: "activate" replacement for makeactive of grub1
+	
+	* commands/i386/pc/activate.c: new file
+	* conf/i386-pc.rmk: new module activate.mod
+	add commands/i386/pc/activate.c to grub-emu sources
+
 2009-02-11  Robert Millan  <[email protected]>
 
 	* util/grub.d/00_header.in: Update old reference to `font' command.
i386-pc.rmk +1 -1
Index: conf/i386-pc.rmk
===================================================================
@@ -145,4 +145,4 @@
 	\
 	disk/raid.c disk/raid5_recover.c disk/raid6_recover.c		\
 	disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c		\
-	grub_emu_init.c
+	grub_emu_init.c  commands/i386/pc/activate.c

grub_emu_LDFLAGS = $(LIBCURSES)

ifeq ($(enable_grub_emu_usb), yes)
@@ -171,3 +170,3 @@
vbe.mod vbetest.mod vbeinfo.mod play.mod serial.mod \
ata.mod vga.mod memdisk.mod pci.mod lspci.mod \

 	aout.mod _bsd.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
	datehook.mod lsmmap.mod \

- usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod
+ usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod activate.mod

+# For activate.mod.
+activate_mod_SOURCES = commands/i386/pc/activate.c +activate_mod_CFLAGS = $(COMMON_CFLAGS) +activate_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
# For biosdisk.mod.
biosdisk_mod_SOURCES = disk/i386/pc/biosdisk.c biosdisk_mod_CFLAGS = $(COMMON_CFLAGS)

i386/pc/activate.c +114 -0

114 lines not on this page · raw message

#1 lore raw
Quoted 5 lines · phcoder

Here's the patch to add a replacement for old "makeactive" command New syntax is
activate PARTITION
E.g.
activate hd0,1

Is it necessary to change the name? I think "makeactive" is a better name for what it does.

Maybe we could use a more generic solution, e.g. a command for setting different flags (or "attributes" in GPT terminology), such as bootable, read-only, hidden (that would apply only to some partition types in the PC partition table) and so on.

Signature · 2 lines
Regards,
Pavel Roskin
author
#2 lore raw
Quoted 9 lines · Pavel Roskin
Quoted 5 lines · phcoder

Here's the patch to add a replacement for old "makeactive" command New syntax is
activate PARTITION
E.g.
activate hd0,1

Is it necessary to change the name? I think "makeactive" is a better name for what it does.

Actually I don't really care but on http://grub.enbug.org/CommandList it was suggested to change the name. But what I dislike is having this command without argument which always activates current root partition

Quoted 5 lines

Maybe we could use a more generic solution, e.g. a command for setting different flags (or "attributes" in GPT terminology), such as bootable, read-only, hidden (that would apply only to some partition types in the PC partition table) and so on.

It's a good possibility but I don't want to encumber the partition module with non-essential functions since they're often integrated into core.img. But it's possible to have something like

pctool hd0,1 boot+ hidden-
gpttool hd0,1 ro+

(Actually I find the name "pc" unfortunate, IMO "fdisk" would be much better) It's also possible to write a wrapper
parttool hd0,1 boot+

Which chooses the correct tool and launches it (a tool can be easily registered as a pair of partition style name and a function). In this case we wouldn't even need separate command for different partition style. We have however to find a way to list all available flags in

help parttool

Regards
Vladimir 'phcoder' Serbinenko

#3 lore raw
Quoted 34 lines · phcoder
Quoted 11 lines · Pavel Roskin
Quoted 6 lines · phcoder

Here's the patch to add a replacement for old "makeactive" command New syntax is
activate PARTITION
E.g.
activate hd0,1

Is it necessary to change the name?  I think "makeactive" is a better name for what it does.

Actually I don't really care but on http://grub.enbug.org/CommandList it was suggested to change the name. But what I dislike is having this command without argument which always activates current root partition

Quoted 5 lines

Maybe we could use a more generic solution, e.g. a command for setting different flags (or "attributes" in GPT terminology), such as bootable, read-only, hidden (that would apply only to some partition types in the PC partition table) and so on.

It's a good possibility but I don't want to encumber the partition module with non-essential functions since they're often integrated into core.img. But it's possible to have something like

pctool hd0,1 boot+ hidden-
gpttool hd0,1 ro+

(Actually I find the name "pc" unfortunate, IMO "fdisk" would be much better)
It's also possible to write a wrapper
parttool hd0,1 boot+

Quoted 6 lines

Which chooses the correct tool and launches it (a tool can be easily registered as a pair of partition style name and a function). In this case we wouldn't even need separate command for different partition style. We have however to find a way to list all available flags in

help parttool

Hi,

The patch looks fine to me, except for perhaps the name. activate doesn't seems to suggest its function. Frankly, makeactive doesn't make much sense as well, but at least it's already widely used in grub legacy, old user could easily guess its function by name.

Signature · 1 line
Bean
author
#4 lore raw

Hello

Quoted 8 lines
Quoted 8 lines

It's also possible to write a wrapper
parttool hd0,1 boot+

Which chooses the correct tool and launches it (a tool can be easily registered as a pair of partition style name and a function). In this case we wouldn't even need separate command for different partition style. We have however to find a way to list all available flags in

Quoted 9 lines
Quoted 1 line

help parttool

Hi,

The patch looks fine to me, except for perhaps the name. activate doesn't seems to suggest its function. Frankly, makeactive doesn't make much sense as well, but at least it's already widely used in grub legacy, old user could easily guess its function by name.

Then we could use parttool syntax. Then parttype can be implemented like grub> parttool hd0,1 type=7
makeactive like:
grub> parttool hd0,1 boot+
And it can even be done by one command
grub> parttool hd0,1 boot+ type=7

Thank you for your attention to my patches

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
#5 lore raw
Quoted 20 lines · phcoder

Hello

Quoted 10 lines
Quoted 10 lines

It's also possible to write a wrapper
parttool hd0,1 boot+

Which chooses the correct tool and launches it (a tool can be easily registered as a pair of partition style name and a function). In this case
we wouldn't even need separate command for different partition style. We have however to find a way to list all available flags in

Quoted 9 lines
Quoted 1 line

help parttool

Hi,

The patch looks fine to me, except for perhaps the name. activate doesn't seems to suggest its function. Frankly, makeactive doesn't make much sense as well, but at least it's already widely used in grub legacy, old user could easily guess its function by name.

Quoted 8 lines

Then we could use parttool syntax. Then parttype can be implemented like grub> parttool hd0,1 type=7
makeactive like:
grub> parttool hd0,1 boot+
And it can even be done by one command
grub> parttool hd0,1 boot+ type=7

Thank you for your attention to my patches

Hi,

In that case, you might want to use options, which save you the trouble of parsing parameters yourself, for example:

parttool [--boot] [--type N] partition

Signature · 1 line
Bean
#6 lore raw
Quoted 7 lines · Bean
Quoted 7 lines

Then we could use parttool syntax. Then parttype can be implemented like grub> parttool hd0,1 type=7
makeactive like:
grub> parttool hd0,1 boot+
And it can even be done by one command
grub> parttool hd0,1 boot+ type=7

Quoted 8 lines
Quoted 1 line

Thank you for your attention to my patches

Hi,

In that case, you might want to use options, which save you the trouble of parsing parameters yourself, for example:

parttool [--boot] [--type N] partition

Why don't we make the syntax compatible with Parted? It supports non-interactive mode, and is also a GNU project. Some consistency between it and GRUB would be nice IMO.

(besides, there's also that project to integrate Parted with GRUB directly, it used to be in gsoc)

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."