From bb41487f9277dddccf84d49256e31931c5bea28a Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 14 Feb 2008 00:19:14 +0000 Subject: klibc-utils-fstype 1.1.1: Add rudimentary jffs2 detection. --- .../klibc/files/fstype-sane-and-vfat-jffs2.patch | 68 ++++++++++++++++++++++ packages/klibc/files/fstype-sane-and-vfat.patch | 60 ------------------- packages/klibc/klibc-utils-fstype_1.1.1.bb | 4 +- 3 files changed, 70 insertions(+), 62 deletions(-) create mode 100644 packages/klibc/files/fstype-sane-and-vfat-jffs2.patch delete mode 100644 packages/klibc/files/fstype-sane-and-vfat.patch (limited to 'packages/klibc') diff --git a/packages/klibc/files/fstype-sane-and-vfat-jffs2.patch b/packages/klibc/files/fstype-sane-and-vfat-jffs2.patch new file mode 100644 index 0000000000..e89c5adb9a --- /dev/null +++ b/packages/klibc/files/fstype-sane-and-vfat-jffs2.patch @@ -0,0 +1,68 @@ +diff -r 3c9d84425ba7 utils/fstype.c +--- a/utils/fstype.c Thu Feb 14 02:09:30 2008 +0200 ++++ b/utils/fstype.c Thu Feb 14 02:13:46 2008 +0200 +@@ -13,11 +13,18 @@ + */ + + #include ++#include + #include + #include + #include + #include + #include ++#if __BYTE_ORDER == __BIG_ENDIAN ++#include ++#else ++#include ++#endif ++ + + #define cpu_to_be32(x) __cpu_to_be32(x) /* Needed by romfs_fs.h */ + +@@ -105,6 +112,27 @@ static int romfs_image(const unsigned ch + return 0; + } + ++static int jffs2_image(const unsigned char *buf, unsigned long *blocks) ++{ ++ // Very sloppy! ;-E ++ if (*buf == 0x85 && buf[1] == 0x19) ++ return 1; ++ ++ return 0; ++} ++ ++static int vfat_image(const unsigned char *buf, unsigned long *blocks) ++{ ++ const struct romfs_super_block *sb = ++ (const struct romfs_super_block *)buf; ++ if (!strncmp(buf + 54, "FAT12 ", 8) ++ || !strncmp(buf + 54, "FAT16 ", 8) ++ || !strncmp(buf + 82, "FAT32 ", 8)) ++ return 1; ++ ++ return 0; ++} ++ + static int minix_image(const unsigned char *buf, unsigned long *blocks) + { + const struct minix_super_block *sb = +@@ -167,8 +195,6 @@ static int xfs_image(const unsigned char + (const struct xfs_sb *)buf; + + if (__be32_to_cpu(sb->sb_magicnum) == XFS_SB_MAGIC) { +- *blocks = __be64_to_cpu(sb->sb_dblocks) * +- (__be32_to_cpu(sb->sb_blocksize) / BLOCK_SIZE); + return 1; + } + return 0; +@@ -184,6 +210,8 @@ static struct imagetype images[] = { + { 0, "gzip", gzip_image }, + { 0, "cramfs", cramfs_image }, + { 0, "romfs", romfs_image }, ++ { 0, "jffs2", jffs2_image }, ++ { 0, "vfat", vfat_image }, + { 0, "xfs", xfs_image }, + { 1, "minix", minix_image }, + { 1, "ext3", ext3_image }, diff --git a/packages/klibc/files/fstype-sane-and-vfat.patch b/packages/klibc/files/fstype-sane-and-vfat.patch deleted file mode 100644 index 7b7674637a..0000000000 --- a/packages/klibc/files/fstype-sane-and-vfat.patch +++ /dev/null @@ -1,60 +0,0 @@ -Patch to compile fstype util against "normal" libc (glibc/uclicb), and to -add vfat detection. - ---- klibc-1.1.1/utils/fstype.c.org 2005-09-06 23:49:34.000000000 +0300 -+++ klibc-1.1.1/utils/fstype.c 2007-11-24 01:07:26.000000000 +0200 -@@ -13,11 +13,18 @@ - */ - - #include -+#include - #include - #include - #include - #include - #include -+#if __BYTE_ORDER == __BIG_ENDIAN -+#include -+#else -+#include -+#endif -+ - - #define cpu_to_be32(x) __cpu_to_be32(x) /* Needed by romfs_fs.h */ - -@@ -105,6 +112,18 @@ - return 0; - } - -+static int vfat_image(const unsigned char *buf, unsigned long *blocks) -+{ -+ const struct romfs_super_block *sb = -+ (const struct romfs_super_block *)buf; -+ if (!strncmp(buf + 54, "FAT12 ", 8) -+ || !strncmp(buf + 54, "FAT16 ", 8) -+ || !strncmp(buf + 82, "FAT32 ", 8)) -+ return 1; -+ -+ return 0; -+} -+ - static int minix_image(const unsigned char *buf, unsigned long *blocks) - { - const struct minix_super_block *sb = -@@ -167,8 +186,6 @@ - (const struct xfs_sb *)buf; - - if (__be32_to_cpu(sb->sb_magicnum) == XFS_SB_MAGIC) { -- *blocks = __be64_to_cpu(sb->sb_dblocks) * -- (__be32_to_cpu(sb->sb_blocksize) / BLOCK_SIZE); - return 1; - } - return 0; -@@ -184,6 +201,7 @@ - { 0, "gzip", gzip_image }, - { 0, "cramfs", cramfs_image }, - { 0, "romfs", romfs_image }, -+ { 0, "vfat", vfat_image }, - { 0, "xfs", xfs_image }, - { 1, "minix", minix_image }, - { 1, "ext3", ext3_image }, diff --git a/packages/klibc/klibc-utils-fstype_1.1.1.bb b/packages/klibc/klibc-utils-fstype_1.1.1.bb index 29ce38285c..2bcc0f6085 100644 --- a/packages/klibc/klibc-utils-fstype_1.1.1.bb +++ b/packages/klibc/klibc-utils-fstype_1.1.1.bb @@ -1,6 +1,6 @@ SRC_URI = "${KERNELORG_MIRROR}/pub/linux/libs/klibc/Stable/klibc-${PV}.tar.bz2" -SRC_URI += "file://fstype-sane-and-vfat.patch;patch=1" -PR = "r0" +SRC_URI += "file://fstype-sane-and-vfat-jffs2.patch;patch=1" +PR = "r1" S = "${WORKDIR}/klibc-${PV}" -- cgit v1.2.3