Date: Wed, 18 Nov 2009 13:36:37 +0800 From: "Mr. Teo En Ming (Zhang Enming)" <space.time.universe@gmail.com> To: freebsd-amd64@freebsd.org Subject: Tutorial: How to Build and Install UFS-LINUX on Fedora 11 x86_64 Message-ID: <f712b9cf0911172136q1560a697l8864313723d8cb23@mail.gmail.com> In-Reply-To: <f712b9cf0911171019q7e7d4a23ped3b6261d21ed725@mail.gmail.com> References: <f712b9cf0911171019q7e7d4a23ped3b6261d21ed725@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
The project's official webpage is at http://sourceforge.net/projects/ufs-linux/ ufs-tools is an userspace tool to support FreeBSD's UFS/UFS2 filesystems on Linux. It is a port of libufs2 from FreeBSD. Download the latest source tarball as at 2004-01-13 10:34:33 GMT. Download link: http://sourceforge.net/projects/ufs-linux/files/ufs-tools/0.= 1/ufs-tools-0.1.tar.bz2/download After completing the download, extract the source tarball. $ tar xfvj ufs-tools-0.1.tar.bz2 Change directory into the ufs-tools source tree. $ cd ufs-tools-0.1 $ cd libufs Apply the following patch to Makefile. $ patch < Makefile-fc11.patch File Makefile-fc11.patch: <CODE> Patch by Mr. Teo En Ming (Zhang Enming) to allow ufs-linux to compile and install on Fedora 11 x86_64 Email: space.time.universe@gmail.com MSN: teoenming@hotmail.com Mobile Phone: +65-8369-2618 Location: Bedok Reservoir Road, Singapore Date: 18 November 2009 Wednesday SGT --- Makefile =A0 =A02004-01-12 20:30:15.000000000 +0800 +++ Makefile.new =A0 =A0 =A0 =A02009-11-17 22:08:55.533049112 +0800 @@ -4,16 +4,16 @@ =A0LIBUFS=3D"_LIBUFS" =A0all : block cgroup inode type sblock - =A0 =A0 =A0 cc =A0-shared -o libufs.so =A0block.o cgroup.o inode.o type.o= sblock.o + =A0 =A0 =A0 cc -fPIC -shared -o libufs.so =A0block.o cgroup.o inode.o typ= e.o sblock.o =A0block : block.c - =A0 =A0 =A0 cc -c block.c =A0-I${INCLUDE} -D${LIBUFS} + =A0 =A0 =A0 cc -fPIC -c block.c =A0-I${INCLUDE} -D${LIBUFS} =A0cgroup : cgroup.c - =A0 =A0 =A0 cc -c cgroup.c =A0-I${INCLUDE} -D${LIBUFS} + =A0 =A0 =A0 cc -fPIC -c cgroup.c =A0-I${INCLUDE} -D${LIBUFS} =A0inode : inode.c - =A0 =A0 =A0 cc -c inode.c =A0-I${INCLUDE} -D${LIBUFS} + =A0 =A0 =A0 cc -fPIC -c inode.c =A0-I${INCLUDE} -D${LIBUFS} =A0type : type.c - =A0 =A0 =A0 cc -c type.c =A0-I${INCLUDE} -D${LIBUFS} + =A0 =A0 =A0 cc -fPIC -c type.c =A0-I${INCLUDE} -D${LIBUFS} =A0sblock : sblock.c - =A0 =A0 =A0 cc -c sblock.c =A0-I${INCLUDE} -D${LIBUFS} + =A0 =A0 =A0 cc -fPIC -c sblock.c =A0-I${INCLUDE} -D${LIBUFS} =A0clean : =A0 =A0 =A0 =A0rm *.o *.so </CODE> Compile the libufs2 library. $ make $ cd ../include/ufs/ Apply the following patch to types.h C header file. $ patch < types-fc11.h.patch File types-fc11.h.patch: <CODE> Patch by Mr. Teo En Ming (Zhang Enming) to allow ufs-linux to compile and install on Fedora 11 x86_64 Email: space.time.universe@gmail.com MSN: teoenming@hotmail.com Mobile Phone: +65-8369-2618 Location: Bedok Reservoir Road, Singapore Date: 18 November 2009 Wednesday SGT --- types.h =A0 =A0 2004-01-12 17:45:13.000000000 +0800 +++ types.h.new 2009-11-17 22:17:45.248047379 +0800 @@ -5,9 +5,6 @@ =A0typedef unsigned __int8 __u8; =A0typedef signed __int8 __s8; -typedef signed =A0 __int64 __s64; -typedef unsigned __int64 __u64; - =A0typedef =A0 =A0 =A0 =A0signed =A0 __int16 =A0 =A0 =A0 =A0__s16; =A0typedef =A0 =A0 =A0 =A0unsigned __int16 =A0 =A0 =A0 =A0__u16; @@ -32,8 +29,10 @@ =A0typedef =A0 =A0 =A0 =A0int32_t __s32; =A0typedef =A0 =A0 =A0 =A0uint32_t __u32; -typedef uint64_t =A0__s64; -typedef int64_t =A0 __u64; +#if defined TYPESH >=3D 1 +typedef uint64_t =A0__u64; +typedef int64_t =A0 __s64; +#endif =A0/* =A0typedef int32_t ufs1_daddr_t; </CODE> Go back to the top level ufs-linux source directory. $ cd ../.. Apply the following set of 3 patches. $ patch < Makefile-fc11.patch File Makefile-fc11.patch: <CODE> Patch by Mr. Teo En Ming (Zhang Enming) to allow ufs-linux to compile and install on Fedora 11 x86_64 Email: space.time.universe@gmail.com MSN: teoenming@hotmail.com Mobile Phone: +65-8369-2618 Location: Bedok Reservoir Road, Singapore Date: 18 November 2009 Wednesday SGT --- Makefile =A0 =A02004-01-12 17:45:13.000000000 +0800 +++ Makefile.new =A0 =A0 =A0 =A02009-11-17 22:22:35.798046895 +0800 @@ -6,8 +6,8 @@ =A0all : mkufs mkfs =A0 =A0 =A0 =A0cc =A0-o mkufs =A0mkufs.o mkfs.o =A0libufs/libufs.so =A0mkufs : mkufs.c - =A0 =A0 =A0 cc -c mkufs.c =A0-I${INCLUDE} ${CFLGS} + =A0 =A0 =A0 cc -fno-builtin-exit -c mkufs.c =A0-I${INCLUDE} ${CFLGS} =A0mkfs : mkfs.c - =A0 =A0 =A0 cc -c mkfs.c =A0-I${INCLUDE} ${CFLGS} + =A0 =A0 =A0 cc -fno-builtin-exit -c mkfs.c =A0-I${INCLUDE} ${CFLGS} =A0clean: =A0 =A0 =A0 =A0rm *.o mkufs </CODE> $ patch < mkfs-fc11.c.patch File mkfs-fc11.c.patch: <CODE> Patch by Mr. Teo En Ming (Zhang Enming) to allow ufs-linux to compile and install on Fedora 11 x86_64 Email: space.time.universe@gmail.com MSN: teoenming@hotmail.com Mobile Phone: +65-8369-2618 Location: Bedok Reservoir Road, Singapore Date: 18 November 2009 Wednesday SGT --- mkfs.c =A0 =A0 =A02004-01-12 17:45:13.000000000 +0800 +++ mkfs.c.new =A02009-11-17 22:14:57.970921921 +0800 @@ -57,6 +57,7 @@ =A0#include <sys/ioctl.h> =A0#include <grp.h> +#define =A0 =A0 =A0 =A0TYPESH =A01 =A0#include"ufs/types.h" =A0#include"ufs/misc.h" =A0#include"ufs/dinode.h" =A0 =A0/* Taken from FreeBSD */ @@ -1043,6 +1044,7 @@ =A0* For the regression test, return predictable random values. =A0* Otherwise use a true random number generator. =A0*/ +u_int32_t arc4random(); =A0static u_int32_t =A0newfs_random(void) =A0{ </CODE> $ patch < mkufs-fc11.c.patch File mkufs-fc11.c.patch: <CODE> Patch by Mr. Teo En Ming (Zhang Enming) to allow ufs-linux to compile and install on Fedora 11 x86_64 Email: space.time.universe@gmail.com MSN: teoenming@hotmail.com Mobile Phone: +65-8369-2618 Location: Bedok Reservoir Road, Singapore Date: 18 November 2009 Wednesday SGT --- mkufs.c =A0 =A0 2004-01-13 13:36:35.000000000 +0800 +++ mkufs.c.new 2009-11-17 22:10:11.942046997 +0800 @@ -103,6 +103,7 @@ =A0static void rewritelabel(char *s, struct disklabel *lp); =A0static void usage(void); =A0static void errx(int n,char *fmt, ...); +static void err(int n,char *fmt, ...); =A0/*---------------------------------------------------------*/ </CODE> Compile the mkufs binary utility. $ make Install the library and binary. $ sudo cp libufs/libufs.so /lib64 $ sudo cp mkufs /sbin Now you have UFS2 support on Linux.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f712b9cf0911172136q1560a697l8864313723d8cb23>