Skip to content

Commit

Permalink
initial simulator build
Browse files Browse the repository at this point in the history
  • Loading branch information
nift4 committed Aug 1, 2024
1 parent 78d7d6e commit b27f0b0
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 0 deletions.
2 changes: 2 additions & 0 deletions common/droidboot_platform_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#include <droidboot_uefi_common.h>
#include <common_linuxloader.h>
#include <libc-hack.h>
#elif defined(PLATFORM_SIMULATOR)
#include <simulator.h>
#endif

void droidboot_fb_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);
Expand Down
128 changes: 128 additions & 0 deletions simulator/simulator.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
#include <stdio.h>
#include "simulator.h"
#include <android/log.h>
#include <unistd.h>

void droidboot_internal_fb_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
// TODO
}

int droidboot_internal_get_display_height()
{
return 1920; // TODO
}

int droidboot_internal_get_display_width()
{
return 1080; // TODO
}

void droidboot_internal_key_read(lv_indev_drv_t * drv, lv_indev_data_t*data)
{
// TODO
}

droidboot_error droidboot_internal_platform_init()
{
return DROIDBOOT_EOK;
}

ssize_t dridboot_internal_sd_read_block(void *buf, uint32_t block, uint count)
{
return 0; // TODO
}

ssize_t dridboot_internal_sd_write_block(const void *buf, uint32_t block, uint count)
{
return 0; // TODO
}

uint32_t droidboot_internal_sd_blklen()
{
return 0; // TODO
}

uint64_t droidboot_internal_sd_blkcnt()
{
return 0; // TODO
}

bool droidboot_internal_sd_exists()
{
return false; // TODO
}

bool droidboot_internal_have_fallback()
{
return true;
}

int droidboot_internal_get_disp_buffer_height()
{
return 0;
}

bool droidboot_internal_use_double_buffering()
{
return true;
}

void droidboot_internal_lvgl_threads_init()
{
// TODO
}


void droidboot_internal_platform_on_screen_log(const char *buf)
{
__android_log_print(ANDROID_LOG_ERROR, "droidboot", "%s", buf); // TODO
}

void droidboot_internal_platform_system_log(const char *buf)
{
__android_log_print(ANDROID_LOG_VERBOSE, "droidboot", "%s", buf);
}

void droidboot_internal_delay(unsigned int time)
{
sleep(time);
}

void droidboot_internal_boot_linux_from_ram(void *kernel_raw, off_t kernel_raw_size, void *ramdisk_raw, off_t ramdisk_size, void *dtb_raw, off_t dtb_raw_size, void *dtbo_raw, off_t dtbo_raw_size, char *options)
{
// nothing happens
}

void droidboot_internal_pre_ramdisk_load(void *kernel_raw, off_t kernel_raw_size)
{
// nothing happens
}

void *droidboot_internal_get_kernel_load_addr()
{
return NULL;
}

void *droidboot_internal_get_ramdisk_load_addr()
{
return NULL;
}

void *droidboot_internal_get_dtb_load_addr()
{
return NULL;
}

void *droidboot_internal_get_dtbo_load_addr()
{
return NULL;
}
bool droidboot_internal_append_ramdisk_to_kernel()
{
return true;
}

void droidboot_internal_platform_tasks()
{
}
38 changes: 38 additions & 0 deletions simulator/simulator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// Created by nick on 01.08.24.
//

#ifndef ABM_SIMULATOR_H
#define ABM_SIMULATOR_H

#include <lvgl.h>
#include "droidboot_error.h"

void droidboot_internal_fb_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);
int droidboot_internal_get_display_height();
int droidboot_internal_get_display_width();
void droidboot_internal_key_read(lv_indev_drv_t * drv, lv_indev_data_t*data);
droidboot_error droidboot_internal_platform_init();
ssize_t dridboot_internal_sd_read_block(void *buf, uint32_t block, uint count);
ssize_t dridboot_internal_sd_write_block(const void *buf, uint32_t block, uint count);
uint32_t droidboot_internal_sd_blklen();
uint64_t droidboot_internal_sd_blkcnt();
bool droidboot_internal_sd_exists();
bool droidboot_internal_have_fallback();
int droidboot_internal_get_disp_buffer_height();
bool droidboot_internal_use_double_buffering();
void droidboot_internal_lvgl_threads_init();
void droidboot_internal_platform_on_screen_log(const char *buf);
void droidboot_internal_platform_system_log(const char *buf);
void droidboot_internal_delay(unsigned int time);
void droidboot_internal_boot_linux_from_ram(void *kernel_raw, off_t kernel_raw_size, void *ramdisk_raw, off_t ramdisk_size, void *dtb_raw, off_t dtb_raw_size, void *dtbo_raw, off_t dtbo_raw_size, char *options);
void droidboot_internal_pre_ramdisk_load(void *kernel_raw, off_t kernel_raw_size);
void *droidboot_internal_get_kernel_load_addr();
void *droidboot_internal_get_ramdisk_load_addr();
void *droidboot_internal_get_dtb_load_addr();
void *droidboot_internal_get_dtbo_load_addr();
bool droidboot_internal_append_ramdisk_to_kernel();
void droidboot_internal_platform_tasks();


#endif //ABM_SIMULATOR_H

0 comments on commit b27f0b0

Please sign in to comment.