Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: minor fixes on build status #45

Merged
merged 5 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lab3/user/chcore-libc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ add_custom_target(libc-configure ALL
# Compile libc
add_custom_target(libc-build ALL
WORKING_DIRECTORY ${_libc_target_dir}
COMMAND make -j${_nproc}
COMMAND bear make -j${_nproc}
DEPENDS libc-configure)

# Install libc as usual
Expand Down
Binary file modified Lab4/ramdisk/tmpfs.srv
Binary file not shown.
2 changes: 1 addition & 1 deletion Lab4/user/chcore-libc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ add_custom_target(libc-configure ALL
# Compile libc
add_custom_target(libc-build ALL
WORKING_DIRECTORY ${_libc_target_dir}
COMMAND make -j${_nproc}
COMMAND bear make -j${_nproc}
DEPENDS libc-configure)

# Install libc as usual
Expand Down
2 changes: 1 addition & 1 deletion Lab5/user/chcore-libc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ add_custom_target(libc-configure ALL
# Compile libc
add_custom_target(libc-build ALL
WORKING_DIRECTORY ${_libc_target_dir}
COMMAND make -j${_nproc}
COMMAND bear make -j${_nproc}
DEPENDS libc-configure)

# Install libc as usual
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "fs_vnode.h"
#include "fs_page_cache.h"

static int comp_vnode_key(const void *key, const struct rb_node *node)
__attribute__((unused)) static int comp_vnode_key(const void *key, const struct rb_node *node)
{
struct fs_vnode *vnode = rb_entry(node, struct fs_vnode, node);
ino_t vnode_id = *(ino_t *)key;
Expand Down
3 changes: 2 additions & 1 deletion Scripts/kernel.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ defconfig:
build:
$(Q)test -f $(LABDIR)/.config || $(CHBUILD) defconfig
$(Q)$(CHBUILD) build
$(Q)find $(LABDIR) -path */compile_commands.json \
$(Q)find -L $(LABDIR) -path */compile_commands.json \
! -path $(LABDIR)/compile_commands.json -print \
| $(SCRIPTS)/merge_compile_commands.py

clean:
$(Q)$(CHBUILD) clean
$(Q)find -L $(LABDIR) -path */compile_commands.json -exec rm {} \;

distclean:
$(Q)$(CHBUILD) distclean
Expand Down
40 changes: 29 additions & 11 deletions Scripts/merge_compile_commands.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,44 @@
#!/usr/bin/env python3
import json
import os
import re
import sys

commands = []
for file in sys.stdin:
file = file.strip()
with open(file, "r") as f:
for item in json.load(f):
if item.get("command"):
argv = item.get("command").split()
if argv := item.get("command"):
argv = argv.split()
if "musl-gcc" in argv[0]:
item["command"] = (
" ".join(
[
"/usr/bin/aarch64-linux-gnu-gcc",
"-nostdinc",
"-I{}/build/chcore-libc/include".format(os.getenv("LABDIR")),
]
+ argv[1:]
)
item["command"] = " ".join(
[
"/usr/bin/aarch64-linux-gnu-gcc",
"-nostdinc",
"-I{}/build/chcore-libc/include".format(
os.getenv("LABDIR")
),
]
+ argv[1:]
)

directory: str = item.get("directory")

if argv := item.get("arguments"):
for i, arg in enumerate(argv):
if include := re.match(r"^-I([^/]+/(.*))$", arg):
argv[i] = "-I" + "/".join([directory, include.group(1)])
elif not arg.startswith("-I"):
if file := re.match(r"^[^/]+/(.*)$", arg):
argv[i] = "/".join([directory, arg])
item["command"] = " ".join(argv)
item.pop("arguments")

file: str = item.get("file")
if not file.startswith("/"):
item["file"] = "/".join([directory, file])

commands.append(item)

with open("compile_commands.json", "w") as f:
Expand Down