Build kexec-fiwix in bindir and run it from run.kaem.
This commit is contained in:
parent
96fd7ad3e1
commit
9846c4bb82
|
@ -1,6 +1,4 @@
|
|||
# SPDX-FileCopyrightText: 2023 Richard Masters <grick23@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
cd src
|
||||
tcc -m32 -march=i386 -std=c89 -I../../tcc/tcc-0.9.27/include -o kexec-fiwix kexec-fiwix.c
|
||||
|
||||
./kexec-fiwix
|
||||
tcc -m32 -march=i386 -std=c89 -I../../tcc/tcc-0.9.27/include -o ${bindir}/kexec-fiwix kexec-fiwix.c
|
||||
|
|
|
@ -77,7 +77,7 @@ int main() {
|
|||
puts("Preparing multiboot info for kernel...");
|
||||
|
||||
char cmdline[256];
|
||||
sprintf(cmdline, "fiwix console=/dev/ttyS0 root=/dev/ram0 ramdisksize=%d initrd=image.ext2", INITRD_MB * 1024);
|
||||
sprintf(cmdline, "fiwix console=/dev/ttyS0 root=/dev/ram0 ramdisksize=%d initrd=sysa.ext2", INITRD_MB * 1024);
|
||||
char * boot_loader_name = "kexec-fiwix";
|
||||
|
||||
unsigned int next_avail_mem = 0x8000;
|
||||
|
@ -108,8 +108,8 @@ int main() {
|
|||
pmultiboot_module->mod_end = 0x1C6000 + (INITRD_MB * 1024 * 1024);
|
||||
next_avail_mem += sizeof(multiboot_module_t);
|
||||
pmultiboot_module->cmdline = next_avail_mem;
|
||||
strcpy((char *) next_avail_mem, "image.ext2");
|
||||
next_avail_mem += (strlen("image.ext2") + 1);
|
||||
strcpy((char *) next_avail_mem, "sysa.ext2");
|
||||
next_avail_mem += (strlen("sysa.ext2") + 1);
|
||||
|
||||
/* Set memory map info */
|
||||
pmultiboot_info->mmap_addr = next_avail_mem;
|
||||
|
@ -173,7 +173,7 @@ int main() {
|
|||
int filenum;
|
||||
unsigned int filename_addr;
|
||||
for (filenum = 4, filename_addr = 0x201000; filenum <= 14335; filenum++, filename_addr += 1024) {
|
||||
if (!strcmp((char *) filename_addr, "/sysa/lwext4-1.0.0-lb1/build/lwext4-1.0.0-lb1/src/image.ext2")) {
|
||||
if (!strcmp((char *) filename_addr, "/boot/sysa.ext2")) {
|
||||
printf("Found image at filenum %d\n", filenum);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2015 Grzegorz Kostka (kostka.grzegorz@gmail.com)
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2015 Grzegorz Kostka (kostka.grzegorz@gmail.com)
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -128,8 +129,10 @@ bool lwext4_umount(void)
|
|||
}
|
||||
|
||||
|
||||
bool copy_file(char *src_path, char *dest_path) {
|
||||
bool copy_file(char *src_path, char *dest_path)
|
||||
{
|
||||
|
||||
printf("copy_file: %s\n", src_path);
|
||||
ext4_file dest_file;
|
||||
FILE *src_file = fopen(src_path, "rb");
|
||||
if (!src_file) {
|
||||
|
@ -173,7 +176,8 @@ bool copy_file(char *src_path, char *dest_path) {
|
|||
free(src_mem);
|
||||
}
|
||||
|
||||
bool copy_file_list(char *file_list_path) {
|
||||
bool copy_file_list(char *file_list_path)
|
||||
{
|
||||
char src_filename[FILENAME_LENGTH];
|
||||
char dst_filename[FILENAME_LENGTH];
|
||||
|
||||
|
@ -201,10 +205,10 @@ int main(int argc, char **argv)
|
|||
|
||||
next_file_address = *((unsigned int *) 0x7F8D);
|
||||
|
||||
printf("Starting image.ext at addr 0x%08x\n", next_file_address);
|
||||
printf("Starting sysa.ext2 at addr 0x%08x\n", next_file_address);
|
||||
|
||||
/* Create zeroed out disk image file */
|
||||
input_name = "image.ext2";
|
||||
input_name = "/boot/sysa.ext2";
|
||||
|
||||
memset(zeros, 0, BLOCK_SIZE);
|
||||
FILE *ext2file = fopen(input_name, "w");
|
||||
|
@ -267,8 +271,11 @@ int main(int argc, char **argv)
|
|||
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");
|
||||
ext4_dir_mk("/mp/tmp");
|
||||
printf("ext4_dir_mk /mp/usr\n");
|
||||
ext4_dir_mk("/mp/usr");
|
||||
printf("ext4_dir_mk /mp/usr/src\n");
|
||||
ext4_dir_mk("/mp/usr/src");
|
||||
|
||||
if (!lwext4_umount())
|
||||
|
|
|
@ -56,15 +56,19 @@ if match x${KERNEL_BOOTSTRAP} xTrue; then
|
|||
pkg="lwext4-1.0.0-lb1"
|
||||
cd ${pkg}
|
||||
kaem --verbose --file ${pkg}.kaem
|
||||
cd ..
|
||||
|
||||
# Build the ext2 image
|
||||
cd build/${pkg}/src
|
||||
./make_fiwix_initrd
|
||||
cd ../../../..
|
||||
make_fiwix_initrd
|
||||
|
||||
# Live boot loader for Fiwix
|
||||
pkg="kexec-fiwix"
|
||||
cd ${pkg}
|
||||
kaem --verbose --file ${pkg}.kaem
|
||||
cd ..
|
||||
|
||||
# Boot Fiwix
|
||||
kexec-fiwix
|
||||
else
|
||||
exec kaem --verbose --file run-after-fiwix.kaem
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue