2022年5月16日 星期一

[Linux Porting] Porting NTFS-3G

目前Linux還不支援NTF Swrite
所以關於source code部分免費的只能使用NTFS-3G

About NTFS-3G:
http://zh.wikipedia.org/zh-hk/NTFS-3G

Download page:
http://www.tuxera.com/community/ntfs-3g-download/

Download:
http://tuxera.com/opensource/ntfs-3g-2010.3.6.tgz

1. Kernel:
File systems —>
<*> Filesystem in Userspace support

2. Build:

tar zxvf ntfs-3g-2010.3.6.tgz
cd ntfs-3g-2010.3.6


3. 產生Makefile
CC=mipsel-linux-gcc CXX=mipsel-linux-g++ LD=mipsel-linux-ld AR=mipsel-linux-ar AS=mipsel-linux-as RANLIB=mipsel-linux-ranlib NM=mipsel-linux-nm STRIP=mipsel-linux-strip CFLAGS="-mabi=32 -DL_ENDIAN -DTERMIO -O3 -g -Wall" host_os=linux-gnu host=mipsel-mips-linux-gnu ./configure –target=mipsel-unknown-linux-gnu –host=mipsel-unknown-linux-gnu –build=i686-pc-linux-gnu –prefix=

4. Modify file ./include/ntfs-3g/ntfstime.h
#if !defined __timespec_defined &&            \
((defined _TIME_H &&               \
(defined __USE_POSIX199309 || defined __USE_MISC)) ||   \
defined __need_timespec)
# define __timespec_defined   1# include    /* This defines __time_t for us.  *//* POSIX.1b structure for a time value.  This is like a `struct timeval’ but
has nanoseconds instead of microseconds.  */
struct timespec
{
__time_t tv_sec;      /* Seconds.  */
long int tv_nsec;      /* Nanoseconds.  */
};#endif /* timespec not defined and or need timespec.  */

5. Modify file ./src/ntfs-3g.c
//      #error “No known timespec member in struct stat!"
/* No known timespec member in struct stat */
struct timespec ts;
ts = ntfs2timespec(ni->last_access_time);
stbuf->st_atime = ts.tv_sec;
//stbuf->st_atimensec = ts.tv_nsec;
ts = ntfs2timespec(ni->last_mft_change_time);
stbuf->st_ctime = ts.tv_sec;
//stbuf->st_ctimensec = ts.tv_nsec;
ts = ntfs2timespec(ni->last_data_change_time);
stbuf->st_mtime = ts.tv_sec;
//stbuf->st_mtimensec = ts.tv_nsec;
#endif

6. make

7. 
程式產生在src/.libs/
library產生libntfs-3g/.libs

8. command:
./ntfs-3g /dev/sda1 /mnt/





沒有留言:

張貼留言