All of lore.kernel.org
 help / color / mirror / Atom feed
* compiling with 2.95
@ 2005-03-02 15:03 Vincent Guffens
  2005-03-02 21:36 ` Yoshinori K. Okuji
  0 siblings, 1 reply; 6+ messages in thread
From: Vincent Guffens @ 2005-03-02 15:03 UTC (permalink / raw)
  To: Grub-devel

Hi,

I have downloaded grub 2 from cvs and tried to compile it on my system 
which is a debian woody with gcc version 2.95.4

It is written in the INSTALL file that the required version is * GCC 
2.95 or later.

It didn't work for 3 reasons:

1) unnamed union
2) declaration not at the beginning of a block
3) undefined symbol (memset)


Although I don't know if you are interrested in that or not, I'm sending 
  some modifications about these three items that allows grub 2 to be 
compiled with 2.95.4 (at least on my system).

I'm not used to send patches so I might be doing something wrong, please 
tell me if it is the case.



diff -ru grub2/fs/ext2.c grub2-mod/fs/ext2.c
--- grub2/fs/ext2.c	Mon Dec 13 18:26:17 2004
+++ grub2-mod/fs/ext2.c	Wed Mar  2 14:17:36 2005
@@ -136,7 +136,9 @@
        grub_uint32_t tripple_indir_block;
      } blocks;
      char symlink[60];
-  };
+  } osd1_union;
+#define ext2_blocks			osd1_union.blocks
+#define ext2_symlink		osd1_union.symlink
    grub_uint32_t version;
    grub_uint32_t acl;
    grub_uint32_t dir_acl;
@@ -199,14 +201,14 @@

    /* Direct blocks.  */
    if (fileblock < INDIRECT_BLOCKS)
-    blknr = grub_le_to_cpu32 (inode->blocks.dir_blocks[fileblock]);
+    blknr = grub_le_to_cpu32 (inode->ext2_blocks.dir_blocks[fileblock]);
    /* Indirect.  */
    else if (fileblock < INDIRECT_BLOCKS + blksz / 4)
      {
        grub_uint32_t indir[blksz / 4];

        if (grub_disk_read (data->disk,
-			  grub_le_to_cpu32 (inode->blocks.indir_block)
+			  grub_le_to_cpu32 (inode->ext2_blocks.indir_block)
  			  << log2_blksz,
  			  0, blksz, (char *) indir))
  	return grub_errno;
@@ -222,7 +224,7 @@
        grub_uint32_t indir[blksz / 4];

        if (grub_disk_read (data->disk,
-			  grub_le_to_cpu32 (inode->blocks.double_indir_block)
+			  grub_le_to_cpu32 (inode->ext2_blocks.double_indir_block)
  			  << log2_blksz,
  			  0, blksz, (char *) indir))
  	return grub_errno;
@@ -361,7 +363,7 @@
       otherwise it is stored in the inode.  */
    if (grub_le_to_cpu32 (diro->inode.size) <= 60)
      grub_strncpy (symlink,
-		  diro->inode.symlink,
+		  diro->inode.ext2_symlink,
  		  grub_le_to_cpu32 (diro->inode.size));
    else
      {
@@ -548,7 +550,7 @@
  grub_ext2_dir (grub_device_t device, const char *path,
  	       int (*hook) (const char *filename, int dir))
  {
-  struct grub_ext2_data *data = 0;;
+  struct grub_ext2_data *data = 0;
    struct grub_fshelp_node *fdiro = 0;

    auto int NESTED_FUNC_ATTR iterate (const char *filename,
diff -ru grub2/fs/hfs.c grub2-mod/fs/hfs.c
--- grub2/fs/hfs.c	Mon Nov  1 17:14:16 2004
+++ grub2-mod/fs/hfs.c	Tue Mar  1 16:46:02 2005
@@ -480,6 +480,7 @@
        /* Iterate over all records in this node.  */
        for (i = 0; i < grub_be_to_cpu16 (node.node.reccnt); i++)
  	{
+		struct grub_hfs_record rec;
  	  int pos = (nodesize >> 1) - 1 - i;
   	  struct pointer
  	  {
@@ -489,14 +490,10 @@
  	  pnt = (struct pointer *) (grub_be_to_cpu16 (node.offsets[pos])
  				    + node.rawnode);
  	
-	  struct grub_hfs_record rec =
-	    {
-	      &pnt->key,
-	      pnt->keylen,
-	      &pnt->key + pnt->keylen +(pnt->keylen + 1) % 2,
-	      nodesize - grub_be_to_cpu16 (node.offsets[pos])
-	      - pnt->keylen - 1
-	    };
+	  rec.key = &pnt->key;
+		rec.keylen = pnt->keylen;
+		rec.data =  &pnt->key + pnt->keylen +(pnt->keylen + 1) % 2;
+		rec.datalen = nodesize - grub_be_to_cpu16 (node.offsets[pos]) - 
pnt->keylen - 1;
  	
  	  if (node_hook (&node.node, &rec))
  	    return 0;
@@ -590,8 +587,8 @@
    struct grub_hfs_catalog_key key = {0, grub_cpu_to_be32 (dir), 0, ""};

    auto int node_found (struct grub_hfs_node *, struct grub_hfs_record *);
-  auto int it_dir (struct grub_hfs_node * __attribute ((unused)),
-		   struct grub_hfs_record *);
+  //auto int it_dir (struct grub_hfs_node * __attribute ((unused)),
+  auto int it_dir (struct grub_hfs_node * ,struct grub_hfs_record *);


    int node_found (struct grub_hfs_node *hnd, struct grub_hfs_record *rec)
@@ -658,6 +655,7 @@
    char *origpath;
    struct grub_hfs_filerec frec;
    struct grub_hfs_dirrec *dir = (struct grub_hfs_dirrec *) &frec;
+  struct grub_hfs_catalog_key key;
    frec.type = GRUB_HFS_FILETYPE_DIR;

    if (path[0] != '/')
@@ -689,7 +687,6 @@
  	  next++;
  	}

-      struct grub_hfs_catalog_key key;

        key.parent_dir = grub_cpu_to_be32 (inode);
        key.strlen = grub_strlen (path);
diff -ru grub2/fs/iso9660.c grub2-mod/fs/iso9660.c
--- grub2/fs/iso9660.c	Mon Nov  1 17:14:16 2004
+++ grub2-mod/fs/iso9660.c	Tue Mar  1 16:48:19 2005
@@ -509,7 +509,7 @@
  	int nameoffset = offset + sizeof (dirent);
  	struct grub_fshelp_node *node;
  	int sua_off = (sizeof (dirent) + dirent.namelen + 1
-		       - (dirent.namelen % 2));;
+		       - (dirent.namelen % 2));
  	int sua_size = dirent.len - sua_off;
  	
  	sua_off += offset + dir->data->susp_skip;
diff -ru grub2/fs/jfs.c grub2-mod/fs/jfs.c
--- grub2/fs/jfs.c	Mon Nov  1 17:14:16 2004
+++ grub2-mod/fs/jfs.c	Wed Mar  2 14:26:50 2005
@@ -194,7 +194,10 @@
        grub_uint8_t unused[32];
        grub_uint8_t path[128];
      } symlink;
-  } __attribute__ ((packed));
+  } jfs_union __attribute__ ((packed));
+#define jfs_file 		jfs_union.file
+#define jfs_dir			jfs_union.dir
+#define jfs_symlink jfs_union.symlink
  } __attribute__ ((packed));

  struct grub_jfs_data
@@ -289,7 +292,7 @@
        return -1;
      }

-  return getblk (&inode->file.tree, &inode->file.extents[0]);
+  return getblk (&inode->jfs_file.tree, &inode->jfs_file.extents[0]);
  }


@@ -376,7 +379,7 @@
    struct grub_jfs_diropen *diro;
    int blk;

-  de = (struct grub_jfs_internal_dirent *) inode->dir.dirents;
+  de = (struct grub_jfs_internal_dirent *) inode->jfs_dir.dirents;

    if (!((grub_le_to_cpu32 (inode->mode)
  	 & GRUB_JFS_FILETYPE_MASK) == GRUB_JFS_FILETYPE_DIR))
@@ -394,12 +397,12 @@
    diro->inode = inode;

    /* Check if the entire tree is contained within the inode.  */
-  if (inode->file.tree.flags & GRUB_JFS_TREE_LEAF)
+  if (inode->jfs_file.tree.flags & GRUB_JFS_TREE_LEAF)
      {
-      diro->leaf = inode->dir.dirents;
+      diro->leaf = inode->jfs_dir.dirents;
        diro->next_leaf = (struct grub_jfs_leaf_next_dirent *) de;
-      diro->sorted = inode->dir.header.sorted;
-      diro->count = inode->dir.header.count;
+      diro->sorted = inode->jfs_dir.header.sorted;
+      diro->count = inode->jfs_dir.header.count;
        diro->dirpage = 0;

        return diro;
@@ -412,7 +415,7 @@
        return 0;
      }

-  blk = grub_le_to_cpu32 (de[inode->dir.header.sorted[0]].ex.blk2);
+  blk = grub_le_to_cpu32 (de[inode->jfs_dir.header.sorted[0]].ex.blk2);
    blk <<= (grub_le_to_cpu16 (data->sblock.log2_blksz) - 
GRUB_DISK_SECTOR_BITS);

    /* Read in the nodes until we are on the leaf node level.  */
@@ -481,7 +484,7 @@

        /* If the inode contains the entrie tree or if this was the last
  	 node, there is nothing to read.  */
-      if ((diro->inode->file.tree.flags & GRUB_JFS_TREE_LEAF)
+      if ((diro->inode->jfs_file.tree.flags & GRUB_JFS_TREE_LEAF)
  	  || !grub_le_to_cpu64 (diro->dirpage->header.nextb))
  	return GRUB_ERR_OUT_OF_RANGE;

@@ -703,7 +706,7 @@
      return grub_error (GRUB_ERR_SYMLINK_LOOP, "too deep nesting of 
symlinks");

    if (size <= 128)
-    grub_strncpy (symlink, data->currinode.symlink.path, 128);
+    grub_strncpy (symlink, data->currinode.jfs_symlink.path, 128);
    else if (grub_jfs_read_file (data, 0, 0, size, symlink) < 0)
      return grub_errno;

diff -ru grub2/fs/minix.c grub2-mod/fs/minix.c
--- grub2/fs/minix.c	Fri Jan 21 23:34:18 2005
+++ grub2-mod/fs/minix.c	Tue Mar  1 16:35:38 2005
@@ -252,7 +252,7 @@
    struct grub_minix_sblock *sblock = &data->sblock;

    /* Block in which the inode is stored.  */
-  int block;
+  int block,offs;
    data->ino = ino;

    /* The first inode in minix is inode 1.  */
@@ -265,7 +265,7 @@
    if (data->version == 1)
      {
        block += ino / (GRUB_DISK_SECTOR_SIZE / sizeof (struct 
grub_minix_inode));
-      int offs = (ino % (GRUB_DISK_SECTOR_SIZE
+      offs = (ino % (GRUB_DISK_SECTOR_SIZE
  			 / sizeof (struct grub_minix_inode))
  		  * sizeof (struct grub_minix_inode));

@@ -276,7 +276,7 @@
      {
        block += ino / (GRUB_DISK_SECTOR_SIZE
  		      / sizeof (struct grub_minix2_inode));
-      int offs = (ino
+      offs = (ino
  		  % (GRUB_DISK_SECTOR_SIZE / sizeof (struct grub_minix2_inode))
  		  * sizeof (struct grub_minix2_inode));

diff -ru grub2/fs/ufs.c grub2-mod/fs/ufs.c
--- grub2/fs/ufs.c	Mon Nov  1 17:14:16 2004
+++ grub2-mod/fs/ufs.c	Wed Mar  2 15:05:50 2005
@@ -45,17 +45,17 @@
  #define UFS_BLKSZ(sblock) (grub_le_to_cpu32 (sblock->bsize))

  #define INODE(data,field) (data->ufs_type == UFS1 ? \
-                           data->inode.  field : data->inode2.  field)
+                           data->ufs_inode.ufs_inode_union.  field : 
data->ufs_inode2.ufs_inode_union.  field)
  #define INODE_ENDIAN(data,field,bits1,bits2) (data->ufs_type == UFS1 ? \
-                           grub_le_to_cpu##bits1 (data->inode.field) : \
-                           grub_le_to_cpu##bits2 (data->inode2.field))
+                           grub_le_to_cpu##bits1 
(data->ufs_inode.field) : \
+                           grub_le_to_cpu##bits2 (data->ufs_inode2.field))
  #define INODE_SIZE(data) INODE_ENDIAN (data,size,32,64)
  #define INODE_MODE(data) INODE_ENDIAN (data,mode,16,16)
  #define INODE_BLKSZ(data) (data->ufs_type == UFS1 ? 32 : 64)
  #define INODE_DIRBLOCKS(data,blk) INODE_ENDIAN \
-                                   (data,blocks.dir_blocks[blk],32,64)
+ 
(data,ufs_inode_union.blocks.dir_blocks[blk],32,64)
  #define INODE_INDIRBLOCKS(data,blk) INODE_ENDIAN \
-                                     (data,blocks.indir_blocks[blk],32,64)
+ 
(data,ufs_inode_union.blocks.indir_blocks[blk],32,64)

  /* The blocks on which the superblock can be found.  */
  static int sblocklist[] = { 128, 16, 0, 512, -1 };
@@ -112,7 +112,7 @@
        grub_uint32_t indir_blocks[GRUB_UFS_INDIRBLKS];
      } blocks;
      grub_uint8_t symlink[(GRUB_UFS_DIRBLKS + GRUB_UFS_INDIRBLKS) * 4];
-  };
+  } ufs_inode_union;
    grub_uint32_t flags;
    grub_uint32_t nblocks;
    grub_uint32_t gen;
@@ -151,7 +151,7 @@
        grub_uint64_t indir_blocks[GRUB_UFS_INDIRBLKS];
      } blocks;
      grub_uint8_t symlink[(GRUB_UFS_DIRBLKS + GRUB_UFS_INDIRBLKS) * 8];
-  };
+  } ufs_inode_union;

    grub_uint8_t unused[24];
  };
@@ -174,7 +174,9 @@
    {
      struct grub_ufs_inode inode;
      struct grub_ufs2_inode inode2;
-  };
+  } ufs_data_union ;
+#define ufs_inode 	ufs_data_union.inode
+#define ufs_inode2	ufs_data_union.inode2
    enum
      {
        UFS1,
@@ -323,7 +325,7 @@

    if (data->ufs_type == UFS1)
      {
-      struct grub_ufs_inode *inode = &data->inode;
+      struct grub_ufs_inode *inode = &data->ufs_inode;

        grub_disk_read (data->disk,
  		      (((grub_le_to_cpu32 (sblock->inoblk_offs) + grpblk)
@@ -335,7 +337,7 @@
      }
    else
      {
-      struct grub_ufs2_inode *inode = &data->inode2;
+      struct grub_ufs2_inode *inode = &data->ufs_inode2;

        grub_disk_read (data->disk,
  		      (((grub_le_to_cpu32 (sblock->inoblk_offs) + grpblk)
diff -ru grub2/include/grub/misc.h grub2-mod/include/grub/misc.h
--- grub2/include/grub/misc.h	Sat Jan 29 23:01:53 2005
+++ grub2-mod/include/grub/misc.h	Wed Mar  2 11:38:21 2005
@@ -35,6 +35,7 @@
  char *EXPORT_FUNC(grub_stpcpy) (char *dest, const char *src);
  char *EXPORT_FUNC(grub_strcat) (char *dest, const char *src);
  char *EXPORT_FUNC(grub_strncat) (char *dest, const char *src, int c);
+void *EXPORT_FUNC(memset) (void *s, int c, grub_size_t n);

  /* Prototypes for aliases.  */
  void *EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n);



-- 
				Vincent Guffens
				PhD Student UCL/CESAME
				tel:   +32 10 47 80 30
Value your freedom, or you will lose it, teaches history.
"Don't bother us with politics," respond those who don't want to learn.
	      	-- Richard M. Stallman



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: compiling with 2.95
  2005-03-02 15:03 compiling with 2.95 Vincent Guffens
@ 2005-03-02 21:36 ` Yoshinori K. Okuji
  2005-03-08 21:13   ` Marco Gerards
  0 siblings, 1 reply; 6+ messages in thread
From: Yoshinori K. Okuji @ 2005-03-02 21:36 UTC (permalink / raw)
  To: The development of GRUB 2

On Wednesday 02 March 2005 16:03, Vincent Guffens wrote:
> 1) unnamed union
> 2) declaration not at the beginning of a block
> 3) undefined symbol (memset)

I see.

> Although I don't know if you are interrested in that or not, I'm
> sending some modifications about these three items that allows grub 2
> to be compiled with 2.95.4 (at least on my system).

Your patch is definitely useful. But I'm not sure about unnamed union... 
It is not so convenient to specify union names. I think the code was 
written by Marco, so I'd like to hear his opinion about this.

> I'm not used to send patches so I might be doing something wrong,
> please tell me if it is the case.

Please write ChangeLog.

Okuji



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: compiling with 2.95
  2005-03-02 21:36 ` Yoshinori K. Okuji
@ 2005-03-08 21:13   ` Marco Gerards
  2005-03-09  9:26     ` Vincent Guffens
  0 siblings, 1 reply; 6+ messages in thread
From: Marco Gerards @ 2005-03-08 21:13 UTC (permalink / raw)
  To: The development of GRUB 2

"Yoshinori K. Okuji" <okuji@enbug.org> writes:

>> Although I don't know if you are interrested in that or not, I'm
>> sending some modifications about these three items that allows grub 2
>> to be compiled with 2.95.4 (at least on my system).
>
> Your patch is definitely useful. But I'm not sure about unnamed union... 
> It is not so convenient to specify union names. I think the code was 
> written by Marco, so I'd like to hear his opinion about this.

This weekend I will have a look at this.  I had the feeling it
should've worked with gcc 2.95, but I never tried it myself.
Hopefully I can find some box with gcc 2.95...  In the weekend I will
try to do some other hacking as well.

Thanks,
Marco





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: compiling with 2.95
  2005-03-08 21:13   ` Marco Gerards
@ 2005-03-09  9:26     ` Vincent Guffens
  2005-03-10 20:22       ` Yoshinori K. Okuji
  0 siblings, 1 reply; 6+ messages in thread
From: Vincent Guffens @ 2005-03-09  9:26 UTC (permalink / raw)
  To: The development of GRUB 2



Marco Gerards wrote:
> "Yoshinori K. Okuji" <okuji@enbug.org> writes:
> 
> 
>>>Although I don't know if you are interrested in that or not, I'm
>>>sending some modifications about these three items that allows grub 2
>>>to be compiled with 2.95.4 (at least on my system).
>>
>>Your patch is definitely useful. But I'm not sure about unnamed union... 
>>It is not so convenient to specify union names. I think the code was 
>>written by Marco, so I'd like to hear his opinion about this.
> 
> 
> This weekend I will have a look at this.  I had the feeling it
> should've worked with gcc 2.95, but I never tried it myself.
> Hopefully I can find some box with gcc 2.95...  In the weekend I will
> try to do some other hacking as well.

I had a look in google about unnamed unions and I have seen some 
references about them with 2.95 but I was not able to compile with them. 
Maybe there is a gcc switch for them ?

Also, when compiling with an "old" system, there is this sed error message:

sed: -e expression #1, char 69: Extra characters after command

the sed version is:
$ sed -V
GNU sed version 3.02

so I have also replaced in gencmdlist.sh the following line:

#grep -v "^#" | sed -ne "/grub_register_command *( *\"/{s/.*( 
*\"\([^\"]*\)\".*/\1: $module/;p}"
grep -v "^#" | grep -e "grub_register_command *( *\"" | sed -ne 
"s/.*grub_register_command *( *\"\([^,\"]*\).*/\1: $module/;p"



-- 
				Vincent Guffens
				PhD Student UCL/CESAME
				tel:   +32 10 47 80 30
Value your freedom, or you will lose it, teaches history.
"Don't bother us with politics," respond those who don't want to learn.
	      	-- Richard M. Stallman



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: compiling with 2.95
  2005-03-09  9:26     ` Vincent Guffens
@ 2005-03-10 20:22       ` Yoshinori K. Okuji
  2005-03-11  9:40         ` Vincent Guffens
  0 siblings, 1 reply; 6+ messages in thread
From: Yoshinori K. Okuji @ 2005-03-10 20:22 UTC (permalink / raw)
  To: The development of GRUB 2

On Wednesday 09 March 2005 10:26 am, Vincent Guffens wrote:
> I had a look in google about unnamed unions and I have seen some
> references about them with 2.95 but I was not able to compile with them.
> Maybe there is a gcc switch for them ?

I have no idea.

> Also, when compiling with an "old" system, there is this sed error message:
>
> sed: -e expression #1, char 69: Extra characters after command
>
> the sed version is:
> $ sed -V
> GNU sed version 3.02
>
> so I have also replaced in gencmdlist.sh the following line:
>
> #grep -v "^#" | sed -ne "/grub_register_command *( *\"/{s/.*(
> *\"\([^\"]*\)\".*/\1: $module/;p}"
> grep -v "^#" | grep -e "grub_register_command *( *\"" | sed -ne
> "s/.*grub_register_command *( *\"\([^,\"]*\).*/\1: $module/;p"

Oh, really? This is a very standard sed expression, I think. Ummh... What 
should I do?

Okuji



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: compiling with 2.95
  2005-03-10 20:22       ` Yoshinori K. Okuji
@ 2005-03-11  9:40         ` Vincent Guffens
  0 siblings, 0 replies; 6+ messages in thread
From: Vincent Guffens @ 2005-03-11  9:40 UTC (permalink / raw)
  To: The development of GRUB 2

[...]
>>so I have also replaced in gencmdlist.sh the following line:
>>
>>#grep -v "^#" | sed -ne "/grub_register_command *( *\"/{s/.*(
>>*\"\([^\"]*\)\".*/\1: $module/;p}"
>>grep -v "^#" | grep -e "grub_register_command *( *\"" | sed -ne
>>"s/.*grub_register_command *( *\"\([^,\"]*\).*/\1: $module/;p"
> 
> 
> Oh, really? This is a very standard sed expression, I think. Ummh... What 
> should I do?
> 

It looks like the problem comes from the braces in the expression, if I 
try a simple one like this:

$ cat test | sed -e "/grub_register/{s/register/test/;p}"
sed: -e expression #1, char 35: Extra characters after command

So I split the expression in two parts. From my understanding of it, the 
following is equivalent to the original sed expression:

grep -v "^#" | grep -e "grub_register_command *( *\"" | sed -ne "s/.*( 
*\"\([^\"]*\)\".*/\1: $module/;p"

which is not the same line than the one I sent in the previous mail 
(although they give the same command.lst)


-- 
				Vincent Guffens
				PhD Student UCL/CESAME
				tel:   +32 10 47 80 30
Value your freedom, or you will lose it, teaches history.
"Don't bother us with politics," respond those who don't want to learn.
	      	-- Richard M. Stallman



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-03-11 10:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-02 15:03 compiling with 2.95 Vincent Guffens
2005-03-02 21:36 ` Yoshinori K. Okuji
2005-03-08 21:13   ` Marco Gerards
2005-03-09  9:26     ` Vincent Guffens
2005-03-10 20:22       ` Yoshinori K. Okuji
2005-03-11  9:40         ` Vincent Guffens

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.