Hi there.

When updating to e2fsprogs-1.40.6 like LFS devel did, I noticed my
system(s) no longer booting via grub. Slightly inconvenient ;-)

After digging around a while I found that mke2fs has changed the inode
size to 256, making grub effectively unable to read the filesystem to
find it's directory, the kernel etc.

I dug around in the net for a while and found a patch
   (
http://people.debian.org/~terpstra/message/20080130.140155.866d3ad1.en.html
)
but the formatting on a html-page always leaves a bit to be desired.

I attach the version we use her for review, eventually it can be of use
for LFS devel.

                Warmest greetings, keep up the good work,
                        drifter
--
[EMAIL PROTECTED]
                23.....56.......drifting
By caffeine alone I set my mind in motion, By the beans of Java
do thoughts acquire speed,  hands acquire shaking,  the shaking
becomes a warning, By caffeine alone do I set my mind in motion
--- stage2/fsys_ext2fs.c.unchanged      2008-02-22 15:45:07.000000000 +0100
+++ stage2/fsys_ext2fs.c        2008-02-22 15:46:25.000000000 +0100
@@ -79,7 +79,52 @@
     __u32 s_rev_level;         /* Revision level */
     __u16 s_def_resuid;                /* Default uid for reserved blocks */
     __u16 s_def_resgid;                /* Default gid for reserved blocks */
-    __u32 s_reserved[235];     /* Padding to the end of the block */
+ /*
+ * These fields are for EXT2_DYNAMIC_REV superblocks only.
+ *
+ * Note: the difference between the compatible feature set and
+ * the incompatible feature set is that if there is a bit set
+ * in the incompatible feature set that the kernel doesn't
+ * know about, it should refuse to mount the filesystem.
+ *
+ * e2fsck's requirements are more strict; if it doesn't know
+ * about a feature in either the compatible or incompatible
+ * feature set, it must abort and not try to meddle with
+ * things it doesn't understand...
+ */
+    __u32 s_first_ino;        /* First non-reserved inode */
+    __u16 s_inode_size;        /* size of inode structure */
+    __u16 s_block_group_nr;    /* block group # of this superblock */
+    __u32 s_feature_compat;    /* compatible feature set */
+    __u32 s_feature_incompat;    /* incompatible feature set */
+    __u32 s_feature_ro_compat;    /* readonly-compatible feature set */
+    __u8 s_uuid[16];        /* 128-bit uuid for volume */
+ char s_volume_name[16];    /* volume name */
+ char s_last_mounted[64];    /* directory where last mounted */
+    __u32 s_algorithm_usage_bitmap; /* For compression */
+ /*
+ * Performance hints. Directory preallocation should only
+ * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
+ */
+    __u8 s_prealloc_blocks;    /* Nr of blocks to try to preallocate*/
+    __u8 s_prealloc_dir_blocks;    /* Nr to preallocate for dirs */
+    __u16 s_reserved_gdt_blocks;/* Per group table for online growth */
+ /*
+ * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
+ */
+    __u8 s_journal_uuid[16];    /* uuid of journal superblock */
+    __u32 s_journal_inum;    /* inode number of journal file */
+    __u32 s_journal_dev;    /* device number of journal file */
+    __u32 s_last_orphan;    /* start of list of inodes to delete */
+    __u32 s_hash_seed[4];    /* HTREE hash seed */
+    __u8 s_def_hash_version;    /* Default hash version to use */
+    __u8 s_jnl_backup_type;     /* Default type of journal backup */
+    __u16 s_reserved_word_pad;
+    __u32 s_default_mount_opts;
+    __u32 s_first_meta_bg;    /* First metablock group */
+    __u32 s_mkfs_time;        /* When the filesystem was created */
+    __u32 s_jnl_blocks[17];     /* Backup of the journal inode */
+    __u32 s_reserved[172];    /* Padding to the end of the block */ 
   };
 
 struct ext2_group_desc
@@ -218,6 +263,10 @@
 #define EXT2_ADDR_PER_BLOCK(s)          (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
 #define EXT2_ADDR_PER_BLOCK_BITS(s)            (log2(EXT2_ADDR_PER_BLOCK(s)))
 
+#define EXT2_INODE_SIZE(s)        (SUPERBLOCK->s_inode_size)
+#define EXT2_INODES_PER_BLOCK(s)    (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
+ 
+
 /* linux/ext2_fs.h */
 #define EXT2_BLOCK_SIZE_BITS(s)        ((s)->s_log_block_size + 10)
 /* kind of from ext2/super.c */
@@ -553,7 +602,7 @@
       gdp = GROUP_DESC;
       ino_blk = gdp[desc].bg_inode_table +
        (((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group))
-        >> log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)));
+         >> log2 (EXT2_INODES_PER_BLOCK (SUPERBLOCK))); 
 #ifdef E2DEBUG
       printf ("inode table fsblock=%d\n", ino_blk);
 #endif /* E2DEBUG */
@@ -565,13 +614,14 @@
       /* reset indirect blocks! */
       mapblock2 = mapblock1 = -1;
 
-      raw_inode = INODE +
-       ((current_ino - 1)
-        & (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode) - 1));
+      raw_inode = (struct ext2_inode *)((char *)INODE +
+        ((current_ino - 1) & (EXT2_INODES_PER_BLOCK (SUPERBLOCK) - 1)) *
+        EXT2_INODE_SIZE (SUPERBLOCK));
+
 #ifdef E2DEBUG
       printf ("ipb=%d, sizeof(inode)=%d\n",
-             (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)),
-             sizeof (struct ext2_inode));
+      EXT2_INODES_PER_BLOCK (SUPERBLOCK), EXT2_INODE_SIZE (SUPERBLOCK)); 
+
       printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode);
       printf ("offset into inode table block=%d\n", (int) raw_inode - (int) 
INODE);
       for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode;
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to