I've been following this tutorial showing you how to write a custom kernel for the raspberry pi. Everything's working out well, but I can't figure out how to read files from the boot partition of the sd card.
I'm able to detect if the file is there by looking at the return value of the open
function and get the file's size using fstat
, but I'm not able to read the contents at all. Is there something I'm missing or forgetting to do?
The OK LED (and other GPIO) is the only output I have, so I'm using that to signal that the file has been read.
int pfd = open("hello.txt", O_RDWR);
char buf[100];
ssize_t bytes_read = read(pfd, &buf, 2);
if (bytes_read == 0) {
LED_ON();
}
The LED doesn't turn on :(