summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2011-02-28 10:48:58 +0000
committerBjörn Stenberg <bjorn@haxx.se>2011-02-28 10:48:58 +0000
commit3a5eaa8fa98f077b17e352e3afaa03d995773d5c (patch)
tree33ed45707c8829caf98217861d03cebd6a3689b4
parentd8f6c75ab94ee97e9a49ce669d74dc252225586a (diff)
downloadrockbox-3a5eaa8fa98f077b17e352e3afaa03d995773d5c.zip
rockbox-3a5eaa8fa98f077b17e352e3afaa03d995773d5c.tar.gz
rockbox-3a5eaa8fa98f077b17e352e3afaa03d995773d5c.tar.bz2
rockbox-3a5eaa8fa98f077b17e352e3afaa03d995773d5c.tar.xz
Made the fat test code compile again.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29456 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/test/fat/Makefile43
-rw-r--r--firmware/test/fat/README7
-rw-r--r--firmware/test/fat/ata-sim.c8
-rw-r--r--firmware/test/fat/main.c16
-rw-r--r--firmware/test/fat/test.sh5
5 files changed, 38 insertions, 41 deletions
diff --git a/firmware/test/fat/Makefile b/firmware/test/fat/Makefile
index cb7d1a7..74d2628 100644
--- a/firmware/test/fat/Makefile
+++ b/firmware/test/fat/Makefile
@@ -8,57 +8,46 @@ export TARGET_INC=-I$(FIRMWARE)/target/arm/ipod/video -I$(FIRMWARE)/target/arm/i
DRIVERS = ../../drivers
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
+DEFINES = -DTEST_FAT -DDEBUG -DCRT_DISPLAY -DDISK_WRITE -DHAVE_FAT16SUPPORT -D__PCTOOL__
-CFLAGS = -g -Wall $(DEFINES) -I. $(INCLUDE) $(RINCLUDE) $(BUILDDATE)
-SIMFLAGS = -g -Wall $(DEFINES) -I. $(INCLUDE)
+CFLAGS = -g -Wall -std=gnu99 -Wno-pointer-sign $(DEFINES) -I. $(INCLUDE) $(BUILDDATE) -I$(FIRMWARE)/libc/include
+SIMFLAGS = -g -Wall -std=gnu99 -Wno-pointer-sign $(DEFINES) -I. $(INCLUDE)
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
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 $@
disk.o: $(FIRMWARE)/common/disk.c
$(CC) $(CFLAGS) -c $< -o $@
-dir.o: $(FIRMWARE)/common/dir.c
+dir.o: $(FIRMWARE)/common/dir_uncached.c
$(CC) $(CFLAGS) -c $< -o $@
file.o: $(FIRMWARE)/common/file.c
$(CC) $(CFLAGS) -c $< -o $@
-debug.o: $(FIRMWARE)/debug.c
- $(CC) $(SIMFLAGS) -DSIMULATOR -c $< -o $@
-
-ata-sim.o: ata-sim.c $(EXPORT)/ata.h
- $(CC) $(SIMFLAGS) -DSIMULATOR -c $< -o $@
+unicode.o: $(FIRMWARE)/common/unicode.c
+ $(CC) $(CFLAGS) -c $< -o $@
-dir.h: $(FIRMWARE)/include/dir.h
- ln -s $(FIRMWARE)/include/dir.h .
+strlcpy.o: $(FIRMWARE)/common/strlcpy.c
+ $(CC) $(CFLAGS) -c $< -o $@
-file.h: $(FIRMWARE)/include/file.h
- ln -s $(FIRMWARE)/include/file.h .
+ata-sim.o: ata-sim.c $(EXPORT)/ata.h
+ $(CC) $(SIMFLAGS) -c $< -o $@
-main.o: main.c $(EXPORT)/ata.h dir.h file.h
+main.o: main.c $(EXPORT)/ata.h
$(CC) $(SIMFLAGS) -c $< -o $@
clean:
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
diff --git a/firmware/test/fat/README b/firmware/test/fat/README
index 76141c0..58ffe7f 100644
--- a/firmware/test/fat/README
+++ b/firmware/test/fat/README
@@ -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.
+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
---------
diff --git a/firmware/test/fat/ata-sim.c b/firmware/test/fat/ata-sim.c
index d8ed079..98fd5ad 100644
--- a/firmware/test/fat/ata-sim.c
+++ b/firmware/test/fat/ata-sim.c
@@ -9,7 +9,7 @@ static FILE* file;
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 )
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;
}
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");
panicf("Disk error\n");
}
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 )
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;
}
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");
panicf("Disk error\n");
}
diff --git a/firmware/test/fat/main.c b/firmware/test/fat/main.c
index 1cb53de..a9220d1 100644
--- a/firmware/test/fat/main.c
+++ b/firmware/test/fat/main.c
@@ -8,14 +8,15 @@
#include "disk.h"
#include "dir.h"
#include "file.h"
+#include "ata.h"
void dbg_dump_sector(int sec);
void dbg_dump_buffer(unsigned char *buf, int len, int offset);
void dbg_console(void);
-void mutex_init(void* l) {}
-void mutex_lock(void* l) {}
-void mutex_unlock(void* l) {}
+void mutex_init(struct mutex* l) {}
+void mutex_lock(struct mutex* l) {}
+void mutex_unlock(struct mutex* l) {}
void panicf( char *fmt, ...)
{
@@ -49,7 +50,7 @@ void dbg_dump_sector(int sec)
{
unsigned char buf[512];
- ata_read_sectors(sec,1,buf);
+ storage_read_sectors(sec,1,buf);
DEBUGF("---< Sector %d >-----------------------------------------\n", sec);
dbg_dump_buffer(buf, 512, 0);
}
@@ -92,8 +93,7 @@ void dbg_dir(char* currdir)
if (dir)
{
while ( (entry = readdir(dir)) ) {
- DEBUGF("%15s (%d bytes) %x\n",
- entry->d_name, entry->size, entry->startcluster);
+ DEBUGF("%15s %lx\n", entry->d_name, entry->startcluster);
}
closedir(dir);
}
@@ -508,7 +508,7 @@ int dbg_mkdir(char* name)
{
int fd;
- fd = mkdir(name, 0);
+ fd = mkdir(name);
if (fd<0) {
DEBUGF("Failed creating directory\n");
return -1;
@@ -565,7 +565,7 @@ int dbg_cmd(int argc, char *argv[])
if (!strcasecmp(cmd, "ds"))
{
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));
}
}
diff --git a/firmware/test/fat/test.sh b/firmware/test/fat/test.sh
index 921a0c8..ca0a1db 100644
--- a/firmware/test/fat/test.sh
+++ b/firmware/test/fat/test.sh
@@ -25,9 +25,10 @@ try() {
buildimage() {
/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"
- 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`;
do
echo apa > "$MOUNT/very $i long test filename so we can make sure they.work"