Skip to contentSkip to conversation

sun partition map support

PATCH In review Vincent Pelletier 3 participants 13 messages Jan 2, 2005 – Feb 21, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sun partition map support

Hello.
Here is my first work about porting grub2 to ultrasparc : sun's partition map support.
The code was inspired by libparted (structs and the checksum function that I slightly modified).
This patch also enables i386-pc to test it, maybe it should also be done for apple. Tested to work with parted-generated disk images, not tested with a real disk.

2005-01-02 Vincent Pelletier <[email protected]>
* partmap/sun.c: Added
* conf/i386-pc.rmk, include/grub/partition.h, util/grub-emu.c:
References to partmap/sun.c added

Vincent Pelletier

Index: conf/i386-pc.rmk
===================================================================
RCS file: /cvsroot/grub/grub2/conf/i386-pc.rmk,v
retrieving revision 1.23

i386-pc.rmk +8 -1
diff -u -p -r1.23 i386-pc.rmk
@@ -62,6 +62,7 @@ grub_setup_SOURCES = util/i386/pc/grub-s
 	util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \
 	kern/err.c kern/misc.c fs/fat.c fs/ext2.c \
 	kern/partition.c partmap/amiga.c partmap/apple.c partmap/pc.c \
+	partmap/sun.c \
 	fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/file.c kern/fs.c kern/env.c fs/fshelp.c
 
 # For grub
@@ -70,6 +71,7 @@ grub_emu_SOURCES = kern/main.c kern/devi
         kern/misc.c kern/loader.c kern/rescue.c kern/term.c		\
 	kern/partition.c kern/env.c commands/ls.c partmap/amiga.c	\
 	partmap/pc.c partmap/apple.c					\
+	partmap/sun.c \
 	commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c		\
 	util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c fs/iso9660.c \
 	normal/cmdline.c normal/command.c normal/main.c normal/menu.c normal/arg.c	\
@@ -83,7 +85,7 @@ genmoddep_SOURCES = util/genmoddep.c
 pkgdata_MODULES = _chain.mod _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \
 	hfs.mod jfs.mod normal.mod hello.mod vga.mod font.mod _multiboot.mod ls.mod \
 	boot.mod cmp.mod cat.mod terminal.mod fshelp.mod chain.mod multiboot.mod \
-	amiga.mod apple.mod pc.mod
+	amiga.mod apple.mod pc.mod sun.mod
 
 # For _chain.mod.
 _chain_mod_SOURCES = loader/i386/pc/chainloader.c
@@ -190,3 +192,12 @@ apple_mod_CFLAGS = $(COMMON_CFLAGS)
 # For pc.mod
 pc_mod_SOURCES = partmap/pc.c
 pc_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For sun.mod
+sun_mod_SOURCES = partmap/sun.c
+sun_mod_CFLAGS = $(COMMON_CFLAGS)
+

Index: include/grub/partition.h
===================================================================
RCS file: /cvsroot/grub/grub2/include/grub/partition.h,v retrieving revision 1.1

grub/partition.h +2 -0
diff -u -p -r1.1 partition.h
@@ -89,6 +89,8 @@ void grub_amiga_partition_map_init (void
 void grub_amiga_partition_map_fini (void);
 void grub_apple_partition_map_init (void);
 void grub_apple_partition_map_fini (void);
+void grub_sun_partition_map_init (void);
+void grub_sun_partition_map_fini (void);

#endif

static inline unsigned long
Index: partmap/sun.c
===================================================================
RCS file: partmap/sun.c

sun.c new file +204 -0

204 lines not on this page · raw message

Index: util/grub-emu.c
===================================================================
RCS file: /cvsroot/grub/grub2/util/grub-emu.c,v
retrieving revision 1.9

grub-emu.c +2 -0
diff -u -p -r1.9 grub-emu.c
@@ -156,6 +156,8 @@ main (int argc, char *argv[])
   /* XXX: This is a bit unportable.  */
   grub_util_biosdisk_init (args.dev_map);
   grub_pc_partition_map_init ();
+  grub_sun_partition_map_init ();
   grub_amiga_partition_map_init ();
   grub_apple_partition_map_init ();
 
@@ -192,6 +193,8 @@ main (int argc, char *argv[])
   grub_cat_fini ();
   grub_terminal_fini ();
   grub_amiga_partition_map_fini ();
+  grub_sun_partition_map_fini ();
   grub_pc_partition_map_fini ();
   grub_apple_partition_map_fini ();
   
#1 lore raw

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

(up)

Any comments about this patch ?
Any problems with the code from libparted ?

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

iD8DBQFB7+LWFEQoKRQyjtURAnRjAJwJAnQSwoDJdHaLTlo5k8Ha51/FHQCfaepf V24cJc12JDTLv/wwAO4S5JY=
=481o
-----END PGP SIGNATURE-----

#2 lore raw
Quoted 1 line · Vincent Pelletier

Any comments about this patch ?

You never sent it in for inclusion, IIRC, just to me.

Quoted 1 line

Any problems with the code from libparted ?

It looks like the copyrights for parted are assigned. Okuji, is it ok if we use code from parted?

Thanks,
Marco

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

Any comments about this patch ?
Any problems with the code from libparted ?

No problem.

BTW, I think it is better to give you a write permission to the CVS, because your assignment is finished. Marco, would you like to do this?

Okuji

#4 lore raw
Quoted 8 lines · Yoshinori K. Okuji
Quoted 2 lines · Vincent Pelletier

Any comments about this patch ?
Any problems with the code from libparted ?

No problem.

BTW, I think it is better to give you a write permission to the CVS, because your assignment is finished. Marco, would you like to do this?

Sure.

--
Marco

#5 lore raw
Quoted 6 lines · Marco Gerards
Quoted 4 lines · Yoshinori K. Okuji
Quoted 2 lines · Vincent Pelletier

Any comments about this patch ?
Any problems with the code from libparted ?

Quoted 6 lines
Quoted 4 lines

No problem.

BTW, I think it is better to give you a write permission to the CVS, because your assignment is finished. Marco, would you like to do this?

Sure.

Done. Welcome on board Vincent. :)

--
Marco

#6 lore raw
In reply to Vincent Pelletier
Quoted 2 lines · Vincent Pelletier

Any comments about this patch ?
Any problems with the code from libparted ?

Unfortunately I did not receive this email, but I had a quick look in the archives. The main problems with it are some GCS related things.

There is currently a problem with the partition code. Can you send in a new patch after these problems are solved? After that I will review the patch and I make sure it can go in.

Thanks,
Marco

#7 lore raw

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

Here is the second version, with changes requested by Marco.

2005-02-07 Vincent Pelletier <[email protected]>
~ * partmap/sun.c: File added.
~ * conf/i386-pc.rmk: References to partmap/sun.c added.
~ include/grub/partition.h, util/grub-emu.c: Likewise.

References to sun partition map may also have to be added to apple rmk file, but as I can't test it I didn't.

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

iD8DBQFCB7rDFEQoKRQyjtURAmxHAJ9MCQmGHUbc3pTPy8vAI7OQFrUk2gCgnjbZ tjKXOpgFm96mrrNp6C/26G8=
=Qboo
-----END PGP SIGNATURE-----

Index: conf/i386-pc.rmk
===================================================================
RCS file: /cvsroot/grub/grub2/conf/i386-pc.rmk,v
retrieving revision 1.25

i386-pc.rmk +7 -3
diff -u -p -r1.25 i386-pc.rmk
@@ -61,7 +61,7 @@ grub_mkimage_LDFLAGS = -llzo
 grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
 	util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \
 	kern/err.c kern/misc.c fs/fat.c fs/ext2.c \
-	kern/partition.c partmap/amiga.c partmap/apple.c partmap/pc.c \
+	kern/partition.c partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
 	fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/file.c kern/fs.c kern/env.c fs/fshelp.c
 
 # For grub
@@ -69,7 +69,7 @@ grub_emu_SOURCES = kern/main.c kern/devi
 	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c		\
         kern/misc.c kern/loader.c kern/rescue.c kern/term.c		\
 	kern/partition.c kern/env.c commands/ls.c partmap/amiga.c	\
-	partmap/pc.c partmap/apple.c					\
+	partmap/pc.c partmap/apple.c partmap/sun.c			\
 	commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c		\
 	util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c fs/iso9660.c \
 	normal/cmdline.c normal/command.c normal/main.c normal/menu.c normal/arg.c	\
@@ -84,7 +84,7 @@ genmoddep_SOURCES = util/genmoddep.c
 pkgdata_MODULES = _chain.mod _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \
 	hfs.mod jfs.mod normal.mod hello.mod vga.mod font.mod _multiboot.mod ls.mod \
 	boot.mod cmp.mod cat.mod terminal.mod fshelp.mod chain.mod multiboot.mod \
-	amiga.mod apple.mod pc.mod loopback.mod reboot.mod halt.mod help.mod
+	amiga.mod apple.mod pc.mod sun.mod loopback.mod reboot.mod halt.mod help.mod
 
 # For _chain.mod.
 _chain_mod_SOURCES = loader/i386/pc/chainloader.c
@@ -204,6 +204,10 @@ apple_mod_CFLAGS = $(COMMON_CFLAGS)
 pc_mod_SOURCES = partmap/pc.c
 pc_mod_CFLAGS = $(COMMON_CFLAGS)
 
+# For sun.mod
+sun_mod_SOURCES = partmap/sun.c
+sun_mod_CFLAGS = $(COMMON_CFLAGS)
+
 # For loopback.mod
 loopback_mod_SOURCES = disk/loopback.c
 loopback_mod_CFLAGS = $(COMMON_CFLAGS)

Index: include/grub/partition.h
===================================================================
RCS file: /cvsroot/grub/grub2/include/grub/partition.h,v retrieving revision 1.1

grub/partition.h +2 -0
diff -u -p -r1.1 partition.h
@@ -89,6 +89,10 @@ void grub_amiga_partition_map_init (void
 void grub_amiga_partition_map_fini (void);
 void grub_apple_partition_map_init (void);
 void grub_apple_partition_map_fini (void);
+void grub_sun_partition_map_init (void);
+void grub_sun_partition_map_fini (void);
 #endif
 
 static inline unsigned long

Index: partmap/sun.c
===================================================================
RCS file: partmap/sun.c

sun.c new file +216 -0

216 lines not on this page · raw message

Index: util/grub-emu.c
===================================================================
RCS file: /cvsroot/grub/grub2/util/grub-emu.c,v
retrieving revision 1.13

grub-emu.c +2 -0
diff -u -p -r1.13 grub-emu.c
@@ -160,6 +160,7 @@ main (int argc, char *argv[])
   /* XXX: This is a bit unportable.  */
   grub_util_biosdisk_init (args.dev_map);
   grub_pc_partition_map_init ();
+  grub_sun_partition_map_init ();
   grub_amiga_partition_map_init ();
   grub_apple_partition_map_init ();
 
@@ -200,6 +201,7 @@ main (int argc, char *argv[])
   grub_cat_fini ();
   grub_terminal_fini ();
   grub_amiga_partition_map_fini ();
+  grub_sun_partition_map_fini ();
   grub_pc_partition_map_fini ();
   grub_apple_partition_map_fini ();
   
#8 lore raw
Quoted 1 line · Vincent Pelletier

Here is the second version, with changes requested by Marco.

Great! Thanks! :)

This patch will be committed on Friday, if I don't hear anything before then.

Quoted 4 lines

2005-02-07 Vincent Pelletier <[email protected]>
~ * partmap/sun.c: File added.
~ * conf/i386-pc.rmk: References to partmap/sun.c added.
~ include/grub/partition.h, util/grub-emu.c: Likewise.

It's not clear where it got added from this. I'll fix this when committing the patch.

Quoted 2 lines

References to sun partition map may also have to be added to apple rmk file, but as I can't test it I didn't.

Sure, I'll do that.

In the code you had:

+ p = (struct grub_partition *) grub_malloc (sizeof (struct grub_partition));
+ if (p)
+ {

That indents a huge block of code. I will change that to:

+ p = (struct grub_partition *) grub_malloc (sizeof (struct grub_partition));
+ if (!p)
+ return grub_errno;

Please send patches using the content-type text/x-patch. You send it as audio/x-mp3 so it started some audio player here when I tried viewing it. :-/

Thanks,
Marco

#9 lore raw

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

Marco Gerards wrote:
| It's not clear where it got added from this. I'll fix this when | committing the patch.

Thanks.

| Please send patches using the content-type text/x-patch.  You send it
| as audio/x-mp3 so it started some audio player here when I tried
| viewing it. :-/

Weird 8| .
There was some problems when I tried to send it,Thunderbird refused to read the file twice, and worked once I renamed it. And I don't know how is the mime detected - beyond "badly" :) .
Maybe should I learn how to send mails from emacs ;) .

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

iD8DBQFCB+QTFEQoKRQyjtURAtjFAJwPqO/nToHyHC5gVKVZSO+d8IXg9gCcCxUV dLl5wXLo0iCM2L34vvui1Yk=
=4iti
-----END PGP SIGNATURE-----

#10 lore raw
In reply to Marco Gerards

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

Marco Gerards wrote:
| This patch will be committed on Friday, if I don't hear anything | before then.

Ping ? :)

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

iD8DBQFCGjW0FEQoKRQyjtURAi8iAJ49gGmU4MEL5psu11lAq69Exefh6QCfUomn CVvkdQ388bGdAg1LtTreI+U=
=iIWb
-----END PGP SIGNATURE-----

#11 lore raw
Quoted 5 lines · Vincent Pelletier

Marco Gerards wrote:
| This patch will be committed on Friday, if I don't hear anything | before then.

Ping ? :)

Whoops! I have committed your patch. Thanks again and sorry for the delay.

--
Marco