bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ufs2 - troubles


From: Sergey Matveychuk
Subject: ufs2 - troubles
Date: Fri, 10 Oct 2003 04:32:56 +0400
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030827

I really perplex with grub hacking.
As it was asked I've copied fsys_ffs.c in fsys_ufs2.c. I've make changes in files (see attached patch).

The first trouble I've met is a comment from disk_io.c:
/* XX FFS should come last as it's superblock is commonly crossing tracks
     on floppies from track 1 to 2, while others only use 1.  */
But anyway I've placed code after it.

The second problem is rebooting just after stage2 loaded. As I discover it may be undefined fsys_table[fsys_type].mount_func int attempt_mount() (from disk_io.c) for ufs2_mount. (I'm not sure, but I'm sure ufs2_mount is not called and it looks like other *_mount is called. I checked it with printf()).

And finally I can't to debug grub with grub-shell. When I ran it and type 'root (hd0)' I got an error:
Error 21: Selected disk does not exist

Even after I have created a device map file with a content:
(hd0) /dev/ad0
and ran grub --device-map=mydev.map

Please, hint me for they all!
--
Sem.
--- Makefile.am.orig    Mon Feb  4 07:55:48 2002
+++ stage2/Makefile.am  Tue Sep 23 04:33:34 2003
@@ -4,9 +4,10 @@
 
 # For dist target.
 noinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \
+       disk_inode_ufs2.h \
         fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \
        imgact_aout.h jfs.h mb_header.h mb_info.h md5.h pc_slice.h \
-       serial.h shared.h smp-imps.h nbi.h vstafs.h xfs.h
+       serial.h shared.h smp-imps.h nbi.h vstafs.h xfs.h disk_inode_ufs2.h
 EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS)
 
 # For <stage1.h>.
@@ -15,11 +16,11 @@
 # The library for /sbin/grub.
 noinst_LIBRARIES = libgrub.a
 libgrub_a_SOURCES = boot.c builtins.c common.c char_io.c cmdline.c \
-       disk_io.c gunzip.c fsys_ffs.c fsys_ext2fs.c fsys_fat.c \
+       disk_io.c gunzip.c fsys_ffs.c fsys_ufs2.c fsys_ext2fs.c fsys_fat.c \
        fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_vstafs.c \
        fsys_xfs.c stage2.c md5.c
 libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
-       -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
+       -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_UFS2=1 \
        -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 -DFSYS_VSTAFS=1 \
        -DFSYS_XFS=1 -DUSE_MD5_PASSWORDS=1 \
        -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1 -fwritable-strings
@@ -30,23 +31,23 @@
 EXTRA_PROGRAMS = nbloader.exec pxeloader.exec diskless.exec
 
 if DISKLESS_SUPPORT
-pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \
+pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 ufs2_stage1_5 \
        jfs_stage1_5 minix_stage1_5 reiserfs_stage1_5 vstafs_stage1_5 \
        xfs_stage1_5 nbgrub pxegrub
 noinst_DATA = pre_stage2 start nbloader pxeloader diskless
 noinst_PROGRAMS = pre_stage2.exec start.exec e2fs_stage1_5.exec \
-       fat_stage1_5.exec ffs_stage1_5.exec jfs_stage1_5.exec \
-       minix_stage1_5.exec reiserfs_stage1_5.exec \
+       fat_stage1_5.exec ffs_stage1_5.exec ufs2_stage1_5.exec \
+       jfs_stage1_5.exec minix_stage1_5.exec reiserfs_stage1_5.exec \
        vstafs_stage1_5.exec xfs_stage1_5.exec nbloader.exec \
        pxeloader.exec diskless.exec
 else
-pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \
+pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 ufs2_stage1_5 \
        jfs_stage1_5 minix_stage1_5 reiserfs_stage1_5 vstafs_stage1_5 \
        xfs_stage1_5
 noinst_DATA = pre_stage2 start
 noinst_PROGRAMS = pre_stage2.exec start.exec e2fs_stage1_5.exec \
-       fat_stage1_5.exec ffs_stage1_5.exec jfs_stage1_5.exec \
-       minix_stage1_5.exec reiserfs_stage1_5.exec \
+       fat_stage1_5.exec ffs_stage1_5.exec ufs2_stage1_5.exec \
+       jfs_stage1_5.exec minix_stage1_5.exec reiserfs_stage1_5.exec \
        vstafs_stage1_5.exec xfs_stage1_5.exec
 endif
 MOSTLYCLEANFILES = $(noinst_PROGRAMS)
@@ -83,9 +84,9 @@
 # For stage2 target.
 pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c common.c \
        char_io.c cmdline.c disk_io.c gunzip.c fsys_ext2fs.c \
-       fsys_fat.c fsys_ffs.c fsys_jfs.c fsys_minix.c fsys_reiserfs.c \
-       fsys_vstafs.c fsys_xfs.c hercules.c serial.c smp-imps.c \
-       stage2.c md5.c
+       fsys_fat.c fsys_ffs.c fsys_ufs2.c fsys_jfs.c fsys_minix.c \
+       fsys_reiserfs.c fsys_vstafs.c fsys_xfs.c hercules.c serial.c \
+       smp-imps.c stage2.c md5.c
 pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
 pre_stage2_exec_ASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
 pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK)
@@ -147,6 +148,15 @@
 ffs_stage1_5_exec_ASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \
        -DNO_BLOCK_FILES=1
 ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
+
+# For ufs2_stage1_5 target.
+ufs2_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
+       stage1_5.c fsys_ufs2.c bios.c
+ufs2_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS2=1 \
+       -DNO_BLOCK_FILES=1
+ufs2_stage1_5_exec_ASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_UFS2=1 \
+       -DNO_BLOCK_FILES=1
+ufs2_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
 
 # For minix_stage1_5 target.
 minix_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
--- filesys.h.orig      Mon Nov 12 09:57:29 2001
+++ stage2/filesys.h    Tue Sep 23 04:33:34 2003
@@ -30,6 +30,16 @@
 #define FSYS_FFS_NUM 0
 #endif
 
+#ifdef FSYS_UFS2
+#define FSYS_UFS2_NUM 1
+int ufs2_mount (void);
+int ufs2_read (char *buf, int len);
+int ufs2_dir (char *dirname);
+int ufs2_embed (int *start_sector, int needed_sectors);
+#else
+#define FSYS_UFS2_NUM 0
+#endif
+
 #ifdef FSYS_FAT
 #define FSYS_FAT_NUM 1
 int fat_mount (void);
@@ -107,7 +117,8 @@
 
 #ifndef NUM_FSYS
 #define NUM_FSYS       \
-  (FSYS_FFS_NUM + FSYS_FAT_NUM + FSYS_EXT2FS_NUM + FSYS_MINIX_NUM      \
+  (FSYS_FFS_NUM + FSYS_UFS2_NUM + FSYS_FAT_NUM + FSYS_EXT2FS_NUM \
+   + FSYS_MINIX_NUM    \
    + FSYS_REISERFS_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM + FSYS_XFS_NUM \
    + FSYS_TFTP_NUM)
 #endif
--- disk_io.c.orig      Wed Nov 28 21:43:56 2001
+++ stage2/disk_io.c    Fri Oct 10 03:17:52 2003
@@ -68,6 +68,9 @@
 # ifdef FSYS_XFS
   {"xfs", xfs_mount, xfs_read, xfs_dir, 0, 0},
 # endif
+# ifdef FSYS_UFS2
+  {"ufs2", ufs2_mount, ufs2_read, ufs2_dir, 0, ufs2_embed},
+# endif
   /* XX FFS should come last as it's superblock is commonly crossing tracks
      on floppies from track 1 to 2, while others only use 1.  */
 # ifdef FSYS_FFS

reply via email to

[Prev in Thread] Current Thread [Next in Thread]