Skip to content

Commit 4a43791

Browse files
committed
misc changes
1 parent b62f38d commit 4a43791

File tree

7 files changed

+39
-11
lines changed

7 files changed

+39
-11
lines changed

CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,4 @@ target_include_directories(droidboot_gui PUBLIC
5757
droidboot_platforms/libc-hack/lk
5858
include
5959
.
60-
)
61-
target_compile_options(droidboot_gui PUBLIC -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer)
62-
target_link_options(droidboot_gui PUBLIC -fsanitize=address -fsanitize=undefined)
60+
)

common/droidboot_init.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,33 @@
55
/*A static variable to store the buffers*/
66
static lv_disp_draw_buf_t disp_buf;
77

8+
static void droidboot_lvgl_print(const char * buf) {
9+
droidboot_log_level ll = DROIDBOOT_LOG_ERROR;
10+
if (buf[0] == '[' && buf[1] != '\0' && buf[2] != '\0' && buf[3] != '\0' && buf[4] != '\0') {
11+
if (buf[5] == ']') {
12+
if (buf[1] == 'I' && buf[2] == 'n' && buf[3] == 'f' && buf[4] == 'o') {
13+
ll = DROIDBOOT_LOG_TRACE; // LVGL info is relatively useless and equivalent of our TRACE
14+
}
15+
if (buf[1] == 'U' && buf[2] == 's' && buf[3] == 'e' && buf[4] == 'r') {
16+
ll = DROIDBOOT_LOG_ERROR;
17+
}
18+
if (buf[1] == 'W' && buf[2] == 'a' && buf[3] == 'r' && buf[4] == 'n') {
19+
ll = DROIDBOOT_LOG_WARNING;
20+
}
21+
} else if (buf[5] != '\0' && buf[6] == ']') {
22+
if (buf[1] == 'E' && buf[2] == 'r' && buf[3] == 'r' && buf[4] == 'o' && buf[5] == 'r') {
23+
ll = DROIDBOOT_LOG_ERROR;
24+
}
25+
if (buf[1] == 'T' && buf[2] == 'r' && buf[3] == 'a' && buf[4] == 'c' && buf[5] == 'e') {
26+
ll = DROIDBOOT_LOG_TRACE;
27+
}
28+
}
29+
}
30+
droidboot_log(ll, "%s", buf);
31+
}
32+
833
droidboot_error droidboot_lvgl_init(){
34+
lv_log_register_print_cb(droidboot_lvgl_print);
935
lv_init();
1036

1137
/*Use double buffering*/

common/droidboot_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void droidboot_show_dualboot_menu()
6666
droidboot_log(DROIDBOOT_LOG_INFO, "droidboot main: found %d entries\n", droidboot_num_of_boot_entries);
6767

6868
// Init styles
69-
//droidboot_style_init(droidboot_global_config);
69+
droidboot_style_init(droidboot_global_config);
7070

7171
// Show dualboot menu
7272
droidboot_draw_dualboot_menu(droidboot_entry_list, droidboot_global_config, droidboot_num_of_boot_entries);

config_parser/droidboot_config.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ int get_dualboot_entry_count(void) {
172172
int parse_boot_entries(struct boot_entry **_entry_list) {
173173
int ret;
174174
droidboot_log(DROIDBOOT_LOG_TRACE, "hi from entries parse \n");
175-
struct boot_entry *entry_list=malloc(sizeof(struct boot_entry)*dir_count_entries(ENTRIES_DIR));
176175

177176
//ret=ext4_mount("abm_settings", "/boot/", false);
178177
// if(ret!=DROIDBOOT_EOK)
@@ -185,7 +184,9 @@ int parse_boot_entries(struct boot_entry **_entry_list) {
185184
droidboot_log(DROIDBOOT_LOG_TRACE, "config_parser: found %d entries\n");
186185
if (ret < 0) {
187186
entry_count = 0;
187+
return ret;
188188
}
189+
struct boot_entry *entry_list=malloc(sizeof(struct boot_entry)*entry_count);
189190

190191
const ext4_direntry *de;
191192
ext4_dir d;

droidboot_platforms

dualboot_gui/dualboot_menu.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ static void event_handler(lv_event_t * e)
3737
if(code == LV_EVENT_CLICKED) {
3838
//lvgl_show_boot_logo();
3939
// Lets firstly write index to metadata
40+
#ifndef PLATFORM_SIMULATOR
4041
ext4_file f;
4142
int ret = ext4_fopen(&f, "/boot/db/last_index", "wb");
4243

4344
char s[128]="";
4445
sprintf(s,"%u", index);
4546
ret=ext4_fwrite(&f, s, 128, 0);
4647
ret=ext4_fclose(&f);
48+
#endif
4749

4850
if(!strcmp((droidboot_entry_list + index)->kernel, "null"))
4951
{
@@ -191,14 +193,14 @@ void droidboot_draw_dualboot_menu(struct boot_entry *droidboot_entry_list1, stru
191193
lv_obj_set_size(win, lv_pct(100), lv_pct(100));
192194
lv_obj_t * win_title = lv_win_add_title(win, "Select OS");
193195
lv_obj_set_pos(win_title, 0, 0);
194-
//lv_obj_add_style(lv_win_get_header(win), &droidboot_win_style, 0);
195-
//lv_obj_add_style(win, &droidboot_win_style, 0);
196+
lv_obj_add_style(lv_win_get_header(win), &droidboot_win_style, 0);
197+
lv_obj_add_style(win, &droidboot_win_style, 0);
196198

197199
lv_obj_t * list1 = lv_list_create(win);
198200
lv_obj_set_size(list1, lv_pct(100), lv_pct(100));
199201
lv_obj_set_pos(list1, 0, 00);
200202
lv_obj_align(list1, LV_ALIGN_BOTTOM_MID, 0, 0);
201-
//lv_obj_add_style(list1, &droidboot_list_style, 0);
203+
lv_obj_add_style(list1, &droidboot_list_style, 0);
202204
droidboot_add_dualboot_menu_buttons(list1);
203205

204206
no_autoboot = false;

lib/lv_conf.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,12 @@
204204
*LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
205205
*LV_LOG_LEVEL_USER Only logs added by the user
206206
*LV_LOG_LEVEL_NONE Do not log anything*/
207-
#define LV_LOG_LEVEL LV_LOG_LEVEL_ERROR
207+
// this is redirected to appropriate droidboot log level so INFO is fine too
208+
#define LV_LOG_LEVEL LV_LOG_LEVEL_INFO
208209

209210
/*1: Print the log with 'printf';
210211
*0: User need to register a callback with `lv_log_register_print_cb()`*/
211-
#define LV_LOG_PRINTF 1
212+
#define LV_LOG_PRINTF 0
212213

213214
/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/
214215
#define LV_LOG_TRACE_MEM 1

0 commit comments

Comments
 (0)