image creation patterns

This commit is contained in:
david 2009-05-25 17:59:02 +02:00
parent ce5d1de968
commit a6aade11c4
5 changed files with 93 additions and 28 deletions

View File

@ -1,7 +1,8 @@
bin = fftest
src = ff.c main.c diskio.c
src = ff.c main.c diskio.c
#cc950.c
objs=$(src:.c=.o)
@ -15,4 +16,58 @@ $(bin): $(objs)
clean:
rm $(bin) *.o
rm -rf $(bin) *.o
image32:
dd if=/dev/zero of=disk00.vfat bs=1M count=64
sudo mkfs.vfat -F 32 -v disk00.vfat
image_parted:
dd if=/dev/zero of=disk00.vfat bs=1M count=256
fdisk -H 32 -S 32 -C 500 disk00.vfat
# create one partion
sudo losetup -o 16384 /dev/loop0 disk00.vfat
sudo mkfs.vfat -F 32 -v /dev/loop0
sudo mount /dev/loop0 disk
sudo cp -v /var/log/*log disk/
sudo ls -al disk
sudo umount disk
sudo losetup -d /dev/loop0
image_not_parted:
dd if=/dev/zero of=disk00.vfat bs=1M count=256
fdisk -H 32 -S 32 -C 500 disk00.vfat
# no one partion
sudo losetup /dev/loop0 disk00.vfat
sudo mkfs.vfat -f 2 -F 16 -v /dev/loop0
sudo mount /dev/loop0 disk
sudo cp /var/log/*log disk/
sudo umount disk
sudo losetup -d /dev/loop0
image_no_fdisk:
dd if=/dev/zero of=disk00.vfat bs=1M count=256
sudo mkfs.vfat -I -f 2 -F 16 -v disk00.vfat
sudo mount -o loop disk00.vfat disk
sudo cp /var/log/*log disk/
sudo umount disk
image_no_dd:
rm -fv disk00.vfat
mkfs.vfat -F 32 -v -C disk00.vfat 256000
sudo mount -o loop,check=s disk00.vfat disk
sudo cp -v /var/log/*log disk/
sudo umount disk
mount:
sudo losetup /dev/loop0 disk00.vfat
sudo mount /dev/loop0 disk
umount:
sudo umount disk
sudo losetup -d /dev/loop0

View File

@ -6,29 +6,39 @@ static volatile
DSTATUS Stat = STA_NOINIT; /* Disk status */
/*
[david@slap]Transfer/ffsample/linux % sudo mkfs.vfat -F 32 -v disk00.vfat [941]
sudo losetup /dev/loop0 disk00.vfat
sudo mkfs.vfat -f 2 -F 16 -v /dev/loop0
mkfs.vfat 2.11 (12 Mar 2005)
disk00.vfat has 64 heads and 32 sectors per track,
Loop device does not match a floppy size, using default hd params
/dev/loop0 has 64 heads and 32 sectors per track,
logical sector size is 512,
using 0xf8 media descriptor, with 8192 sectors;
file system has 2 32-bit FATs and 1 sector per cluster.
FAT size is 63 sectors, and provides 8034 clusters.
Volume ID is 4a1424ec, no volume label.
filesize 4194304
*/
/*
mkfs.vfat 3.0.1 (23 Nov 2008)
disk00.vfat has 64 heads and 32 sectors per track,
logical sector size is 512,
using 0xf8 media descriptor, with 8192 sectors;
file system has 2 12-bit FATs and 4 sectors per cluster.
FAT size is 6 sectors, and provides 2036 clusters.
using 0xf8 media descriptor, with 524288 sectors;
file system has 2 16-bit FATs and 8 sectors per cluster.
FAT size is 256 sectors, and provides 65467 clusters.
Root directory contains 512 slots.
Volume ID is 7b45fab8, no volume label.
Volume ID is 4a1aab3d, no volume label.
FAT type = 2
Bytes/Cluster = 4096
Number of FATs = 2
Root DIR entries = 512
Sectors/FAT = 256
Number of clusters = 65467
FAT start (lba) = 1
DIR start (lba,clustor) = 513
Data start (lba) = 545
Ok
disk_read: sector=513 count=1 addr=0xa8009800 size=512
scan_files ret
0 files, 0 bytes.
0 folders.
261868 KB total disk space.
147456 KB available.
*/
/* Interface
@ -67,7 +77,7 @@ return 1 byte
#include <sys/mman.h>
#define IMAGE_NAME "disk01.vfat"
#define IMAGE_NAME "disk00.vfat"
int *image_addr;

View File

@ -25,7 +25,7 @@
#ifndef _FATFS
#define _FATFS
#define _WORD_ACCESS 0
#define _WORD_ACCESS 1
/* The _WORD_ACCESS option defines which access method is used to the word
/ data in the FAT structure.
/
@ -54,13 +54,13 @@
/ 3: f_lseek is removed in addition to level 2. */
#define _FS_TINY 1
#define _FS_TINY 0
/* When _FS_TINY is set to 1, FatFs uses the sector buffer in the file system
/ object instead of the sector buffer in the individual file object for file
/ data transfer. This reduces memory consumption 512 bytes each file object. */
#define _USE_STRFUNC 0
#define _USE_STRFUNC 1
/* To enable string functions, set _USE_STRFUNC to 1 or 2. */
@ -87,7 +87,7 @@
/ each volume is tied to the partitions listed in Drives[]. */
#define _CODE_PAGE 858
#define _CODE_PAGE 850
/* The _CODE_PAGE specifies the OEM code page to be used on the target system.
/ When it is non LFN configuration, there is no difference between SBCS code
/ pages. When LFN is enabled, the code page must always be set correctly.

Binary file not shown.

View File

@ -104,7 +104,7 @@ void get_line (char *buff, int len)
buff[idx++] = c;
}
}
printf("return %s\n",buff);
//printf("return %s\n",buff);
buff[idx] = 0;
}