mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
Made the fat test code compile again.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29456 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
d8f6c75ab9
commit
3a5eaa8fa9
5 changed files with 38 additions and 41 deletions
|
@ -8,57 +8,46 @@ export TARGET_INC=-I$(FIRMWARE)/target/arm/ipod/video -I$(FIRMWARE)/target/arm/i
|
||||||
DRIVERS = ../../drivers
|
DRIVERS = ../../drivers
|
||||||
EXPORT = ../../export
|
EXPORT = ../../export
|
||||||
|
|
||||||
INCLUDE = -I$(EXPORT)
|
INCLUDE = -I$(EXPORT) -I$(FIRMWARE)/include
|
||||||
|
|
||||||
RINCLUDE = -I$(FIRMWARE)/include
|
DEFINES = -DTEST_FAT -DDEBUG -DCRT_DISPLAY -DDISK_WRITE -DHAVE_FAT16SUPPORT -D__PCTOOL__
|
||||||
DEFINES = -DTEST_FAT -DDEBUG -DCRT_DISPLAY -DDISK_WRITE -DHAVE_FAT16SUPPORT
|
|
||||||
|
|
||||||
CFLAGS = -g -Wall $(DEFINES) -I. $(INCLUDE) $(RINCLUDE) $(BUILDDATE)
|
CFLAGS = -g -Wall -std=gnu99 -Wno-pointer-sign $(DEFINES) -I. $(INCLUDE) $(BUILDDATE) -I$(FIRMWARE)/libc/include
|
||||||
SIMFLAGS = -g -Wall $(DEFINES) -I. $(INCLUDE)
|
SIMFLAGS = -g -Wall -std=gnu99 -Wno-pointer-sign $(DEFINES) -I. $(INCLUDE)
|
||||||
|
|
||||||
TARGET = fat
|
TARGET = fat
|
||||||
|
|
||||||
|
all: $(TARGET)
|
||||||
|
|
||||||
$(TARGET): fat.o ata-sim.o main.o disk.o debug.o dir.o file.o ctype.o
|
$(TARGET): fat.o ata-sim.o main.o disk.o dir.o file.o ctype.o unicode.o strlcpy.o
|
||||||
gcc -g -o fat $+ -lfl
|
gcc -g -o fat $+ -lfl
|
||||||
|
|
||||||
fat.o: $(DRIVERS)/fat.c $(EXPORT)/fat.h $(EXPORT)/ata.h
|
fat.o: $(DRIVERS)/fat.c $(EXPORT)/fat.h $(EXPORT)/ata.h
|
||||||
$(CC) $(CFLAGS) -DSIMULATOR -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
ctype.o: $(FIRMWARE)/common/ctype.c
|
ctype.o: $(FIRMWARE)/libc/ctype.c
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
disk.o: $(FIRMWARE)/common/disk.c
|
disk.o: $(FIRMWARE)/common/disk.c
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
dir.o: $(FIRMWARE)/common/dir.c
|
dir.o: $(FIRMWARE)/common/dir_uncached.c
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
file.o: $(FIRMWARE)/common/file.c
|
file.o: $(FIRMWARE)/common/file.c
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
debug.o: $(FIRMWARE)/debug.c
|
unicode.o: $(FIRMWARE)/common/unicode.c
|
||||||
$(CC) $(SIMFLAGS) -DSIMULATOR -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
strlcpy.o: $(FIRMWARE)/common/strlcpy.c
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
ata-sim.o: ata-sim.c $(EXPORT)/ata.h
|
ata-sim.o: ata-sim.c $(EXPORT)/ata.h
|
||||||
$(CC) $(SIMFLAGS) -DSIMULATOR -c $< -o $@
|
$(CC) $(SIMFLAGS) -c $< -o $@
|
||||||
|
|
||||||
dir.h: $(FIRMWARE)/include/dir.h
|
main.o: main.c $(EXPORT)/ata.h
|
||||||
ln -s $(FIRMWARE)/include/dir.h .
|
|
||||||
|
|
||||||
file.h: $(FIRMWARE)/include/file.h
|
|
||||||
ln -s $(FIRMWARE)/include/file.h .
|
|
||||||
|
|
||||||
main.o: main.c $(EXPORT)/ata.h dir.h file.h
|
|
||||||
$(CC) $(SIMFLAGS) -c $< -o $@
|
$(CC) $(SIMFLAGS) -c $< -o $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o $(TARGET)
|
rm -f *.o $(TARGET)
|
||||||
rm -f *~
|
|
||||||
rm -f cmd.tab.h lex.yy.c cmd.tab.c
|
|
||||||
rm -f core
|
|
||||||
rm -f dir.h file.h
|
|
||||||
|
|
||||||
tar:
|
|
||||||
rm -f $(TARGET).tar
|
|
||||||
tar cvf $(TARGET).tar -C .. fat
|
|
||||||
|
|
|
@ -16,6 +16,13 @@ To mount the image, your linux kernel must include the loopback device:
|
||||||
|
|
||||||
Now copy some test data to the disk, umount it and start testing.
|
Now copy some test data to the disk, umount it and start testing.
|
||||||
|
|
||||||
|
The test script mounts the disk image in order to initialize it will a number
|
||||||
|
of dummy files. Since users are no longer allowed to mount loopback devices,
|
||||||
|
you can either run the test script as root (not recommended) or add a line to
|
||||||
|
your fstab file:
|
||||||
|
|
||||||
|
/path/to/disk.img /mnt/dummy vfat loop,users,noauto 0 0
|
||||||
|
|
||||||
|
|
||||||
Test code
|
Test code
|
||||||
---------
|
---------
|
||||||
|
|
|
@ -9,7 +9,7 @@ static FILE* file;
|
||||||
|
|
||||||
void panicf( const char *fmt, ... );
|
void panicf( const char *fmt, ... );
|
||||||
|
|
||||||
int ata_read_sectors(unsigned long start, int count, void* buf)
|
int storage_read_sectors(unsigned long start, int count, void* buf)
|
||||||
{
|
{
|
||||||
if ( count > 1 )
|
if ( count > 1 )
|
||||||
DEBUGF("[Reading %d blocks: 0x%lx to 0x%lx]\n",
|
DEBUGF("[Reading %d blocks: 0x%lx to 0x%lx]\n",
|
||||||
|
@ -22,14 +22,14 @@ int ata_read_sectors(unsigned long start, int count, void* buf)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(!fread(buf,BLOCK_SIZE,count,file)) {
|
if(!fread(buf,BLOCK_SIZE,count,file)) {
|
||||||
DEBUGF("ata_write_sectors(0x%x, 0x%x, 0x%x)\n", start, count, buf );
|
DEBUGF("ata_write_sectors(0x%lx, 0x%x, %p)\n", start, count, buf );
|
||||||
perror("fread");
|
perror("fread");
|
||||||
panicf("Disk error\n");
|
panicf("Disk error\n");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ata_write_sectors(unsigned long start, int count, void* buf)
|
int storage_write_sectors(unsigned long start, int count, void* buf)
|
||||||
{
|
{
|
||||||
if ( count > 1 )
|
if ( count > 1 )
|
||||||
DEBUGF("[Writing %d blocks: 0x%lx to 0x%lx]\n",
|
DEBUGF("[Writing %d blocks: 0x%lx to 0x%lx]\n",
|
||||||
|
@ -45,7 +45,7 @@ int ata_write_sectors(unsigned long start, int count, void* buf)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(!fwrite(buf,BLOCK_SIZE,count,file)) {
|
if(!fwrite(buf,BLOCK_SIZE,count,file)) {
|
||||||
DEBUGF("ata_write_sectors(0x%x, 0x%x, 0x%x)\n", start, count, buf );
|
DEBUGF("ata_write_sectors(0x%lx, 0x%x, %p)\n", start, count, buf );
|
||||||
perror("fwrite");
|
perror("fwrite");
|
||||||
panicf("Disk error\n");
|
panicf("Disk error\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,14 +8,15 @@
|
||||||
#include "disk.h"
|
#include "disk.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
#include "ata.h"
|
||||||
|
|
||||||
void dbg_dump_sector(int sec);
|
void dbg_dump_sector(int sec);
|
||||||
void dbg_dump_buffer(unsigned char *buf, int len, int offset);
|
void dbg_dump_buffer(unsigned char *buf, int len, int offset);
|
||||||
void dbg_console(void);
|
void dbg_console(void);
|
||||||
|
|
||||||
void mutex_init(void* l) {}
|
void mutex_init(struct mutex* l) {}
|
||||||
void mutex_lock(void* l) {}
|
void mutex_lock(struct mutex* l) {}
|
||||||
void mutex_unlock(void* l) {}
|
void mutex_unlock(struct mutex* l) {}
|
||||||
|
|
||||||
void panicf( char *fmt, ...)
|
void panicf( char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
@ -49,7 +50,7 @@ void dbg_dump_sector(int sec)
|
||||||
{
|
{
|
||||||
unsigned char buf[512];
|
unsigned char buf[512];
|
||||||
|
|
||||||
ata_read_sectors(sec,1,buf);
|
storage_read_sectors(sec,1,buf);
|
||||||
DEBUGF("---< Sector %d >-----------------------------------------\n", sec);
|
DEBUGF("---< Sector %d >-----------------------------------------\n", sec);
|
||||||
dbg_dump_buffer(buf, 512, 0);
|
dbg_dump_buffer(buf, 512, 0);
|
||||||
}
|
}
|
||||||
|
@ -92,8 +93,7 @@ void dbg_dir(char* currdir)
|
||||||
if (dir)
|
if (dir)
|
||||||
{
|
{
|
||||||
while ( (entry = readdir(dir)) ) {
|
while ( (entry = readdir(dir)) ) {
|
||||||
DEBUGF("%15s (%d bytes) %x\n",
|
DEBUGF("%15s %lx\n", entry->d_name, entry->startcluster);
|
||||||
entry->d_name, entry->size, entry->startcluster);
|
|
||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
}
|
}
|
||||||
|
@ -508,7 +508,7 @@ int dbg_mkdir(char* name)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
fd = mkdir(name, 0);
|
fd = mkdir(name);
|
||||||
if (fd<0) {
|
if (fd<0) {
|
||||||
DEBUGF("Failed creating directory\n");
|
DEBUGF("Failed creating directory\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -565,7 +565,7 @@ int dbg_cmd(int argc, char *argv[])
|
||||||
if (!strcasecmp(cmd, "ds"))
|
if (!strcasecmp(cmd, "ds"))
|
||||||
{
|
{
|
||||||
if ( arg1 ) {
|
if ( arg1 ) {
|
||||||
DEBUGF("secnum: %d\n", strtol(arg1, NULL, 0));
|
DEBUGF("secnum: %ld\n", strtol(arg1, NULL, 0));
|
||||||
dbg_dump_sector(strtol(arg1, NULL, 0));
|
dbg_dump_sector(strtol(arg1, NULL, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,10 @@ try() {
|
||||||
|
|
||||||
buildimage() {
|
buildimage() {
|
||||||
/sbin/mkdosfs -F 32 -s $1 $IMAGE > /dev/null
|
/sbin/mkdosfs -F 32 -s $1 $IMAGE > /dev/null
|
||||||
mount -o loop $IMAGE $MOUNT
|
#mount -o loop $IMAGE $MOUNT
|
||||||
|
mount $MOUNT
|
||||||
echo "Filling it with /etc files"
|
echo "Filling it with /etc files"
|
||||||
find /etc -type f -maxdepth 1 -exec cp {} $MOUNT \;
|
find /etc -maxdepth 1 -type f -readable -exec cp {} $MOUNT \;
|
||||||
for i in `seq 1 120`;
|
for i in `seq 1 120`;
|
||||||
do
|
do
|
||||||
echo apa > "$MOUNT/very $i long test filename so we can make sure they.work"
|
echo apa > "$MOUNT/very $i long test filename so we can make sure they.work"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue