-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjump-builder.py
More file actions
executable file
·63 lines (54 loc) · 1.45 KB
/
Copy pathjump-builder.py
File metadata and controls
executable file
·63 lines (54 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/python3.9
# Build the jumphost
import worldbuilder
import initrd
import os
import sys
from glob import glob
import traceback
kernel = "virtio"
board = None
from worldbuilder import extend, zero_hash, sha256hex, global_mods, exists, mkdir, writefile, global_submodules
#from crosscompile import gcc, crossgcc, cross_tools_nocc, cross_tools32_nocc, cross_tools, cross, target_arch, musl
from localcompile import gcc, cross_tools_nocc, cross_tools, cross, target_arch
for modname in glob("modules/*"):
try:
with open(modname, "r") as f:
exec(f.read())
except Exception as e:
print(modname + ": failed to parse", file=sys.stderr)
print(traceback.format_exc(), file=sys.stderr)
exit(1)
initrdfile = initrd.Initrd("jump",
depends = [ "openssh" ],
filename = "initrd.cpio",
files = {
"/bin": [
"%(openssh.out_dir)s/sshd",
#"%(dropbear.bin_dir)s/ssh",
#"%(kexec.bin_dir)s/kexec",
],
"/lib": [
#"%(musl.lib_dir)s/libc.so",
],
"/": [
"init",
],
},
symlinks = [
[ "/lib/ld-musl-x86_64.so.1", "libc.so" ],
[ "/lib64", "lib" ],
],
devices = [
[ "/dev/console", "c", 5, 1 ],
],
)
initrd_filename = "%(initrd-jump)s/initrd.cpio"
bzimage = global_submodules("linux-" + kernel)
bzimage.depends.append(initrdfile)
bzimage.dep_files.append(initrd_filename)
bzimage.config_append.append('CONFIG_INITRAMFS_SOURCE="' + initrd_filename + '"')
build = worldbuilder.Builder([bzimage])
#build.check()
if not build.build_all():
exit(-1)