xistor 910619de4c fix missing semicolon 1 年之前
..
Makefile 426205e2a3 Added makefiles for LLVM Clang 5 年之前
Makefile.clang 9c5c2813a0 Update QEMU command in all README and Makefile 2 年之前
Makefile.gcc 9c5c2813a0 Update QEMU command in all README and Makefile 2 年之前
OLVASSEL.md 9c5c2813a0 Update QEMU command in all README and Makefile 2 年之前
README.md da37035477 Fixed typos 2 年之前
delays.c 910619de4c fix missing semicolon 1 年之前
delays.h 7ace64ba9f Initial commit 7 年之前
fat.c 1440c3c5a3 Recompiled with @laroche's patches 6 年之前
fat.h 7c337daa89 change access to unaligned data to use individual "char" 6 年之前
gpio.h 7ace64ba9f Initial commit 7 年之前
kernel8.img 8ce0f75b47 Recompiled with latest gcc 4 年之前
link.ld 7ace64ba9f Initial commit 7 年之前
main.c 7ace64ba9f Initial commit 7 年之前
mbox.c 214885df63 compute the mailbox cmd only once 6 年之前
mbox.h 7ace64ba9f Initial commit 7 年之前
sd.c 0c0b9a5b21 Fixed newline 6 年之前
sd.h 7ace64ba9f Initial commit 7 年之前
start.S ea4691947c Improve comments wrt stack setup 3 年之前
uart.c 8a80ab88b9 Clearified mbox call in uart per issue #49 6 年之前
uart.h 7ace64ba9f Initial commit 7 年之前

README.md

Tutorial 0C - Directory

Now that we can load a sector from the storage, it is time to parse it as a file system. This tutorial will show you how to list the root directory entries of a FAT16 or FAT32 partition.

$ qemu-system-aarch64 -M raspi3b -drive file=test.dd,if=sd,format=raw -serial stdio
        ... output removed for clarity ...
MBR disk identifier: 12345678
FAT partition starts at: 00000008
        ... output removed for clarity ...
FAT type: FAT16
FAT number of root diretory entries: 00000200
FAT root directory LBA: 00000034
        ... output removed for clarity ...
Attrib Cluster  Size     Name
...L.. 00000000 00000000 EFI System 
....D. 00000003 00000000 FOLDER     
.....A 00000171 0000C448 BOOTCODEBIN
.....A 0000018A 000019B3 FIXUP   DAT
.....A 0000018E 00001B10 KERNEL8 IMG
.....A 00000192 000005D6 LICENC~1BRO
.....A 00000193 002B2424 START   ELF

Fat.h, fat.c

This is easy and pretty well documented. We have to read the MBR, locate our partition, and load it's first sector (Volume Boot Record). That has the BIOS Parameter Block, which describes the FAT file system.

fat_getpartition() load and check the boot record of the first MBR partition.

fat_listdirectory() list root directory entries on the volume.

Main

Once we initialize EMMC to read sectors, we load the boot record of the first partition. If the BPB describes a valid FAT partition, we list the root directory entries in it.