# mount -t ntfs-3g /dev/sda1 /root/sda1
mount: mounting /dev/sda1 on /root/sda1 failed: No such device
# ntfs-3g /dev/sda1 /root/sda1
WARNING: Deficient Linux kernel detected. Some driver features are
not available (swap file on NTFS, boot from NTFS by LILO), and
unmount is not safe unless it's made sure the ntfs-3g process
naturally terminates after calling 'umount'. If you wish this
message to disappear then you should upgrade to at least kernel
version 2.6.20, or request help from your distribution to fix
the kernel problem. The below web page has more information:
http://ntfs-3g.org/support.html#fuse26
# mount
rootfs on / type rootfs (rw)
/dev/root on / type nfs (rw,noatime,vers=2,rsize=4096,wsize=4096,hard,nolock,proto=tcp,timeo=600,retrans=2,addr=192.168.10.10)
proc on /proc type proc (rw)
usbfs on /proc/bus/usb type usbfs (rw)
sysfs on /sys type sysfs (rw)
/dev/sda1 on /root/sda1 type fuse (rw,user_id=0,group_id=0,allow_other)
일단 사용법을 몰라서. 구글 검색하다 나온 rcan 님의 블로그 내용을 일단 복사해서 붙여넣었다.
[링크 : http://rcan.net/560]
기본적인 내용은 printf() 사용하는 것들이고, F_CPU는 cpu 클럭에 관한 선언문으로
AVRStudio wizard 사용시 클럭을 넣어주면 생성되는 변수이다.
타이머 관련 내용은 다음과 같다.
ISR(TIMER0_OVF_vect) // 8bit Timer0 에 대한 인터럽트 루틴
TCCR0; // 타이머 프리스케일러
TCNT0; // 타이머/타운터용 초기값
TIMSK; // 타이머 오버플로우시 인터럽트 발생
일단 TCCR0를 보자면
타이머/카운터 제어용 레지스터로서,
Bit 7 – FOC0: Force Output Compare
Bit 6, 3 – WGM01:0: Waveform Generation Mode
Bit 5:4 – COM01:0: Compare Match Output Mode Bit 2:0 – CS02:0: Clock Select
에 대한 설정을 하게 된다.
TCCR0 = 0x04 에서 0은 WGM01:0=0 으로 아래의 테이블을 보면(엄밀하게는 0x48 값의 위치이다) Timer/Counter Mode of Operation 가 Normal로 되어있다.
Normal Mode
The simplest mode of operation is the normal mode (WGM01:0 = 0). In this mode the counting direction is always up (incrementing), and no counter clear is performed. The counter simply
overruns when it passes its maximum 8-bit value (TOP = 0xFF) and then restarts from the bot- tom (0x00). In normal operation the Timer/Counter overflow flag (TOV0) will be set in the same
timer clock cycle as the TCNT0 becomes zero. The TOV0 flag in this case behaves like a ninth
bit, except that it is only set, not cleared. However, combined with the timer overflow interrupt
that automatically clears the TOV0 flag, the timer resolution can be increased by software. There
are no special cases to consider in the normal mode, a new counter value can be written anytime.
The output compare unit can be used to generate interrupts at some given time. Using the output
compare to generate waveforms in normal mode is not recommended, since this will occupy
too much of the CPU time.
이 모드에서는 0에서 부터 255까지(8bit 타이머) 증가하며,
별도의 카운터 값 리셋은 하지 않으나 오버플로우 된상태로 계속 더하므로,
실질적으로 255다음에 0부터 계속 증가하게 된다. (TCNT0는 수정하는 즉시 그 값부터 증가하게 됨)
TCCR0 = 0x04 에서 4는 CS02=1로 아래의 테이블을 보면 clkT0S/64 (From prescaler) 라고 되어있다. 즉, 입력 클럭을 64로 나누어서 느긋하게 증가시킨다.
그리고 TCNT0는
카운트를 위한 변수이고, 8bit timer/counter 이므로 0x00 에서 0xFF 즉, 0 에서 255 값을 가지며
255가 되면 overflow interrupt를 발생시킨후 0부터 다시 숫자를 증가시킨다. (normal mode)
그런데 이 변수에 복잡한 수식으로 값을 넣는 이유는 정확한 시간을 발생하기 위해서이다.
클럭마다 다르겠지만, 일단 클럭을 위에서 1/64로 주므로 64 clock 마다 1씩 증가된다. 16Mhz 에서 64clock 마다 인터럽트를 생성하면(F_CPU / Prescaler) 1초에 250,000 번 발생하게 되고 이 오버플로우 갯수를 세어 1000번을 묶으면 (tic_time == 1000 그리고 F_CPU / TICKS_PER_SEC / Prescaler) 1초에 250번의 오버플로우가 발생하게 된다.
그런데 오버플로우 값은 255 까지(총 256) 이므로, 0부터 증가해서 255까지 timer를 증가시키면
1초가 맞지 않게 되므로, TCNT0의 값을 OVERFLOW - 250 으로 하여 초기값을 맞춰주게 된다.
결과적으로 TCNT0의 값은 6이 된다.
(음.. OVERFLOW가 255여야 하지 않을려나..)
그리고 TIMSK는 이름대로 타이머 인터럽트 마스크 레지스터로,
Bit 1 – OCIE0: Timer/Counter0 Output Compare Match Interrupt Enable
Bit 0 – TOIE0: Timer/Counter0 Overflow Interrupt Enable
임베디드 개발하다보면, 크로스 컴파일은 밥먹듯 하는데..
가끔 황당한 오류가 바로 ld 관련 오류이다.
ntfs_3g_usermap-usermap.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[2]: *** [ntfs-3g.usermap] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
이녀석은 ntfs-3g 라는 녀석인데, 크로스 컴파일을 하려니 이러한 오류가 발생했다.
조금은 뜬금없기도 하고, 옵션도 문제가 없는데 왜 이러냐면은..
원인 : 크로스 컴파일 이전에 컴파일 되는지 확인하기 위해 호스트에서(i686-linux) 컴파일을 이미 했기 때문!
해결 : 머. make clean 한번 하고 ./configure 다시 해주고..
결론 : 잊지말자 make clean!
사족 : File in wrong format 인건, 당연히 링커가 아키텍쳐가 다른 파일을 조작하려 하니 포맷을 알리가 ㅋㅋ
이런 경우에는 갸우뚱 하지 말고 make clean 하고 다시 컴파일 하는게 상책이다.
음.. NTFS 드라이버라는데
신기하게(?)도 리부팅 없이, FC6 에서 바로 사용이 가능하다.
특이하게(?)도 FS는 mount 후에 fuseblk로 인식한다.
# mount -t ntfs-3g /dev/sda1 /mnt/old
# mount
/dev/hda5 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
/dev/hda3 on /var type ext3 (rw)
/dev/hdb on /home/samba type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/sda1 on /mnt/old type fuseblk (rw,allow_other,blksize=4096)