Merge pull request #295 from rick-masters/kernel-bootstrap-phase2-v1
Kernel bootstrap phase2 v1
This commit is contained in:
commit
87e9d7db9d
File diff suppressed because it is too large
Load Diff
|
@ -35,11 +35,12 @@ def create_configuration_file(args):
|
|||
config.write(f"CHROOT_ONLY_SYSA={args.bwrap}\n")
|
||||
config.write(f"UPDATE_CHECKSUMS={args.update_checksums}\n")
|
||||
config.write(f"JOBS={args.cores}\n")
|
||||
config.write("DISK=sda1\n")
|
||||
config.write(f"INTERNAL_CI={args.internal_ci}\n")
|
||||
if (args.bare_metal or args.qemu) and not args.kernel:
|
||||
config.write("DISK=sda\n")
|
||||
config.write("KERNEL_BOOTSTRAP=True\n")
|
||||
else:
|
||||
config.write("DISK=sda1\n")
|
||||
config.write("KERNEL_BOOTSTRAP=False\n")
|
||||
config.write(f"BUILD_KERNELS={args.update_checksums or args.build_kernels}\n")
|
||||
|
||||
|
|
21
sysa.py
21
sysa.py
|
@ -13,7 +13,6 @@ import shutil
|
|||
import tarfile
|
||||
|
||||
from lib.sysgeneral import SysGeneral, stage0_arch_map
|
||||
from lib.utils import run
|
||||
|
||||
# pylint: disable=consider-using-with
|
||||
# pylint: disable=too-many-instance-attributes
|
||||
|
@ -113,6 +112,8 @@ class SysA(SysGeneral):
|
|||
for root, _, filepaths in os.walk(dirpath):
|
||||
if 'stage0-posix' in root:
|
||||
continue
|
||||
if root == os.path.join('sysc', 'distfiles'):
|
||||
continue
|
||||
with open(file_list_path, 'a', encoding="utf-8") as file_list:
|
||||
for filepath in filepaths:
|
||||
file_list.write(f"/{os.path.join(root, filepath)}\n")
|
||||
|
@ -193,12 +194,20 @@ class SysA(SysGeneral):
|
|||
|
||||
def create_builder_hex0_disk_image(self, image_file_name):
|
||||
"""Create builder-hex0 disk image"""
|
||||
run(os.path.join('sysa', 'stage0-posix', 'src',
|
||||
'bootstrap-seeds', 'POSIX', 'x86', 'hex0-seed'),
|
||||
os.path.join('kernel-bootstrap', 'builder-hex0-x86.hex0'),
|
||||
image_file_name)
|
||||
shutil.copyfile(os.path.join('sysa', 'stage0-posix', 'src', 'bootstrap-seeds',
|
||||
'NATIVE', 'x86', 'builder-hex0-x86-stage1.img'),
|
||||
image_file_name)
|
||||
|
||||
with open(image_file_name, 'ab') as image_file:
|
||||
# Append stage2 hex0 source
|
||||
with open(os.path.join('kernel-bootstrap', 'builder-hex0-x86-stage2.hex0'),
|
||||
encoding="utf-8") as infile:
|
||||
image_file.write(infile.read().encode())
|
||||
# Pad to next sector
|
||||
current_size = os.stat(image_file_name).st_size
|
||||
while current_size % 512 != 0:
|
||||
image_file.write(b'\0')
|
||||
current_size += 1
|
||||
self.append_srcfs(image_file)
|
||||
|
||||
current_size = os.stat(image_file_name).st_size
|
||||
|
@ -213,6 +222,6 @@ class SysA(SysGeneral):
|
|||
|
||||
# fill file with zeros up to desired size, one megabyte at a time
|
||||
with open(image_file_name, 'ab') as image_file:
|
||||
while current_size < 1008 * megabyte:
|
||||
while current_size < 16384 * megabyte:
|
||||
image_file.write(b'\0' * megabyte)
|
||||
current_size += megabyte
|
||||
|
|
|
@ -40,7 +40,7 @@ d7d0a5fc9117f9b3ebd287851a48716c96a3c11991365edb8890f0e203d3b810 curl-7.88.1_1.
|
|||
ed1581d1ef5d42c809a7db1c27614e0a900076e7ce08349ea4797944d41c7bc7 dhcpcd-10.0.1_0.tar.bz2
|
||||
c4008ae6b168aee4120b0f3624a1875f9e413d8f0c637708b8b04a1fb5be173c diffutils-2.7_0.tar.bz2
|
||||
bda6afcd3a390a34a57443269a4857ccc470129f7a557981778c145fd841cbd1 dist-3.5-236_0.tar.bz2
|
||||
c0514138e251062c9ac2ff1e432e01a541777bfd61480c77479ea55f5b75cdd1 e2fsprogs-1.45.7_0.tar.bz2
|
||||
5a5923e9dcbec079b032a349471627460f553a430c82bc9b4b6c0bd34ae97547 e2fsprogs-1.45.7_0.tar.bz2
|
||||
d7b7453ad400eac1ba39f99971afdc392cb8a92c557ef5d6fd9fa2625124de4a ed-1.4_0.tar.bz2
|
||||
258282c136145d8fba4d66f7e150800e7ca33e024483083a15d0dba3aeb5e86b file-5.44_0.tar.bz2
|
||||
5984d3f2d5513dd04dc97619e2809d634fc7e3692f36f770e0202a61b6b2921d findutils-4.2.33_0.tar.bz2
|
||||
|
@ -62,6 +62,7 @@ d85cff8f9ff76533287891ec2019416fa585815e514743e5b76efd9f17f5ef5c grep-3.7_0.tar
|
|||
b38422d646590600444f0ff12fee6fd738baaf471338aa67899db950d3521127 guile-3.0.9_0.tar.bz2
|
||||
8d2015b87337abbf287f7a39ee4cf53514120b5d3e90a93fe7d533dcc43f14fa help2man-1.36.4_0.tar.bz2
|
||||
3f06d1a7f1b1770d4550ff6316c7f06fd26e30bddad7c1b665f1fae80e409c8c kbd-1.15_0.tar.bz2
|
||||
d23886557310f7ff2c98898eac24b4fe8704b22e88d094e96ff996cf0d2635a4 kexec-linux-1.0.0_0.tar.bz2
|
||||
2a661da13801028f5af98e5d9f6de417c21c90df1bcef4809caf0c2094fdd8f4 kexec-tools-2.0.22_0.tar.bz2
|
||||
e89e4fc8ba4f917f4f609ba781fc13e43d31479d47a9da2ba3bc7ce5fcbbe6b3 libarchive-3.5.2_0.tar.bz2
|
||||
36550df491767bb24d2ccab304ce70a3b4956e7c0c0e0c343d922fd57cdafbdd libatomic_ops-7.6.10_0.tar.bz2
|
||||
|
|
|
@ -30,6 +30,7 @@ src_prepare() {
|
|||
src_configure() {
|
||||
./configure --prefix="${PREFIX}" \
|
||||
--sbindir="${PREFIX}/bin" \
|
||||
--disable-tls \
|
||||
with_udev_rules_dir=no \
|
||||
with_systemd_unit_dir=no
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
dd9e799311b3c505fa8efe045b969b851c60499ab41db546e5c8b545b3e19ec8 /boot/fiwix
|
|
@ -1 +0,0 @@
|
|||
https://github.com/rick-masters/Fiwix/releases/download/v1.4.0-lb1/fiwix-1.4.0-lb1.tar.gz ff57d1fbf0547a27dec4d7146eb9c17d01158ca5886de54e5b9bac2bec473ef3
|
|
@ -0,0 +1 @@
|
|||
0de298be5c0b00654ddb226c2e657d4fdd2fa0c613ffb3bb32c23c65d2257bf0 /boot/fiwix
|
|
@ -18,9 +18,9 @@ cd build
|
|||
untar --file ../src/${pkg}.tar
|
||||
cd ${pkg}
|
||||
|
||||
alias as="tcc -m32 -march=i386 -std=c89 -D__KERNEL__ -DMAX_PID_VALUE=64000000 -DCONFIG_MMAP2 -DCONFIG_64BIT_SYSCALLS -DNR_PROCS=4096 -DCHILD_MAX=4096 -DOPEN_MAX=1536 -DNR_OPENS=1536 -DINIT_PROGRAM=\"/init\" -DUTS_SYSNAME=\"Linux\" -D__VERSION__=\"tcc\" -traditional -I/sysa/fiwix-1.4.0-lb1/build/fiwix-1.4.0-lb1/include"
|
||||
alias as="tcc -m32 -march=i386 -std=c89 -D__KERNEL__ -DMAX_PID_VALUE=64000000 -DCONFIG_MMAP2 -DCONFIG_64BIT_SYSCALLS -DCONFIG_KEXEC -DNR_PROCS=4096 -DCHILD_MAX=4096 -DOPEN_MAX=1536 -DNR_OPENS=1536 -DINIT_PROGRAM=\"/init\" -DUTS_SYSNAME=\"Linux\" -D__VERSION__=\"tcc\" -traditional -I/sysa/fiwix-1.4.0-lb2/build/fiwix-1.4.0-lb2/include"
|
||||
|
||||
alias cc="tcc -m32 -march=i386 -std=c89 -D__KERNEL__ -DMAX_PID_VALUE=64000000 -DCONFIG_MMAP2 -DCONFIG_64BIT_SYSCALLS -DNR_PROCS=4096 -DCHILD_MAX=4096 -DOPEN_MAX=1536 -DNR_OPENS=1536 -DINIT_PROGRAM=\"/init\" -DUTS_SYSNAME=\"Linux\" -D__VERSION__=\"tcc\" -I/sysa/fiwix-1.4.0-lb1/build/fiwix-1.4.0-lb1/include -O2 -fno-pie -fno-common -ffreestanding -Wall -Wstrict-prototypes"
|
||||
alias cc="tcc -m32 -march=i386 -std=c89 -D__KERNEL__ -DMAX_PID_VALUE=64000000 -DCONFIG_MMAP2 -DCONFIG_64BIT_SYSCALLS -DCONFIG_KEXEC -DNR_PROCS=4096 -DCHILD_MAX=4096 -DOPEN_MAX=1536 -DNR_OPENS=1536 -DINIT_PROGRAM=\"/init\" -DUTS_SYSNAME=\"Linux\" -D__VERSION__=\"tcc\" -I/sysa/fiwix-1.4.0-lb2/build/fiwix-1.4.0-lb2/include -O2 -fno-pie -fno-common -ffreestanding -Wall -Wstrict-prototypes"
|
||||
|
||||
cd kernel
|
||||
as -c -o boot.o boot.S
|
||||
|
@ -42,6 +42,7 @@ cc -c -o sleep.o sleep.c
|
|||
cc -c -o signal.o signal.c
|
||||
cc -c -o process.o process.c
|
||||
cc -c -o multiboot.o multiboot.c
|
||||
cc -c -o kexec.o kexec.c
|
||||
|
||||
cd syscalls
|
||||
cc -c -o umount.o umount.c
|
||||
|
@ -278,6 +279,7 @@ cc -c -o floppy.o floppy.c
|
|||
cc -c -o part.o part.c
|
||||
cc -c -o ata.o ata.c
|
||||
cc -c -o ata_hd.o ata_hd.c
|
||||
cc -c -o ata_pci.o ata_pci.c
|
||||
cc -c -o atapi.o atapi.c
|
||||
cc -c -o atapi_cd.o atapi_cd.c
|
||||
cc -c -o ramdisk.o ramdisk.c
|
||||
|
@ -321,6 +323,7 @@ tcc -m32 -Wl,-Ttext=0xC0100000 -static -nostdlib -nostdinc \
|
|||
kernel/signal.o \
|
||||
kernel/process.o \
|
||||
kernel/multiboot.o \
|
||||
kernel/kexec.o \
|
||||
kernel/syscalls/umount.o \
|
||||
kernel/syscalls/getgid.o \
|
||||
kernel/syscalls/getppid.o \
|
||||
|
@ -529,6 +532,7 @@ tcc -m32 -Wl,-Ttext=0xC0100000 -static -nostdlib -nostdinc \
|
|||
drivers/block/part.o \
|
||||
drivers/block/ata.o \
|
||||
drivers/block/ata_hd.o \
|
||||
drivers/block/ata_pci.o \
|
||||
drivers/block/atapi.o \
|
||||
drivers/block/atapi_cd.o \
|
||||
drivers/block/ramdisk.o \
|
|
@ -0,0 +1 @@
|
|||
https://github.com/rick-masters/Fiwix/releases/download/v1.4.0-lb2/fiwix-1.4.0-lb2.tar.gz 44fb14fb666dcf4f5abf7f49eb3f1d92436b9d7353daa23138ff21e9ec78e30f
|
|
@ -1 +1 @@
|
|||
afb30f2e80adefc979bdffdb525cf2862897f0beefbb0740fbd05ab3246a32c9 /usr/bin/kexec-fiwix
|
||||
4f78914aef30b569a531102998e52a0514d8836204d57ff42bf0a3324968f247 /usr/bin/kexec-fiwix
|
||||
|
|
|
@ -77,10 +77,10 @@ int main() {
|
|||
puts("Preparing multiboot info for kernel...");
|
||||
|
||||
char cmdline[256];
|
||||
sprintf(cmdline, "fiwix console=/dev/ttyS0 root=/dev/ram0 ramdisksize=%d initrd=sysa.ext2", INITRD_MB * 1024);
|
||||
sprintf(cmdline, "fiwix console=/dev/ttyS0 root=/dev/ram0 ramdisksize=%d initrd=sysa.ext2 kexec_proto=linux kexec_size=67000 kexec_cmdline=\"init=/init console=ttyS0\"", INITRD_MB * 1024);
|
||||
char * boot_loader_name = "kexec-fiwix";
|
||||
|
||||
unsigned int next_avail_mem = 0x8000;
|
||||
unsigned int next_avail_mem = 0x9800;
|
||||
multiboot_info_t * pmultiboot_info = (multiboot_info_t *) next_avail_mem;
|
||||
memset(pmultiboot_info, 0, sizeof(multiboot_info_t));
|
||||
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/* SPDX-FileCopyrightText: 2023 Richard Masters <grick23@gmail.com> */
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
|
||||
int append_file(FILE *dst_file, char *src_file_name);
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char *ramdrive_file_name, *kernel_file_name, *initramfs_file_name;
|
||||
FILE *ramdrive_file;
|
||||
struct stat stats;
|
||||
uint32_t size;
|
||||
|
||||
if (argc < 3) {
|
||||
puts("Usage: fiwix-kexec-linux <ram-drive-name> <kernel-file-name> <initramfs-file-name>");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ramdrive_file_name = argv[1];
|
||||
kernel_file_name = argv[2];
|
||||
initramfs_file_name = argv[3];
|
||||
|
||||
|
||||
ramdrive_file = fopen(ramdrive_file_name, "wb");
|
||||
|
||||
/* Write length of kernel */
|
||||
if (stat(kernel_file_name, &stats) == 0) {
|
||||
size = (uint32_t) stats.st_size;
|
||||
fwrite(&size, sizeof(size), 1, ramdrive_file);
|
||||
} else {
|
||||
fprintf(stderr, "Cannot stat kernel file '%s'\n", kernel_file_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Write length of initramfs */
|
||||
if (stat(initramfs_file_name, &stats) == 0) {
|
||||
size = (uint32_t) stats.st_size;
|
||||
fwrite(&size, sizeof(size), 1, ramdrive_file);
|
||||
} else {
|
||||
fprintf(stderr, "Cannot stat initramfs file '%s'\n", initramfs_file_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (append_file(ramdrive_file, kernel_file_name)) {
|
||||
fprintf(stderr, "Cannot append kernel '%s'\n", kernel_file_name);
|
||||
exit(1);
|
||||
}
|
||||
if (append_file(ramdrive_file, initramfs_file_name)) {
|
||||
fprintf(stderr, "Cannot append initramfs '%s'\n", initramfs_file_name);
|
||||
exit(1);
|
||||
}
|
||||
fclose(ramdrive_file);
|
||||
|
||||
/* Flush ram drive writes to device */
|
||||
sync();
|
||||
|
||||
/* Perform syscall reboot to initiate kexec */
|
||||
reboot(RB_HALT_SYSTEM);
|
||||
}
|
||||
|
||||
int append_file(FILE *dst_file, char *src_file_name) {
|
||||
FILE *src_file;
|
||||
char buff[BUFSIZ];
|
||||
size_t n;
|
||||
|
||||
if (src_file = fopen(src_file_name, "rb")) {
|
||||
while ((n = fread(buff, 1, BUFSIZ, src_file)) != 0) {
|
||||
fwrite(buff, 1, n, dst_file );
|
||||
}
|
||||
fclose(src_file);
|
||||
return 0;
|
||||
} else {
|
||||
printf("Cannot open file '%s'\n", src_file_name);
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
# SPDX-FileCopyrightText: 2023 Richard Masters <grick23@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
src_get() {
|
||||
:
|
||||
}
|
||||
|
||||
src_unpack() {
|
||||
dirname=kexec-linux-1.0.0
|
||||
mkdir ${dirname}
|
||||
}
|
||||
|
||||
src_install() {
|
||||
install -D "kexec-linux" "${DESTDIR}${PREFIX}/bin/kexec-linux"
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
# SPDX-FileCopyrightText: 2023 Richard Masters <grick23@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
kexec-linux: kexec-linux.c
|
||||
gcc -static -m32 -march=i386 -o $@ $^
|
|
@ -21,6 +21,7 @@
|
|||
/usr/bin/checksum-transcriber
|
||||
/usr/bin/tcc
|
||||
/usr/bin/tcc-0.9.26
|
||||
/usr/bin/kexec-linux
|
||||
/usr/lib/mes/libc.a
|
||||
/usr/lib/mes/libgetopt.a
|
||||
/usr/lib/mes/crt1.o
|
||||
|
|
|
@ -71,7 +71,7 @@ static bool open_filedev(void)
|
|||
file_dev_name_set(input_name);
|
||||
bd = file_dev_get();
|
||||
if (!bd) {
|
||||
printf("open_filedev: fail\n");
|
||||
puts("open_filedev: fail");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -85,7 +85,7 @@ bool lwext4_mount(struct ext4_blockdev *bdev, struct ext4_bcache *bcache)
|
|||
bd = bdev;
|
||||
|
||||
if (!bd) {
|
||||
printf("lwext4_mount: no block device\n");
|
||||
puts("lwext4_mount: no block device");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -155,21 +155,21 @@ bool copy_file(char *src_path, char *dest_path)
|
|||
|
||||
err = ext4_fopen(&dest_file, dest_path, "wb");
|
||||
if (err != EOK) {
|
||||
printf("ext4_open error: %d \n", err);
|
||||
printf("ext4_open error: %d\n", err);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (src_len > 0) {
|
||||
err = ext4_fwrite(&dest_file, src_mem, src_len, 0);
|
||||
if (err != EOK) {
|
||||
printf("ext4_fwrite error: %d \n", err);
|
||||
printf("ext4_fwrite error: %d\n", err);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
err = ext4_fclose(&dest_file);
|
||||
if (err != EOK) {
|
||||
printf("ext4_fclose error: %d \n", err);
|
||||
printf("ext4_fclose error: %d\n", err);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ int main(int argc, char **argv)
|
|||
|
||||
err = ext4_mkfs(&fs, bd, &info, F_SET_EXT2_V0);
|
||||
if (err != EOK) {
|
||||
printf("ext4_mkfs error: %d \n", err);
|
||||
printf("ext4_mkfs error: %d\n", err);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -255,32 +255,44 @@ int main(int argc, char **argv)
|
|||
if (!lwext4_mount(bd, bc))
|
||||
return EXIT_FAILURE;
|
||||
|
||||
printf("ext4_dir_mk /mp/dev\n");
|
||||
puts("ext4_dir_mk /mp/dev");
|
||||
err = ext4_dir_mk("/mp/dev");
|
||||
if (err != EOK) {
|
||||
printf("ext4_dir_mk error: %d \n", err);
|
||||
printf("ext4_dir_mk error: %d\n", err);
|
||||
}
|
||||
|
||||
printf("ext4_mknod /mp/dev/console\n");
|
||||
puts("ext4_mknod /mp/dev/console");
|
||||
err = ext4_mknod("/mp/dev/console", EXT4_DE_CHRDEV, MKDEV(5, 1));
|
||||
if (err != EOK) {
|
||||
printf("ext4_mknod error: %d \n", err);
|
||||
printf("ext4_mknod error: %d\n", err);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
puts("ext4_mknod /mp/dev/ram0");
|
||||
err = ext4_mknod("/mp/dev/ram0", EXT4_DE_BLKDEV, MKDEV(1, 0));
|
||||
if (err != EOK) {
|
||||
printf("ext4_mknod error: %d\n", err);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
puts("ext4_mknod /mp/dev/ram1");
|
||||
err = ext4_mknod("/mp/dev/ram1", EXT4_DE_BLKDEV, MKDEV(1, 1));
|
||||
if (err != EOK) {
|
||||
printf("ext4_mknod error: %d\n", err);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
copy_file("/usr/bin/kaem", "/mp/init");
|
||||
copy_file("/sysa/after2.kaem", "/mp/kaem.run");
|
||||
copy_file_list("/sysa/lwext4-1.0.0-lb1/files/fiwix-file-list.txt");
|
||||
printf("ext4_dir_mk /mp/tmp\n");
|
||||
puts("ext4_dir_mk /mp/tmp");
|
||||
ext4_dir_mk("/mp/tmp");
|
||||
printf("ext4_dir_mk /mp/usr\n");
|
||||
puts("ext4_dir_mk /mp/usr");
|
||||
ext4_dir_mk("/mp/usr");
|
||||
printf("ext4_dir_mk /mp/usr/src\n");
|
||||
puts("ext4_dir_mk /mp/usr/src");
|
||||
ext4_dir_mk("/mp/usr/src");
|
||||
|
||||
if (!lwext4_umount())
|
||||
return EXIT_FAILURE;
|
||||
|
||||
printf("Fiwix ext2 initrd created successfully.\n");
|
||||
puts("Fiwix ext2 initrd created successfully.");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
0a3f0012c01cb5aee0643f1674f265e68b5eeadb37596bcc4fe60aad55c9d3d7 /usr/bin/make_fiwix_initrd
|
||||
7b65748dd946f1a5266b2e6d0c9cf7143b4722dae0dd4a02b89d6fba9909e2bd /usr/bin/make_fiwix_initrd
|
||||
|
|
|
@ -57,7 +57,7 @@ fi
|
|||
|
||||
if match x${BUILD_FIWIX} xTrue; then
|
||||
# The Fiwix kernel
|
||||
pkg="fiwix-1.4.0-lb1"
|
||||
pkg="fiwix-1.4.0-lb2"
|
||||
cd ${pkg}
|
||||
kaem --verbose --file ${pkg}.kaem
|
||||
cd ..
|
||||
|
|
33
sysa/run2.sh
33
sysa/run2.sh
|
@ -25,16 +25,20 @@ create_sysb() {
|
|||
}
|
||||
|
||||
go_sysb() {
|
||||
# Mount proc for kexec
|
||||
mkdir /proc /etc
|
||||
mount -t proc proc /proc
|
||||
# kexec time
|
||||
echo "Loading kernel + sysb initramfs using kexec"
|
||||
kexec -l "/boot/linux-4.9.10" --console-serial \
|
||||
--initrd="/boot/initramfs-sysb.cpio.gz" \
|
||||
--append="init=/init console=ttyS0"
|
||||
echo "kexecing into sysb"
|
||||
kexec -e
|
||||
if [ "${KERNEL_BOOTSTRAP}" = True ]; then
|
||||
kexec-linux "/dev/ram1" "/boot/linux-4.9.10" "/boot/initramfs-sysb.cpio.gz"
|
||||
else
|
||||
# Mount proc for kexec
|
||||
mkdir /proc /etc
|
||||
mount -t proc proc /proc
|
||||
# kexec time
|
||||
echo "Loading kernel + sysb initramfs using kexec"
|
||||
kexec -l "/boot/linux-4.9.10" --console-serial \
|
||||
--initrd="/boot/initramfs-sysb.cpio.gz" \
|
||||
--append="init=/init console=ttyS0"
|
||||
echo "kexecing into sysb"
|
||||
kexec -e
|
||||
fi
|
||||
}
|
||||
|
||||
build automake-1.15.1
|
||||
|
@ -87,6 +91,8 @@ grep --no-filename '^build' "${SOURCES}"/run*.sh | grep -v musl-1.2.3 | sed "s/b
|
|||
done
|
||||
|
||||
if [ "${CHROOT}" = False ] || [ "${BUILD_KERNELS}" = True ]; then
|
||||
build kexec-linux-1.0.0
|
||||
|
||||
build kexec-tools-2.0.22
|
||||
|
||||
build linux-4.9.10
|
||||
|
@ -96,12 +102,7 @@ build musl-1.2.3 '' no-patches
|
|||
|
||||
if [ "${CHROOT}" = False ]; then
|
||||
create_sysb
|
||||
if [ "${KERNEL_BOOTSTRAP}" = True ]; then
|
||||
echo "Kernel bootstrapping successful."
|
||||
echo "NOTE: Transition to Linux and building remaining packages is under development."
|
||||
else
|
||||
go_sysb
|
||||
fi
|
||||
go_sysb
|
||||
else
|
||||
# In chroot mode transition directly into System C.
|
||||
SYSC=/sysc_image
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit fe529ef2e1053cb0551fb71276f9ced9fe229d87
|
||||
Subproject commit 5805beef1754945e280a07f193346710ba2b4d32
|
14
sysb/run.sh
14
sysb/run.sh
|
@ -65,15 +65,15 @@ if [ -z "${DISK}" ] || ! [ -e "/dev/${DISK}" ]; then
|
|||
echo "DISK=${DISK}" >> /usr/src/bootstrap.cfg
|
||||
fi
|
||||
|
||||
# Is it a full disk, and not a partition
|
||||
# Is it a full disk, and not a partition?
|
||||
# shellcheck disable=SC2012
|
||||
if [ $(($(ls -l "/dev/${DISK}" | sed "s/.*, *//" | sed "s/ .*//") % 8)) -eq 0 ]; then
|
||||
if ! fdisk -l "/dev/${DISK}" | grep -qE "${DISK}p?[0-9]" ; then
|
||||
echo "Creating partition table and partition"
|
||||
echo ";" | sfdisk "/dev/${DISK}"
|
||||
mkfs.ext4 "/dev/${DISK}1"
|
||||
DISK="${DISK}1"
|
||||
fi
|
||||
echo "Creating partition table..."
|
||||
echo ";" | sfdisk "/dev/${DISK}"
|
||||
fdisk -l "/dev/${DISK}"
|
||||
echo "Creating ext4 partition..."
|
||||
mkfs.ext4 "/dev/${DISK}1"
|
||||
DISK="${DISK}1"
|
||||
fi
|
||||
echo "export DISK=${DISK}" >> /usr/src/bootstrap.cfg
|
||||
|
||||
|
|
Loading…
Reference in New Issue