Unhardcode x86 from initial steps.
This commit is contained in:
parent
5148a8e0da
commit
32ec57d62d
|
@ -165,3 +165,7 @@ class SysGeneral:
|
|||
"--directory", self.tmp_dir],
|
||||
stdin=subprocess.PIPE, stdout=initramfs)
|
||||
cpio.communicate(input='\n'.join(file_list).encode())
|
||||
|
||||
stage0_arch_map = {
|
||||
"amd64": "AMD64",
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ from sysa import SysA
|
|||
from sysb import SysB
|
||||
from sysc import SysC
|
||||
from lib.utils import run
|
||||
from lib.sysgeneral import stage0_arch_map
|
||||
|
||||
def create_configuration_file(args):
|
||||
"""
|
||||
|
@ -123,8 +124,10 @@ print(shutil.which('chroot'))
|
|||
"""
|
||||
chroot_binary = run('sudo', 'python3', '-c', find_chroot,
|
||||
capture_output=True).stdout.decode().strip()
|
||||
|
||||
# sysa
|
||||
init = os.path.join(os.sep, 'bootstrap-seeds', 'POSIX', args.arch, 'kaem-optional-seed')
|
||||
arch = stage0_arch_map.get(args.arch, args.arch)
|
||||
init = os.path.join(os.sep, 'bootstrap-seeds', 'POSIX', arch, 'kaem-optional-seed')
|
||||
run('sudo', 'env', '-i', 'PATH=/bin', chroot_binary, system_a.tmp_dir, init)
|
||||
|
||||
elif args.minikernel:
|
||||
|
|
10
sysa.py
10
sysa.py
|
@ -9,7 +9,7 @@ import os
|
|||
from distutils.dir_util import copy_tree
|
||||
import shutil
|
||||
|
||||
from lib.sysgeneral import SysGeneral
|
||||
from lib.sysgeneral import SysGeneral, stage0_arch_map
|
||||
|
||||
# pylint: disable=consider-using-with
|
||||
class SysA(SysGeneral):
|
||||
|
@ -72,14 +72,18 @@ class SysA(SysGeneral):
|
|||
stage0_posix_base_dir = os.path.join(self.sys_dir, 'stage0-posix', 'src')
|
||||
copy_tree(stage0_posix_base_dir, self.tmp_dir)
|
||||
|
||||
arch = stage0_arch_map.get(self.arch, self.arch)
|
||||
kaem_optional_seed = os.path.join(self.sys_dir, 'stage0-posix', 'src', 'bootstrap-seeds',
|
||||
'POSIX', self.arch, 'kaem-optional-seed')
|
||||
'POSIX', arch, 'kaem-optional-seed')
|
||||
shutil.copy2(kaem_optional_seed, os.path.join(self.tmp_dir, 'init'))
|
||||
|
||||
# stage0-posix hook to continue running live-bootstrap
|
||||
shutil.copy2(os.path.join(self.sys_dir, 'after.kaem'),
|
||||
shutil.copy2(os.path.join(self.sys_dir, f"after.kaem.{self.arch}"),
|
||||
os.path.join(self.tmp_dir, 'after.kaem'))
|
||||
|
||||
shutil.copy2(os.path.join(self.sys_dir, 'run.kaem'),
|
||||
os.path.join(self.tmp_dir, 'run.kaem'))
|
||||
|
||||
def after(self):
|
||||
"""
|
||||
Prepare sources in /after directory.
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
ARCH=amd64
|
||||
STAGE0_ARCH=AMD64
|
||||
exec /${STAGE0_ARCH}/bin/kaem --verbose --file run.kaem
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
ARCH=x86
|
||||
STAGE0_ARCH=x86
|
||||
exec /${ARCH}/bin/kaem --verbose --file run.kaem
|
|
@ -8,9 +8,7 @@
|
|||
|
||||
set -ex
|
||||
|
||||
ARCH=x86
|
||||
|
||||
PATH=/${ARCH}/bin
|
||||
PATH=/${STAGE0_ARCH}/bin
|
||||
|
||||
# Set commonly used variables
|
||||
sources=/after
|
||||
|
@ -29,20 +27,20 @@ mkdir ${prefix} ${bindir} ${libdir} ${incdir} ${tmpdir}
|
|||
cd ${prefix}
|
||||
|
||||
# Remove remaining dependencies on /bin (stage0-posix directory)
|
||||
cp /${ARCH}/bin/blood-elf bin/blood-elf
|
||||
cp /${ARCH}/bin/catm bin/catm
|
||||
cp /${ARCH}/bin/chmod bin/chmod
|
||||
cp /${ARCH}/bin/get_machine bin/get_machine
|
||||
cp /${ARCH}/bin/hex2 bin/hex2
|
||||
cp /${ARCH}/bin/kaem bin/kaem
|
||||
cp /${ARCH}/bin/match bin/match
|
||||
cp /${ARCH}/bin/M1 bin/M1
|
||||
cp /${ARCH}/bin/M2-Planet bin/M2-Planet
|
||||
cp /${ARCH}/bin/mkdir bin/mkdir
|
||||
cp /${ARCH}/bin/sha256sum bin/sha256sum
|
||||
cp /${ARCH}/bin/ungz bin/ungz
|
||||
cp /${ARCH}/bin/untar bin/untar
|
||||
cp /${ARCH}/bin/cp bin/cp
|
||||
cp /${STAGE0_ARCH}/bin/blood-elf bin/blood-elf
|
||||
cp /${STAGE0_ARCH}/bin/catm bin/catm
|
||||
cp /${STAGE0_ARCH}/bin/chmod bin/chmod
|
||||
cp /${STAGE0_ARCH}/bin/get_machine bin/get_machine
|
||||
cp /${STAGE0_ARCH}/bin/hex2 bin/hex2
|
||||
cp /${STAGE0_ARCH}/bin/kaem bin/kaem
|
||||
cp /${STAGE0_ARCH}/bin/match bin/match
|
||||
cp /${STAGE0_ARCH}/bin/M1 bin/M1
|
||||
cp /${STAGE0_ARCH}/bin/M2-Planet bin/M2-Planet
|
||||
cp /${STAGE0_ARCH}/bin/mkdir bin/mkdir
|
||||
cp /${STAGE0_ARCH}/bin/sha256sum bin/sha256sum
|
||||
cp /${STAGE0_ARCH}/bin/ungz bin/ungz
|
||||
cp /${STAGE0_ARCH}/bin/untar bin/untar
|
||||
cp /${STAGE0_ARCH}/bin/cp bin/cp
|
||||
|
||||
chmod 755 bin/blood-elf
|
||||
chmod 755 bin/catm
|
Loading…
Reference in New Issue