Skip to content

Commit 3614d26

Browse files
committed
fix the kallsyms errors
update musl config Signed-off-by: Godones <chenlinfeng25@outlook.com>
1 parent 5959c83 commit 3614d26

13 files changed

Lines changed: 162 additions & 100 deletions

File tree

Cargo.lock

Lines changed: 29 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -104,53 +104,55 @@ endef
104104
all:
105105

106106
install:
107-
ifeq (, $(shell which $(TRACE_EXE)))
108-
@cargo install --git https://github.com/os-module/elfinfo
109-
else
110-
@echo "elfinfo has been installed"
111-
endif
112-
107+
@if ! command -v gen_ksym >/dev/null 2>&1; then \
108+
echo "Installing gen_ksym..."; \
109+
RUSTFLAGS= cargo install --git https://github.com/Starry-OS/ksym --features=demangle; \
110+
else \
111+
echo "gen_ksym already installed."; \
112+
fi
113113

114-
build:install compile
114+
build: install compile
115115

116116
compile:
117117
RUSTFLAGS="$(RUSTFLAGS)" \
118118
cargo build --release -p kernel \
119119
--target $(TARGET) \
120120
--features $(FEATURES)
121-
122-
@riscv64-linux-gnu-ld -T $(LINKER_SCRIPT) \
123-
-o $(KERNEL_FILE) \
124-
$(KERNEL_LIB)
125-
126-
@nm -n -C ${KERNEL_FILE} | grep ' [Tt] ' | grep -v '\.L' | grep -v '$$x' \
127-
| cargo run --manifest-path ../os-modules/ext_ebpf/ksym/Cargo.toml \
128-
--bin gen_ksym_as --features="demangle" > subsystems/unwinder/src/kernel_symbol.S
129121

130-
@riscv64-linux-gnu-gcc \
131-
-c subsystems/unwinder/src/kernel_symbol.S \
132-
-o subsystems/unwinder/src/ksym.o
133122
@riscv64-linux-gnu-ld -T $(LINKER_SCRIPT) \
134123
-o $(KERNEL_FILE) \
135-
$(KERNEL_LIB) \
136-
subsystems/unwinder/src/ksym.o
124+
$(KERNEL_LIB)
125+
@echo "Generating kernel symbols at $@"
126+
@nm -n -C $(KERNEL_FILE) | grep ' [Tt] ' | grep -v '\.L' | grep -v '$$x' | RUSTFLAGS= gen_ksym > kallsyms
127+
@make copy_kallsyms
137128

138129
@#$(OBJCOPY) $(KERNEL_FILE) --strip-all -O binary $(KERNEL_BIN)
139130
@cp $(KERNEL_FILE) ./kernel-qemu
140131

132+
133+
copy_kallsyms:
134+
@-sudo umount $(FSMOUNT)
135+
@-sudo rm -rf $(FSMOUNT)
136+
@-mkdir $(FSMOUNT)
137+
@sudo mount $(IMG) $(FSMOUNT)
138+
@echo "copying kallsyms"
139+
sudo cp kallsyms $(FSMOUNT)/kallsyms
140+
@echo "copying kallsyms done"
141+
@make unmount
142+
@rm kallsyms
143+
141144
initramfs:
142145
make -C tools/initrd
143146

144147
user:
145148
@echo "Building user apps"
146149
@make all -C ./user/apps
147150
@make all -C ./user/c_apps ARCH=riscv64
148-
# @make all -C ./user/musl
151+
@make all -C ./user/musl
149152
@echo "Building user apps done"
150153

151154
sdcard:$(FS) mount testelf user initramfs
152-
@sudo umount $(FSMOUNT)
153-
@rm -rf $(FSMOUNT)
155+
@make unmount
154156

155157
run:sdcard install compile
156158
@echo qemu booot $(SMP)
@@ -209,15 +211,23 @@ jh7110:
209211
@dtc -I dtb -o dts -o jh7110.dts ./tools/jh7110-visionfive-v2.dtb
210212

211213
fat:
212-
dd if=/dev/zero of=$(IMG) bs=1M count=72;
213-
@mkfs.fat -F 32 $(IMG)
214+
# check the file if exist
215+
if [ ! -f $(IMG) ]; then \
216+
echo "Creating $(IMG)"; \
217+
dd if=/dev/zero of=$(IMG) bs=1M count=72; \
218+
mkfs.fat -F 32 $(IMG); \
219+
else \
220+
echo "$(IMG) already exists."; \
221+
fi
214222

215223
ext:
216-
@if [ `ls -l $(IMG) | awk '{print $$5}' ` -lt 2147483648 ]; then \
217-
echo "resize img to 2G"; \
218-
dd if=/dev/zero bs=1M count=2048 >> $(IMG); \
224+
if [ ! -f $(IMG) ]; then \
225+
echo "Creating $(IMG)"; \
226+
dd if=/dev/zero of=$(IMG) bs=1M count=128; \
227+
mkfs.ext4 $(IMG); \
228+
else \
229+
echo "$(IMG) already exists."; \
219230
fi
220-
@mkfs.ext4 $(IMG)
221231

222232
mount:
223233
@echo "Mounting $(IMG) to $(FSMOUNT)"
@@ -230,6 +240,11 @@ mount:
230240
@sudo mkdir $(FSMOUNT)/folder
231241
@sudo cp tools/f1.txt $(FSMOUNT)/folder
232242

243+
unmount:
244+
@echo "Unmounting $(FSMOUNT)"
245+
@sudo umount $(FSMOUNT)
246+
@-rm -rf $(FSMOUNT)
247+
233248
img-hex:
234249
@hexdump $(IMG) > test.hex
235250
@cat test.hex

kernel/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ gmanager = { path = "../subsystems/gmanager" }
2626
shim = { path = "../subsystems/shim", features = ["kernel"] }
2727
kprobe = { git = "https://github.com/Godones/ext_ebpf", rev = "9d09582" }
2828
bpf-basic = { git = "https://github.com/Godones/ext_ebpf", rev = "9d09582" }
29-
ksym = { git = "https://github.com/Godones/ext_ebpf", rev = "9d09582" }
29+
ksym = { git = "https://github.com/Godones/ext_ebpf" }
3030
rbpf = { git = "https://github.com/qmonnet/rbpf.git", default-features = false }
3131

3232

3333
riscv = "0.10"
3434
bit_field = "0.10"
3535
xmas-elf = "0.9"
3636
bitflags = "1.3"
37-
spin = "0"
37+
spin = "0.10"
3838
log = "0.4.21"
3939
vfscore = { git = "https://github.com/os-module/rvfs.git", features = [
4040
"linux_error",

kernel/src/ipc/futex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl FutexWaitManager {
130130
/// 唤醒 futex 上的至多 num 个等待的进程
131131
pub fn wake(&mut self, futex: usize, num: usize) -> AlienResult<usize> {
132132
if let Some(waiters) = self.map.get_mut(&futex) {
133-
error!("there are {} waiters, wake {}", waiters.len(), num);
133+
log::info!("there are {} waiters, wake {}", waiters.len(), num);
134134
let min_index = min(num, waiters.len());
135135
for i in 0..min_index {
136136
let task = waiters[i].wake();

0 commit comments

Comments
 (0)