diff --git a/src/device/disk.c b/src/device/disk.c index 686261dc7c908a76ad20277bfb17b55cbd07664f..1ec49fb1924b1fb831eac520140bab2806bab74f 100644 --- a/src/device/disk.c +++ b/src/device/disk.c @@ -35,9 +35,14 @@ void init_disk() { add_pio_map ("disk", AUDIO_PORT, (void *)disk_base, space_size, disk_io_handler); add_mmio_map("disk", AUDIO_MMIO, (void *)disk_base, space_size, disk_io_handler); - fp = fopen("/home/yzh/projectn/nanos-lite/build/ramdisk.img", "r"); - assert(fp); - fseek(fp, 0, SEEK_END); - disk_base[SIZE] = ftell(fp) / 512 + 1; - fseek(fp, 0, SEEK_SET); + const char *path ="/home/yzh/projectn/nanos-lite/build/ramdisk.img"; + fp = fopen(path, "r"); + if (fp) { + fseek(fp, 0, SEEK_END); + disk_base[SIZE] = ftell(fp) / 512 + 1; + fseek(fp, 0, SEEK_SET); + } else { + Log("Can not open %s. Disable disk...", path); + disk_base[SIZE] = 0; + } } diff --git a/src/device/vga.c b/src/device/vga.c index 1855653f44018d77f518ea8f328718872d356419..474de347c4041592abb513fc5d092b05a8d81fab 100644 --- a/src/device/vga.c +++ b/src/device/vga.c @@ -26,8 +26,10 @@ #define VGACTL_PORT 0x100 // Note that this is not the standard #define VGACTL_MMIO 0xa1000100 +#ifdef SHOW_SCREEN static SDL_Renderer *renderer = NULL; static SDL_Texture *texture = NULL; +#endif static uint32_t (*vmem) [SCREEN_W] = NULL; static uint32_t *vgactl_port_base = NULL;