forked from ish-app/ish
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add linux submodule, build it from meson
- Loading branch information
Showing
13 changed files
with
324 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh -e | ||
repo_root="$(realpath "$(dirname $0)/..")" | ||
sub_path=deps/linux | ||
sub_repo="$repo_root/$sub_path" | ||
git submodule init "$sub_path" | ||
git clone "$(git config submodule.$sub_path.url)" --depth=1 --sparse --filter=blob:none "$sub_repo" | ||
git -C "$sub_repo" sparse-checkout set --stdin < "$sub_repo/../linux-sparse.txt" | ||
git config --local submodule.$sub_path.update checkout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash -e | ||
output="$1" | ||
srctree="$2" | ||
objtree="$3" | ||
depfile="$4" | ||
export ISH_CFLAGS="$5" | ||
export LIB_ISH_EMU="$6" | ||
export ARCH=ish | ||
|
||
mkdir -p "$objtree" | ||
export ISH_MESON_VARS="$(realpath "$objtree/meson_vars.mk")" | ||
cat >"$ISH_MESON_VARS" <<END | ||
export ISH_CFLAGS = $ISH_CFLAGS | ||
export LIB_ISH_EMU = $LIB_ISH_EMU | ||
END | ||
|
||
defconfig=app_defconfig | ||
if [[ "$srctree/arch/ish/configs/$defconfig" -nt "$objtree/.config" ]]; then | ||
make -C "$srctree" O="$(realpath "$objtree")" "$defconfig" | ||
fi | ||
|
||
make -C "$objtree" -j "$(nproc)" --debug=v | "$srctree/../makefilter.py" "$depfile" "$output" | ||
cp "$objtree/vmlinux" "$output" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
Makefile | ||
Kbuild | ||
Kconfig* | ||
|
||
!/arch/ | ||
/arch/ish/ | ||
/arch/x86/include/asm/ | ||
/arch/x86/include/uapi/ | ||
/arch/x86/entry/syscalls/ | ||
/arch/x86/kernel/sys_ia32.c | ||
/arch/um/scripts/Makefile.rules | ||
|
||
!/drivers/ | ||
/drivers/block/ | ||
/drivers/char/ | ||
/drivers/tty/ | ||
!/drivers/tty/serial | ||
/drivers/base/ | ||
/drivers/net/Space.c | ||
/drivers/net/loopback.c | ||
/drivers/net/veth.c | ||
|
||
!/fs/*/ | ||
/fs/xfs/xfs_sysctl.h | ||
/fs/squashfs/squashfs_fs.h | ||
/fs/iomap/ | ||
/fs/kernfs/ | ||
/fs/proc/ | ||
/fs/sysfs/ | ||
/fs/devpts/ | ||
/fs/notify/ | ||
/fs/ext4/ | ||
/fs/jbd2/ | ||
/fs/ramfs/ | ||
/fs/overlayfs/ | ||
/fs/hostfs/ | ||
/fs/exportfs/ | ||
|
||
!/net/*/ | ||
/net/core/ | ||
/net/llc/ | ||
/net/ethernet/ | ||
/net/802/ | ||
/net/sched/ | ||
/net/netlink/ | ||
/net/ethtool/ | ||
/net/netfilter/ | ||
/net/ipv4/ | ||
/net/unix/ | ||
/net/ipv6/ | ||
/net/packet/ | ||
/net/bridge/ | ||
|
||
!/include/linux/*/ | ||
/include/linux/sched/ | ||
/include/linux/device/ | ||
/include/linux/byteorder/ | ||
/include/linux/netfilter/ | ||
/include/linux/decompress/ | ||
/include/linux/gpio/ | ||
/include/linux/sunrpc/ | ||
/include/linux/unaligned/ | ||
/include/linux/pinctrl/ | ||
/include/linux/raid/ | ||
/include/linux/clk/ | ||
/include/linux/netfilter_ipv4/ | ||
/include/linux/platform_data/dsa.h | ||
!/include/dt-bindings | ||
!/include/sound | ||
|
||
!/sound | ||
!/tools | ||
!/Documentation | ||
|
||
!/include/uapi/linux/netfilter/xt_connmark.h | ||
!/include/uapi/linux/netfilter/xt_dscp.h | ||
!/include/uapi/linux/netfilter/xt_MARK.h | ||
!/include/uapi/linux/netfilter/xt_tcpmss.h | ||
!/include/uapi/linux/netfilter/xt_rateest.h | ||
!/include/uapi/linux/netfilter_ipv4/ipt_ecn.h | ||
!/include/uapi/linux/netfilter_ipv4/ipt_ttl.h | ||
!/include/uapi/linux/netfilter_ipv6/ip6t_hl.h | ||
!/net/netfilter/xt_dscp.c | ||
!/net/netfilter/xt_hl.c | ||
!/net/netfilter/xt_rateest.c | ||
!/net/netfilter/xt_tcpmss.c | ||
!/tools/memory-model/litmus-tests/Z6.0+pooncelock+pooncelock+pombonce.litmus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python3 | ||
import sys | ||
import re | ||
import os | ||
line_re = re.compile(r'^ [A-Z]+\s+') | ||
dep_re = re.compile(r'\s+Prerequisite `([^\']*)\' is older than target') | ||
deps = set() | ||
for line in sys.stdin: | ||
if line.endswith('\n'): | ||
line = line[:-1] | ||
if line_re.match(line): | ||
print(line) | ||
m = dep_re.match(line) | ||
if m: | ||
deps.add(m.group(1)) | ||
deps = [os.path.realpath(dep) for dep in sorted(deps)] | ||
deps = [dep for dep in deps if os.path.exists(dep)] | ||
with open(sys.argv[1], 'w') as f: | ||
print(f'{sys.argv[2]}: \\', file=f) | ||
for dep in deps: | ||
print(f'{dep} \\', file=f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
if get_option('kernel') == 'linux' | ||
build_linux = custom_target('linux', | ||
command: [ | ||
find_program('linux-build.sh'), | ||
'@OUTPUT0@', | ||
'@SOURCE_ROOT@/deps/linux', | ||
'@OUTPUT1@', | ||
'@DEPFILE@', | ||
|
||
# hack to find the right directories because meson is bad | ||
'-I'+meson.project_source_root(), # ISH_CFLAGS | ||
meson.project_build_root() + '/libish_emu.a', # LIB_ISH_EMU | ||
], | ||
depend_files: ['makefilter.py'], | ||
depends: [libish_emu], | ||
console: true, | ||
depfile: 'linux.d', | ||
output: ['liblinux.a', 'linux']) | ||
|
||
# Create empty include directories so the liblinux declaration doesn't throw File Not Found | ||
run_command('mkdir', [ | ||
'-p', | ||
meson.current_build_dir()+'/linux/include/generated/uapi', | ||
meson.current_build_dir()+'/linux/arch/ish/include/generated/uapi']) | ||
|
||
liblinux = declare_dependency( | ||
link_with: [libish_emu], | ||
link_whole: [build_linux[0]], | ||
link_args: [ | ||
'-sectalign', '__DATA', '__percpu_first', '1000', | ||
'-sectalign', '__DATA', '__tracepoints', '20', | ||
], | ||
compile_args: ['-include', 'linux/compiler_attributes.h', '-U__weak'], | ||
include_directories: include_directories( | ||
'linux/arch/ish/include', | ||
'linux/arch/ish/include/generated', | ||
'linux/include', | ||
'linux/arch/ish/include/uapi', | ||
'linux/arch/ish/include/generated/uapi', | ||
'linux/include/uapi', | ||
'linux/include/generated/uapi', | ||
)) | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <linux/compiler_attributes.h> | ||
#include <linux/start_kernel.h> | ||
#include <string.h> | ||
|
||
extern void run_kernel(void); | ||
|
||
int main(int argc, const char *argv[]) | ||
{ | ||
int i; | ||
for (i = 1; i < argc; i++) { | ||
if (i > 1) | ||
strcat(boot_command_line, " "); | ||
strcat(boot_command_line, argv[i]); | ||
} | ||
run_kernel(); | ||
return 0; | ||
} |
Oops, something went wrong.