2018-04-07 22:43:54 +01:00
|
|
|
#include "utils.h"
|
|
|
|
#include "hwinit.h"
|
|
|
|
#include "loader.h"
|
2018-04-08 12:06:04 +01:00
|
|
|
#include "stage2.h"
|
2018-04-08 12:13:15 +01:00
|
|
|
#include "lib/printk.h"
|
|
|
|
#include "display/video_fb.h"
|
|
|
|
|
2018-04-07 22:43:54 +01:00
|
|
|
|
2018-04-08 12:06:04 +01:00
|
|
|
/* Allow for main(int argc, void **argv) signature. */
|
|
|
|
#pragma GCC diagnostic ignored "-Wmain"
|
|
|
|
|
|
|
|
int main(int argc, void **argv) {
|
2018-04-07 22:43:54 +01:00
|
|
|
entrypoint_t entrypoint;
|
|
|
|
|
2018-04-08 12:13:15 +01:00
|
|
|
if (argc != STAGE2_ARGC || *((u32 *)argv[STAGE2_ARGV_VERSION]) != 0) {
|
|
|
|
generic_panic();
|
|
|
|
}
|
|
|
|
|
2018-04-07 22:43:54 +01:00
|
|
|
/* TODO: What other hardware init should we do here? */
|
|
|
|
|
2018-04-08 12:13:15 +01:00
|
|
|
/* Setup LFB. */
|
|
|
|
/* TODO: How can we keep the console line/offset to resume printing? */
|
|
|
|
video_init((u32 *)argv[STAGE2_ARGV_LFB]);
|
|
|
|
|
|
|
|
printk("Welcome to Atmosph\xe8re Fus\xe9" "e Stage 2!\n");
|
|
|
|
|
2018-04-07 22:43:54 +01:00
|
|
|
/* This will load all remaining binaries off of the SD. */
|
2018-04-08 12:13:15 +01:00
|
|
|
entrypoint = load_payload((const char *)argv[STAGE2_ARGV_CONFIG]);
|
2018-04-07 22:43:54 +01:00
|
|
|
|
|
|
|
/* TODO: What do we want to do in terms of argc/argv? */
|
|
|
|
entrypoint(0, NULL);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|