File tree Expand file tree Collapse file tree 5 files changed +23
-19
lines changed Expand file tree Collapse file tree 5 files changed +23
-19
lines changed Original file line number Diff line number Diff line change
1
+ # Program to auto start when kernel is ready.
2
+ # List of program can be found at build/usr/bin/
3
+ # Some of them are
4
+ # sh.out
5
+ # ls.out
6
+ # tictactoe.out
7
+ # calc.out
8
+ INIT_APPNAME ?= sh.out
9
+
1
10
ROOT_DIR = .
2
11
BUILD_DIR = build
3
12
INCLUDE_DIR = include/fuzzy
@@ -42,23 +51,9 @@ kernel_core = $(BUILD_DIR)/kernel/core
42
51
43
52
MINIMAL_DISK = $(BUILD_DIR ) /minimal_disk
44
53
45
-
46
- # Program to auto start when kernel is ready.
47
- # 1 - Tic Tac Toe
48
- # 2 - Calculator
49
- # 3 - ls
50
- # 4 - cat
51
- # 5 - sh
52
- RUN_APP_ID = 1
53
-
54
54
# Apps
55
55
SRC_APP = $(SRC_DIR ) /usr/local/src
56
56
BUILD_APP = $(BUILD_DIR ) /usr/local/bin
57
- app_calc = $(BUILD_APP ) /calc.out
58
- app_tic_tac_toe = $(BUILD_APP ) /tictactoe.out
59
- app_ls = $(BUILD_APP ) /ls.out
60
- app_cat = $(BUILD_APP ) /cat.out
61
- app_sh = $(BUILD_APP ) /sh.out
62
57
63
58
MEMORY_LOCATION_KERNEL = 0xC000
64
59
Original file line number Diff line number Diff line change @@ -8,7 +8,9 @@ $(BUILD_DIR)/external/bin/mbr_builder: external/src/mbr_builder.c
8
8
mkdir -p $(dir $@ )
9
9
$(HOST_CC ) -o $@ $<
10
10
11
- $(BUILD_DIR ) /external/out/fuzzy_mount : $(patsubst $(SRC_APP ) /% .c,$(BUILD_APP ) /% .out,$(shell find $(SRC_APP ) / -name '* .c') )
11
+ $(BUILD_DIR ) /external/out/fuzzy_mount : $(patsubst $(SRC_APP ) /% .c,$(BUILD_APP ) /% .out,$(shell find $(SRC_APP ) / -name '* .c') ) \
12
+ README.md \
13
+ .gdbinit
12
14
# not a mount
13
15
mkdir -p $@
14
16
cp -f -t $@ $^
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ debug_kernel: $(kernel_core)
7
7
$(SELF_BUILD_DIR ) /% .o : $(SELF_SRC_DIR ) /% .c $(BUILD_USR_INCLUDE_ALL )
8
8
mkdir -p $(dir $@ )
9
9
$(KERNEL_CC ) -c -o $@ \
10
+ -D INIT_APPNAME=\" $(INIT_APPNAME ) \" \
10
11
-D __SOURCE_SNAPSHOT__=$(SOURCE_SNAPSHOT ) \
11
12
-D MEMORY_LOCATION_KERNEL=$(MEMORY_LOCATION_KERNEL ) \
12
13
-D MEMORY_LOCATION_APP=$(MEMORY_LOCATION_APP ) \
Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ void kernel_core_entry() {
45
45
46
46
process_scheduler_init ();
47
47
48
- int sh_pid = spawn ("sh.out" );
49
- print_log ("first user process created: %d" , sh_pid );
48
+ int init_pid = spawn (INIT_APPNAME );
49
+ print_log ("init process created: %d" , init_pid );
50
50
interrupt_pit_enable ();
51
51
while (1 );
52
52
}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ BUILD_TEST_DIR="build_test"
6
6
MONITOR_PORT=55555
7
7
QEMU_SCREENSHOT=" /tmp/$( basename $0 .sh) .ppm"
8
8
QEMU_SCREENSHOT_ARTIFACT=" ${QEMU_SCREENSHOT% .ppm} .png"
9
+ INIT_APPNAME=" tictactoe.out"
9
10
10
11
MAGIC_WORD_SLEEP=" ##SLEEP-10s##"
11
12
@@ -88,7 +89,8 @@ export -f inject_test_code_c
88
89
# #########################################
89
90
function sync_to_src_test() {
90
91
# Prepare source code directory for tests.
91
- rsync -r " ${SRC_DIR:? } " " ${SRC_TEST_DIR:? } "
92
+ rm -r " ${SRC_TEST_DIR:? } "
93
+ cp -r " ${SRC_DIR:? } " " ${SRC_TEST_DIR:? } "
92
94
93
95
find " ${SRC_TEST_DIR:? } " -iname ' *.asm' -exec bash -c ' inject_test_code_asm "$0" "$1"' {} " $1 " \;
94
96
find " ${SRC_TEST_DIR:? } " -iname ' *.c' -exec bash -c ' inject_test_code_c "$0" "$1"' {} " $1 " \;
@@ -100,6 +102,7 @@ function sync_to_src_test() {
100
102
# COMMAND_OUTPUT
101
103
# SCREEN_CONTENT
102
104
# QEMU_PID
105
+ # INIT_APPNAME
103
106
# Arguments:
104
107
# Magic Word
105
108
# Inject Keyword
@@ -115,7 +118,10 @@ function os_test_up() {
115
118
sync_to_src_test " ${test_inject_keyword:? } "
116
119
117
120
# Turn up QEMU in background
118
- make qemu \
121
+ make clean BUILD_DIR=" ${BUILD_TEST_DIR:? } " \
122
+ && make configure \
123
+ && make qemu \
124
+ INIT_APPNAME=" ${INIT_APPNAME:? } " \
119
125
SRC_DIR=" ${SRC_TEST_DIR:? } " \
120
126
BUILD_DIR=" ${BUILD_TEST_DIR:? } " \
121
127
QEMU_SHUT_FLAGS=" " \
You can’t perform that action at this time.
0 commit comments