Merge remote-tracking branch 'personal/bug/loader-missing-argument' into develop
[rpi-open-firmware.git] / arm_chainloader / loader.cc
1 /*=============================================================================
2 Copyright (C) 2016 Kristina Brooks
3 All rights reserved.
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 FILE DESCRIPTION
16 Second stage bootloader.
17
18 =============================================================================*/
19
20 #include <drivers/fatfs/ff.h>
21 #include <chainloader.h>
22
23 #define logf(fmt, ...) printf("[LDR:%s]: " fmt, __FUNCTION__, ##__VA_ARGS__);
24
25 FATFS g_BootVolumeFs;
26
27 #define ROOT_VOLUME_PREFIX "0:"
28
29 static const char* g_BootFiles32[] = {
30 "zImage",
31 "kernel.img",
32 };
33
34 struct LoaderImpl {
35 inline bool file_exists(const char* path) {
36 return f_stat(path, NULL) == FR_OK;
37 }
38
39 bool read_file(const char* path, uintptr_t dest) {
40
41 }
42
43 LoaderImpl() {
44 logf("Mounting boot partitiion ...\n");
45 FRESULT r = f_mount(&g_BootVolumeFs, ROOT_VOLUME_PREFIX, 1);
46 if (r != FR_OK) {
47 panic("failed to mount boot partition, error: %d", (int)r);
48 }
49 logf("Boot partition mounted!\n");
50
51
52 }
53 };
54
55 static LoaderImpl STATIC_APP g_Loader {};
This page took 0.077128 seconds and 5 git commands to generate.