grub: removed, closes FS#1690
This commit is contained in:
parent
bac2662de8
commit
41b60a7483
@ -1,38 +0,0 @@
|
|||||||
drwxr-xr-x root/root boot/
|
|
||||||
drwxr-xr-x root/root boot/grub/
|
|
||||||
-rw-r--r-- root/root boot/grub/crux02.xpm.gz
|
|
||||||
-rw-r--r-- root/root boot/grub/crux03.xpm.gz
|
|
||||||
-rw-r--r-- root/root boot/grub/menu.lst.sample
|
|
||||||
drwxr-xr-x root/root sbin/
|
|
||||||
-rwxr-xr-x root/root sbin/grub
|
|
||||||
-rwxr-xr-x root/root sbin/grub-install
|
|
||||||
-rwxr-xr-x root/root sbin/grub-md5-crypt
|
|
||||||
-rwxr-xr-x root/root sbin/grub-set-default
|
|
||||||
-rwxr-xr-x root/root sbin/grub-terminfo
|
|
||||||
drwxr-xr-x root/root usr/
|
|
||||||
drwxr-xr-x root/root usr/bin/
|
|
||||||
-rwxr-xr-x root/root usr/bin/mbchk
|
|
||||||
drwxr-xr-x root/root usr/share/
|
|
||||||
drwxr-xr-x root/root usr/share/grub/
|
|
||||||
drwxr-xr-x root/root usr/share/grub/x86_64-unknown/
|
|
||||||
-rw-r--r-- root/root usr/share/grub/x86_64-unknown/e2fs_stage1_5
|
|
||||||
-rw-r--r-- root/root usr/share/grub/x86_64-unknown/fat_stage1_5
|
|
||||||
-rw-r--r-- root/root usr/share/grub/x86_64-unknown/ffs_stage1_5
|
|
||||||
-rw-r--r-- root/root usr/share/grub/x86_64-unknown/iso9660_stage1_5
|
|
||||||
-rw-r--r-- root/root usr/share/grub/x86_64-unknown/jfs_stage1_5
|
|
||||||
-rw-r--r-- root/root usr/share/grub/x86_64-unknown/minix_stage1_5
|
|
||||||
-rw-r--r-- root/root usr/share/grub/x86_64-unknown/reiserfs_stage1_5
|
|
||||||
-rw-r--r-- root/root usr/share/grub/x86_64-unknown/stage1
|
|
||||||
-rw-r--r-- root/root usr/share/grub/x86_64-unknown/stage2
|
|
||||||
-rw-r--r-- root/root usr/share/grub/x86_64-unknown/stage2_eltorito
|
|
||||||
-rw-r--r-- root/root usr/share/grub/x86_64-unknown/ufs2_stage1_5
|
|
||||||
-rw-r--r-- root/root usr/share/grub/x86_64-unknown/vstafs_stage1_5
|
|
||||||
-rw-r--r-- root/root usr/share/grub/x86_64-unknown/xfs_stage1_5
|
|
||||||
drwxr-xr-x root/root usr/share/man/
|
|
||||||
drwxr-xr-x root/root usr/share/man/man1/
|
|
||||||
-rw-r--r-- root/root usr/share/man/man1/mbchk.1.gz
|
|
||||||
drwxr-xr-x root/root usr/share/man/man8/
|
|
||||||
-rw-r--r-- root/root usr/share/man/man8/grub-install.8.gz
|
|
||||||
-rw-r--r-- root/root usr/share/man/man8/grub-md5-crypt.8.gz
|
|
||||||
-rw-r--r-- root/root usr/share/man/man8/grub-terminfo.8.gz
|
|
||||||
-rw-r--r-- root/root usr/share/man/man8/grub.8.gz
|
|
@ -1,12 +0,0 @@
|
|||||||
untrusted comment: verify with /etc/ports/opt.pub
|
|
||||||
RWSE3ohX2g5d/c8ACuSQy/3MTX0gbaREkBv/FFF563Qi0riFeiUK7kHomaqfwGhkc7wPFAK+PaWiUfNufPUTJvd1zedjaEgBtA8=
|
|
||||||
SHA256 (Pkgfile) = 5d0e4058bff29de0753d614405938d4751ea7909b0e1e2a78e57ff60827aad5d
|
|
||||||
SHA256 (.footprint) = 81646332cfd43eb9cb86efc901acf74c353f28a923b79886aafed3d60ca16f37
|
|
||||||
SHA256 (grub-0.97.tar.gz) = 4e1d15d12dbd3e9208111d6b806ad5a9857ca8850c47877d36575b904559260b
|
|
||||||
SHA256 (grub-0.97-patches-2.tar.bz2) = 8f4c3b3d347dcb3ee2bf7c562453d010cc1fb34621d2d10cb8c57b65161583b3
|
|
||||||
SHA256 (automake.patch) = 30c2e5fc8cc092af739b9a18035cabdf2edff910d2d7c3ec4912c3addb0f107b
|
|
||||||
SHA256 (ext4.patch) = b7eb19affe0d2cf21e7a24491ad349c49cc3ddbcf27183a607ffde39dc0fde18
|
|
||||||
SHA256 (grub-qemu.patch) = c23c8b1f03083f13d8be3a391354594beac286a59734fbc8247126cfc633be1d
|
|
||||||
SHA256 (crux02.xpm.gz) = 84308a83bf6138ac34874827a79d6af0330fde57d650197e55b301cc3045196d
|
|
||||||
SHA256 (crux03.xpm.gz) = 4b280bcc93ad40b01e7c1f9cf845f664954ab3c45267855ffdb40f39fd44f665
|
|
||||||
SHA256 (menu.lst.sample) = 33b480cbb2f0c2765d86c378b7ff480eb3507b4007382246ca8e28e3693dfb82
|
|
50
grub/Pkgfile
50
grub/Pkgfile
@ -1,50 +0,0 @@
|
|||||||
# Description: GNU GRUB (GRand Unified Bootloader)
|
|
||||||
# URL: http://www.gnu.org/software/grub/
|
|
||||||
# Packager: Lucas Hazel, lucas at die dot net dot au
|
|
||||||
# Maintainer: Alan Mizrahi, alan at mizrahi dot com dot ve
|
|
||||||
# Depends on: gettext
|
|
||||||
|
|
||||||
name=grub
|
|
||||||
version=0.97
|
|
||||||
release=8
|
|
||||||
source=(
|
|
||||||
ftp://alpha.gnu.org/gnu/grub/$name-$version.tar.gz
|
|
||||||
http://crux.nu/files/grub/0.97/$name-$version-patches-2.tar.bz2
|
|
||||||
automake.patch
|
|
||||||
ext4.patch
|
|
||||||
grub-qemu.patch
|
|
||||||
http://crux.nu/files/grub/common/crux02.xpm.gz
|
|
||||||
http://crux.nu/files/grub/common/crux03.xpm.gz
|
|
||||||
menu.lst.sample
|
|
||||||
)
|
|
||||||
|
|
||||||
build () {
|
|
||||||
cd $name-$version
|
|
||||||
|
|
||||||
# automake 1.10 fix
|
|
||||||
sed -i '19i\AM_PROG_AS' configure.ac
|
|
||||||
|
|
||||||
for i in $SRC/*.patch; do
|
|
||||||
patch -p1 -i $i
|
|
||||||
done
|
|
||||||
|
|
||||||
# We really shouldn't optimise GRUB at all.
|
|
||||||
unset CXXFLAGS
|
|
||||||
unset CFLAGS
|
|
||||||
|
|
||||||
autoreconf --install --force
|
|
||||||
|
|
||||||
./configure --prefix=/usr \
|
|
||||||
--libdir=/usr/share \
|
|
||||||
--mandir=/usr/share/man \
|
|
||||||
--sbindir=/sbin \
|
|
||||||
--disable-nls \
|
|
||||||
--disable-auto-linux-mem-opt
|
|
||||||
|
|
||||||
make
|
|
||||||
make DESTDIR=$PKG install
|
|
||||||
rm -rf $PKG/usr/share/info
|
|
||||||
|
|
||||||
mkdir -p $PKG/boot/grub
|
|
||||||
install -m 644 $SRC/{crux*,menu.lst.sample} $PKG/boot/grub/
|
|
||||||
}
|
|
71
grub/README
71
grub/README
@ -1,71 +0,0 @@
|
|||||||
|
|
||||||
REQUIREMENTS
|
|
||||||
|
|
||||||
PRE-INSTALL
|
|
||||||
|
|
||||||
POST-INSTALL
|
|
||||||
|
|
||||||
Automatic setup using grub-install
|
|
||||||
|
|
||||||
After installation you should create your own boot menu:
|
|
||||||
|
|
||||||
# # Copy sample file
|
|
||||||
# cp /boot/grub/menu.lst.sample /boot/grub/menu.lst
|
|
||||||
# # Modify it for your system
|
|
||||||
# vi /boot/grub/menu.lst
|
|
||||||
|
|
||||||
For more information about setting up your own grub boot menu file:
|
|
||||||
http://www.gnu.org/software/grub/manual/grub.html#Configuration
|
|
||||||
|
|
||||||
After making your boot menu you should run grub-install like so:
|
|
||||||
|
|
||||||
# grub-install /dev/sdX
|
|
||||||
|
|
||||||
In the example above, X needs to be replaced with your hard drive.
|
|
||||||
|
|
||||||
Manual setup
|
|
||||||
|
|
||||||
After installation you need to copy the stage files to /boot/grub/:
|
|
||||||
|
|
||||||
# cp /usr/share/grub/*/*stage* /boot/grub/
|
|
||||||
|
|
||||||
(Of course, you can choose another location as described above but this guide
|
|
||||||
assumes that you use /boot/grub. Normally you need only the files stage1 and
|
|
||||||
stage2. Please read the grub documentation if you don't know why:
|
|
||||||
http://www.uruk.org/orig-grub/ and
|
|
||||||
http://www.gnu.org/software/grub/manual/grub.html)
|
|
||||||
|
|
||||||
Now it's time to create your own "boot menu":
|
|
||||||
|
|
||||||
# # Copy sample file
|
|
||||||
# cp /boot/grub/menu.lst.sample /boot/grub/menu.lst
|
|
||||||
# # Modify it for your system
|
|
||||||
# vi /boot/grub/menu.lst
|
|
||||||
|
|
||||||
For more information about setting up your own grub boot menu file:
|
|
||||||
http://www.gnu.org/software/grub/manual/grub.html#Configuration
|
|
||||||
|
|
||||||
Last but not least, install/enable the boot manager:
|
|
||||||
|
|
||||||
# # If the boot partition is mounted, you must specify --stage2, like below.
|
|
||||||
# # Otherwise, you may remove this.
|
|
||||||
# # Run grub
|
|
||||||
# grub
|
|
||||||
grub> root (hdX,Y)
|
|
||||||
grub> setup --stage2=/boot/grub/stage2 (hdX)
|
|
||||||
grub> quit
|
|
||||||
|
|
||||||
Please correct the path and device names according to your configuration. Also
|
|
||||||
see http://www.gnu.org/software/grub/manual/grub.html#Installation. In the
|
|
||||||
example above, X and Y need to be replaced with your hard drive and grub
|
|
||||||
partition.
|
|
||||||
|
|
||||||
That's all. Good luck ;)
|
|
||||||
|
|
||||||
PRECAUTION
|
|
||||||
|
|
||||||
Installing a new boot manager is like modifying the partition table
|
|
||||||
or installing a new system kernel. Please create a rescue disk first :)
|
|
||||||
|
|
||||||
Brett Goulder <predatorfreak@dcaf-security.org>
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
|||||||
--- grub-0.97/stage1/Makefile.am.orig 2012-02-27 10:28:38.000000000 +0900
|
|
||||||
+++ grub-0.97/stage1/Makefile.am 2012-02-27 10:29:32.000000000 +0900
|
|
||||||
@@ -1,5 +1,5 @@
|
|
||||||
-pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
|
|
||||||
-nodist_pkglib_DATA = stage1
|
|
||||||
+stagedir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
|
|
||||||
+nodist_stage_DATA = stage1
|
|
||||||
|
|
||||||
CLEANFILES = $(nodist_pkglib_DATA)
|
|
||||||
|
|
||||||
--- grub-0.97/stage2/Makefile.am.orig 2012-02-27 10:29:39.000000000 +0900
|
|
||||||
+++ grub-0.97/stage2/Makefile.am 2012-02-27 10:30:37.000000000 +0900
|
|
||||||
@@ -27,12 +27,12 @@
|
|
||||||
-DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1
|
|
||||||
|
|
||||||
# Stage 2 and Stage 1.5's.
|
|
||||||
-pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
|
|
||||||
+stagedir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
|
|
||||||
|
|
||||||
EXTRA_PROGRAMS = nbloader.exec pxeloader.exec diskless.exec
|
|
||||||
|
|
||||||
if DISKLESS_SUPPORT
|
|
||||||
-pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
|
|
||||||
+stage_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
|
|
||||||
ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
|
|
||||||
reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5 \
|
|
||||||
nbgrub pxegrub
|
|
||||||
@@ -43,7 +43,7 @@
|
|
||||||
reiserfs_stage1_5.exec ufs2_stage1_5.exec vstafs_stage1_5.exec \
|
|
||||||
xfs_stage1_5.exec nbloader.exec pxeloader.exec diskless.exec
|
|
||||||
else
|
|
||||||
-pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
|
|
||||||
+stage_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
|
|
||||||
ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
|
|
||||||
reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5
|
|
||||||
noinst_DATA = pre_stage2 start start_eltorito
|
|
||||||
@@ -112,7 +112,7 @@
|
|
||||||
BUILT_SOURCES = stage2_size.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
-CLEANFILES = $(pkglib_DATA) $(noinst_DATA) $(BUILT_SOURCES)
|
|
||||||
+CLEANFILES = $(stage_DATA) $(noinst_DATA) $(BUILT_SOURCES)
|
|
||||||
|
|
||||||
stage2_size.h: pre_stage2
|
|
||||||
-rm -f stage2_size.h
|
|
263
grub/ext4.patch
263
grub/ext4.patch
@ -1,263 +0,0 @@
|
|||||||
diff -ruNp grub-0.97/stage2/fsys_ext2fs.c grub-0.97-patch/stage2/fsys_ext2fs.c
|
|
||||||
--- grub-0.97/stage2/fsys_ext2fs.c 2004-08-08 20:19:18.000000000 +0200
|
|
||||||
+++ grub-0.97-patch/stage2/fsys_ext2fs.c 2007-12-29 16:25:19.000000000
|
|
||||||
+0100
|
|
||||||
@@ -51,6 +51,9 @@ typedef unsigned int __u32;
|
|
||||||
#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
|
|
||||||
#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
|
|
||||||
|
|
||||||
+/* Inode flags */
|
|
||||||
+#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
|
|
||||||
+
|
|
||||||
/* include/linux/ext2_fs.h */
|
|
||||||
struct ext2_super_block
|
|
||||||
{
|
|
||||||
@@ -191,6 +194,42 @@ struct ext2_dir_entry
|
|
||||||
#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
|
|
||||||
~EXT2_DIR_ROUND)
|
|
||||||
|
|
||||||
+/* linux/ext4_fs_extents.h */
|
|
||||||
+/*
|
|
||||||
+ * This is the extent on-disk structure.
|
|
||||||
+ * It's used at the bottom of the tree.
|
|
||||||
+ */
|
|
||||||
+struct ext4_extent {
|
|
||||||
+ __u32 ee_block; /* first logical block extent covers */
|
|
||||||
+ __u16 ee_len; /* number of blocks covered by extent */
|
|
||||||
+ __u16 ee_start_hi; /* high 16 bits of physical block */
|
|
||||||
+ __u32 ee_start; /* low 32 bits of physical block */
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * This is index on-disk structure.
|
|
||||||
+ * It's used at all the levels except the bottom.
|
|
||||||
+ */
|
|
||||||
+struct ext4_extent_idx {
|
|
||||||
+ __u32 ei_block; /* index covers logical blocks from 'block' */
|
|
||||||
+ __u32 ei_leaf; /* pointer to the physical block of the next *
|
|
||||||
+ * level. leaf or next index could be there */
|
|
||||||
+ __u16 ei_leaf_hi; /* high 16 bits of physical block */
|
|
||||||
+ __u16 ei_unused;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * Each block (leaves and indexes), even inode-stored has header.
|
|
||||||
+ */
|
|
||||||
+struct ext4_extent_header {
|
|
||||||
+ __u16 eh_magic; /* probably will support different formats */
|
|
||||||
+ __u16 eh_entries; /* number of valid entries */
|
|
||||||
+ __u16 eh_max; /* capacity of store in entries */
|
|
||||||
+ __u16 eh_depth; /* has tree real underlying blocks? */
|
|
||||||
+ __u32 eh_generation; /* generation of the tree */
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+#define EXT4_EXT_MAGIC 0xf30a
|
|
||||||
|
|
||||||
/* ext2/super.c */
|
|
||||||
#define log2(n) ffz(~(n))
|
|
||||||
@@ -279,6 +318,26 @@ ext2_rdfsb (int fsblock, int buffer)
|
|
||||||
EXT2_BLOCK_SIZE (SUPERBLOCK), (char *) buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
+/* Walk through extents index tree to find the good leaf */
|
|
||||||
+static struct ext4_extent_header *
|
|
||||||
+ext4_recurse_extent_index(struct ext4_extent_header *extent_block, int logical_block)
|
|
||||||
+{
|
|
||||||
+ int i;
|
|
||||||
+ struct ext4_extent_idx *index = (struct ext4_extent_idx *) (extent_block + 1);
|
|
||||||
+ if (extent_block->eh_magic != EXT4_EXT_MAGIC)
|
|
||||||
+ return NULL;
|
|
||||||
+ if (extent_block->eh_depth == 0)
|
|
||||||
+ return extent_block;
|
|
||||||
+ for (i = 0; i < extent_block->eh_entries; i++)
|
|
||||||
+ {
|
|
||||||
+ if (logical_block < index[i].ei_block)
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ if (i == 0 || !ext2_rdfsb(index[i-1].ei_leaf, DATABLOCK1))
|
|
||||||
+ return NULL;
|
|
||||||
+ return (ext4_recurse_extent_index((struct ext4_extent_header *) DATABLOCK1, logical_block));
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/* from
|
|
||||||
ext2/inode.c:ext2_bmap()
|
|
||||||
*/
|
|
||||||
--- grub-0.97/stage2/fsys_ext2fs.c~ 2008-12-28 20:19:00.000000000 +0100
|
|
||||||
+++ grub-0.97/stage2/fsys_ext2fs.c 2008-12-28 20:19:00.000000000 +0100
|
|
||||||
@@ -366,83 +366,106 @@
|
|
||||||
}
|
|
||||||
printf ("logical block %d\n", logical_block);
|
|
||||||
#endif /* E2DEBUG */
|
|
||||||
-
|
|
||||||
- /* if it is directly pointed to by the inode, return that physical addr */
|
|
||||||
- if (logical_block < EXT2_NDIR_BLOCKS)
|
|
||||||
- {
|
|
||||||
-#ifdef E2DEBUG
|
|
||||||
- printf ("returning %d\n", (unsigned char *) (INODE->i_block[logical_block]));
|
|
||||||
- printf ("returning %d\n", INODE->i_block[logical_block]);
|
|
||||||
-#endif /* E2DEBUG */
|
|
||||||
- return INODE->i_block[logical_block];
|
|
||||||
- }
|
|
||||||
- /* else */
|
|
||||||
- logical_block -= EXT2_NDIR_BLOCKS;
|
|
||||||
- /* try the indirect block */
|
|
||||||
- if (logical_block < EXT2_ADDR_PER_BLOCK (SUPERBLOCK))
|
|
||||||
+ /* standard ext2 inode */
|
|
||||||
+ if (!(INODE->i_flags & EXT4_EXTENTS_FL))
|
|
||||||
{
|
|
||||||
- if (mapblock1 != 1
|
|
||||||
- && !ext2_rdfsb (INODE->i_block[EXT2_IND_BLOCK], DATABLOCK1))
|
|
||||||
- {
|
|
||||||
- errnum = ERR_FSYS_CORRUPT;
|
|
||||||
- return -1;
|
|
||||||
- }
|
|
||||||
- mapblock1 = 1;
|
|
||||||
- return ((__u32 *) DATABLOCK1)[logical_block];
|
|
||||||
- }
|
|
||||||
- /* else */
|
|
||||||
- logical_block -= EXT2_ADDR_PER_BLOCK (SUPERBLOCK);
|
|
||||||
- /* now try the double indirect block */
|
|
||||||
- if (logical_block < (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2)))
|
|
||||||
- {
|
|
||||||
- int bnum;
|
|
||||||
- if (mapblock1 != 2
|
|
||||||
- && !ext2_rdfsb (INODE->i_block[EXT2_DIND_BLOCK], DATABLOCK1))
|
|
||||||
- {
|
|
||||||
- errnum = ERR_FSYS_CORRUPT;
|
|
||||||
- return -1;
|
|
||||||
- }
|
|
||||||
- mapblock1 = 2;
|
|
||||||
- if ((bnum = (((__u32 *) DATABLOCK1)
|
|
||||||
- [logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)]))
|
|
||||||
- != mapblock2
|
|
||||||
- && !ext2_rdfsb (bnum, DATABLOCK2))
|
|
||||||
- {
|
|
||||||
- errnum = ERR_FSYS_CORRUPT;
|
|
||||||
- return -1;
|
|
||||||
- }
|
|
||||||
- mapblock2 = bnum;
|
|
||||||
+ /* if it is directly pointed to by the inode, return that physical addr */
|
|
||||||
+ if (logical_block < EXT2_NDIR_BLOCKS)
|
|
||||||
+ {
|
|
||||||
+#ifdef E2DEBUG
|
|
||||||
+ printf ("returning %d\n", (unsigned char *) (INODE->i_block[logical_block]));
|
|
||||||
+ printf ("returning %d\n", INODE->i_block[logical_block]);
|
|
||||||
+#endif /* E2DEBUG */
|
|
||||||
+ return INODE->i_block[logical_block];
|
|
||||||
+ }
|
|
||||||
+ /* else */
|
|
||||||
+ logical_block -= EXT2_NDIR_BLOCKS;
|
|
||||||
+ /* try the indirect block */
|
|
||||||
+ if (logical_block < EXT2_ADDR_PER_BLOCK (SUPERBLOCK))
|
|
||||||
+ {
|
|
||||||
+ if (mapblock1 != 1
|
|
||||||
+ && !ext2_rdfsb (INODE->i_block[EXT2_IND_BLOCK], DATABLOCK1))
|
|
||||||
+ {
|
|
||||||
+ errnum = ERR_FSYS_CORRUPT;
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ mapblock1 = 1;
|
|
||||||
+ return ((__u32 *) DATABLOCK1)[logical_block];
|
|
||||||
+ }
|
|
||||||
+ /* else */
|
|
||||||
+ logical_block -= EXT2_ADDR_PER_BLOCK (SUPERBLOCK);
|
|
||||||
+ /* now try the double indirect block */
|
|
||||||
+ if (logical_block < (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2)))
|
|
||||||
+ {
|
|
||||||
+ int bnum;
|
|
||||||
+ if (mapblock1 != 2
|
|
||||||
+ && !ext2_rdfsb (INODE->i_block[EXT2_DIND_BLOCK], DATABLOCK1))
|
|
||||||
+ {
|
|
||||||
+ errnum = ERR_FSYS_CORRUPT;
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ mapblock1 = 2;
|
|
||||||
+ if ((bnum = (((__u32 *) DATABLOCK1)
|
|
||||||
+ [logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)]))
|
|
||||||
+ != mapblock2
|
|
||||||
+ && !ext2_rdfsb (bnum, DATABLOCK2))
|
|
||||||
+ {
|
|
||||||
+ errnum = ERR_FSYS_CORRUPT;
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ mapblock2 = bnum;
|
|
||||||
+ return ((__u32 *) DATABLOCK2)
|
|
||||||
+ [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)];
|
|
||||||
+ }
|
|
||||||
+ /* else */
|
|
||||||
+ mapblock2 = -1;
|
|
||||||
+ logical_block -= (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2));
|
|
||||||
+ if (mapblock1 != 3
|
|
||||||
+ && !ext2_rdfsb (INODE->i_block[EXT2_TIND_BLOCK], DATABLOCK1))
|
|
||||||
+ {
|
|
||||||
+ errnum = ERR_FSYS_CORRUPT;
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ mapblock1 = 3;
|
|
||||||
+ if (!ext2_rdfsb (((__u32 *) DATABLOCK1)
|
|
||||||
+ [logical_block >> (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)
|
|
||||||
+ * 2)],
|
|
||||||
+ DATABLOCK2))
|
|
||||||
+ {
|
|
||||||
+ errnum = ERR_FSYS_CORRUPT;
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ if (!ext2_rdfsb (((__u32 *) DATABLOCK2)
|
|
||||||
+ [(logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK))
|
|
||||||
+ & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)],
|
|
||||||
+ DATABLOCK2))
|
|
||||||
+ {
|
|
||||||
+ errnum = ERR_FSYS_CORRUPT;
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
return ((__u32 *) DATABLOCK2)
|
|
||||||
- [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)];
|
|
||||||
- }
|
|
||||||
- /* else */
|
|
||||||
- mapblock2 = -1;
|
|
||||||
- logical_block -= (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2));
|
|
||||||
- if (mapblock1 != 3
|
|
||||||
- && !ext2_rdfsb (INODE->i_block[EXT2_TIND_BLOCK], DATABLOCK1))
|
|
||||||
- {
|
|
||||||
- errnum = ERR_FSYS_CORRUPT;
|
|
||||||
- return -1;
|
|
||||||
+ [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)];
|
|
||||||
}
|
|
||||||
- mapblock1 = 3;
|
|
||||||
- if (!ext2_rdfsb (((__u32 *) DATABLOCK1)
|
|
||||||
- [logical_block >> (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)
|
|
||||||
- * 2)],
|
|
||||||
- DATABLOCK2))
|
|
||||||
- {
|
|
||||||
- errnum = ERR_FSYS_CORRUPT;
|
|
||||||
- return -1;
|
|
||||||
- }
|
|
||||||
- if (!ext2_rdfsb (((__u32 *) DATABLOCK2)
|
|
||||||
- [(logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK))
|
|
||||||
- & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)],
|
|
||||||
- DATABLOCK2))
|
|
||||||
+ /* inode is in extents format */
|
|
||||||
+ else
|
|
||||||
{
|
|
||||||
+ int i;
|
|
||||||
+ struct ext4_extent_header *extent_hdr = ext4_recurse_extent_index((struct ext4_extent_header *) INODE->i_block, logical_block);
|
|
||||||
+ struct ext4_extent *extent = (struct ext4_extent *) (extent_hdr + 1);
|
|
||||||
+ if ( extent_hdr == NULL || extent_hdr->eh_magic != EXT4_EXT_MAGIC)
|
|
||||||
+ {
|
|
||||||
+ errnum = ERR_FSYS_CORRUPT;
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ for (i = 0; i<extent_hdr->eh_entries; i++)
|
|
||||||
+ {
|
|
||||||
+ if (extent[i].ee_block <= logical_block && logical_block < extent[i].ee_block + extent[i].ee_len && !(extent[i].ee_len>>15))
|
|
||||||
+ return (logical_block - extent[i].ee_block + extent[i].ee_start);
|
|
||||||
+ }
|
|
||||||
+ /* We should not arrive here */
|
|
||||||
errnum = ERR_FSYS_CORRUPT;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
- return ((__u32 *) DATABLOCK2)
|
|
||||||
- [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* preconditions: all preconds of ext2fs_block_map */
|
|
@ -1,18 +0,0 @@
|
|||||||
diff -ru grub-0.97.orig/util/grub-install.in grub-0.97/util/grub-install.in
|
|
||||||
--- grub-0.97.orig/util/grub-install.in 2004-07-25 03:57:31.000000000 +0900
|
|
||||||
+++ grub-0.97/util/grub-install.in 2017-05-11 18:46:29.772993526 +0900
|
|
||||||
@@ -96,12 +96,12 @@
|
|
||||||
# Break the device name into the disk part and the partition part.
|
|
||||||
case "$host_os" in
|
|
||||||
linux*)
|
|
||||||
- tmp_disk=`echo "$1" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
|
|
||||||
+ tmp_disk=`echo "$1" | sed -e 's%\([shv]d[a-z]\)[0-9]*$%\1%' \
|
|
||||||
-e 's%\(d[0-9]*\)p[0-9]*$%\1%' \
|
|
||||||
-e 's%\(fd[0-9]*\)$%\1%' \
|
|
||||||
-e 's%/part[0-9]*$%/disc%' \
|
|
||||||
-e 's%\(c[0-7]d[0-9]*\).*$%\1%'`
|
|
||||||
- tmp_part=`echo "$1" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' \
|
|
||||||
+ tmp_part=`echo "$1" | sed -e 's%.*/[shv]d[a-z]\([0-9]*\)$%\1%' \
|
|
||||||
-e 's%.*d[0-9]*p%%' \
|
|
||||||
-e 's%.*/fd[0-9]*$%%' \
|
|
||||||
-e 's%.*/floppy/[0-9]*$%%' \
|
|
@ -1,59 +0,0 @@
|
|||||||
### Global settings
|
|
||||||
|
|
||||||
## CRUX splash image
|
|
||||||
splashimage (hd0,0)/boot/grub/crux03.xpm.gz
|
|
||||||
## define special fore-/background colors for splash screen image
|
|
||||||
foreground = FFFFFF
|
|
||||||
background = AAAAAA
|
|
||||||
|
|
||||||
## shaded text
|
|
||||||
#shade 1
|
|
||||||
|
|
||||||
## time to wait for user interaction
|
|
||||||
timeout 5
|
|
||||||
|
|
||||||
## default boot kernel
|
|
||||||
default 0
|
|
||||||
|
|
||||||
### GRUB Devices: (see /boot/grub/device.map)
|
|
||||||
##
|
|
||||||
## Linux Grub
|
|
||||||
## ======================
|
|
||||||
## /dev/sda (hd0)
|
|
||||||
## /dev/sda1 (hd0,0)
|
|
||||||
## /dev/sdb (hd1)
|
|
||||||
## /dev/sdb1 (hd1,0)
|
|
||||||
## /dev/fd0 (fd0)
|
|
||||||
|
|
||||||
## Default menu entries
|
|
||||||
|
|
||||||
title CRUX
|
|
||||||
kernel (hd0,0)/boot/vmlinuz root=/dev/sda1
|
|
||||||
|
|
||||||
title CRUX
|
|
||||||
kernel (hd0,0)/boot/vmlinuz.old root=/dev/sda1
|
|
||||||
|
|
||||||
### Special cases
|
|
||||||
|
|
||||||
## Boot special bootimage
|
|
||||||
#title Memtest
|
|
||||||
#kernel (hd0,0)/boot/memtest.bin
|
|
||||||
|
|
||||||
## Boot Microsoft Windows(TM)
|
|
||||||
#title Windows
|
|
||||||
#root (hd0,5)
|
|
||||||
#makeactive
|
|
||||||
#chainloader +1
|
|
||||||
|
|
||||||
## Boot from Floppy
|
|
||||||
#title floppy
|
|
||||||
#root (fd0)
|
|
||||||
#chainloader +1
|
|
||||||
|
|
||||||
## Boot with different /boot partition
|
|
||||||
## / = /dev/sdb2 = (hd1,1)
|
|
||||||
## /boot = /dev/sdb1 = (hd1,0)
|
|
||||||
##
|
|
||||||
#title CRUX GNU/Linux drive 2
|
|
||||||
#kernel (hd1,0)/vmlinuz root=/dev/sdb2
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user