Skip to content

Commit df0ebbb

Browse files
committed
Added extra warning levels and fixed existing warnings
1 parent a39e30d commit df0ebbb

File tree

4 files changed

+16
-31
lines changed

4 files changed

+16
-31
lines changed

boot/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export BUILD_DIR ?= build
2828
export SYSROOT_DIR ?= sysroot
2929

3030
export ASFLAGS := $(foreach d, $(DEFINES), -D$d)
31-
export CFLAGS := $(foreach d, $(DEFINES), -D$d) -ffreestanding -fno-stack-protector -fno-stack-check -MMD -MP
31+
export CFLAGS := $(foreach d, $(DEFINES), -D$d) -Wall -Wextra -ffreestanding -fno-stack-protector -fno-stack-check -MMD -MP
3232
export LDFLAGS := -nostdlib
3333

3434
export BOOT_ROOT := $(ROOT_DIR)/boot

boot/common/config/config.c

+11-29
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
/*********************************************************************************/
1919

2020
#include <lib/string.h>
21+
#include <mm/mman.h>
22+
#include <vfs/vfs.h>
2123
#include <print.h>
2224
#include <axboot.h>
2325

@@ -33,44 +35,24 @@ char *config_paths[] = {
3335

3436
void config_init(void)
3537
{
36-
void *config_file;
37-
char *config_buffer;
38-
int filesize;
38+
char *config_buf;
39+
uint8_t open = 0;
3940

4041
for (size_t i = 0; i < ARRAY_LENGTH(config_paths); i++) {
41-
//config_file = fw_file_open(NULL, config_paths[i]);
42-
if (config_file != NULL) {
42+
vfs_read("\\System\\axkrnl", &config_buf);
43+
if (config_buf != NULL) {
44+
open = 1;
4345
break;
4446
}
4547
}
4648

47-
if (config_file == NULL) {
48-
//print("No configuration file found! Please refer to the AxBoot documentation.\n");
49-
//print("Entering console...\n\n");
49+
if (open == 0) {
50+
debug("Couldn't open a configuration file! Entering console...\n");
5051
//console();
52+
while (1);
5153
}
5254

53-
//filesize = fw_file_size(config_file);
54-
//config_buffer = malloc(filesize);
55-
if (config_buffer == NULL) {
56-
log("Entering console...\r\n\r\n");
57-
//console();
58-
}
59-
60-
//fw_file_read(config_file, filesize, config_buffer);
61-
6255
// TODO: parse configuration file
6356

64-
//free(config_buffer);
65-
66-
/*
67-
if (config_errors != 0 || config_get_menu_root() == NULL) {
68-
//print("\nConfiguration invalid!\n");
69-
//print("Please correct your config file.\n");
70-
//print("Entering console...\n\n");
71-
//console();
72-
}
73-
*/
74-
75-
//fw_file_close(config_file);
57+
mem_free(config_buf);
7658
}

boot/common/fs/uefi_sfs.c

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ struct sfs_fsdata {
3434

3535
struct vfs_drive *sfs_init(char *mountpoint)
3636
{
37+
(void)mountpoint;
38+
3739
EFI_LOADED_IMAGE_PROTOCOL *loaded_image = NULL;
3840
EFI_GUID lip_guid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
3941
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *iovolume;
@@ -97,6 +99,8 @@ struct vfs_drive *sfs_init(char *mountpoint)
9799

98100
size_t sfs_read(char *filename, char **buffer, struct vfs_drive *dev, void *fsdata)
99101
{
102+
(void)dev;
103+
100104
struct sfs_fsdata *data = (struct sfs_fsdata *)fsdata;
101105
EFI_FILE_PROTOCOL *volume = data->volume;
102106
EFI_FILE_PROTOCOL *file;

boot/common/mm/mman.c

-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ void *mem_alloc(size_t n)
119119
int mem_allocat(void *addr, size_t npages)
120120
{
121121
EFI_STATUS status;
122-
void *alloc;
123122

124123
status = gBootServices->AllocatePages(AllocateAddress, EfiLoaderData, (EFI_UINTN)npages, addr);
125124
if (EFI_ERROR(status)) {

0 commit comments

Comments
 (0)