Boot framework rework (#45)
authorLunaixsky <lunaixsky@qq.com>
Fri, 30 Aug 2024 23:53:01 +0000 (00:53 +0100)
committerGitHub <noreply@github.com>
Fri, 30 Aug 2024 23:53:01 +0000 (00:53 +0100)
commitbffa3430fbbaaad29bec0b5bee9c1f0bfc7fd068
treeb49702e98f15e4a7ead5b94f24aab83dbef50472
parent47c4e0c19ae8526b14ce4e0d7b243f7a4dc6fafd
Boot framework rework (#45)

* remove need of grub and iso image booting

* adjust the build process and bootstrap procedure, to bypass the
  need of boot from iso image
* feat: allow custom rootfs.
* feat: add script to package rootfs with default layout.
* fix:  some left-over bugs in x86_32
* ref:  change a typo

* add `init=...` kernel option, decouple the init location

* (multiboot) use address header to instruct multiboot compliance
              to load our kernel, to give us more flexibility
* ref: make mkrootfs more flexible, by moving the rootfs structuring
       to usr/makefile
* ref: some refectoring
* fix: old mount point not being recovered when mount failed

* fix deadlock when process killed while blocked by file io

* fix: deadlock when process killed while blocked by file io.
       this bug is addressed somewhere in the past, however the latest
       refactoring break the logic.
* fix: signal delivery does not check if the process being destroyed.
* fix: procvm_mount and unmount now simply return if current mm is
       already the active one.
* fix: signal group delivery always deliver the current one, which is
       not essentially true.
* fix: incorrect thread group being terminated during terminate_process
* fix: wake the blocked reader on line_in buffer when a signal is raised
       by some control character.
* ref: some refectoring

* introduce bootmem to handle memory allocation at boot stage

* feat:  bootmem is introduce to provide memory service before
         lunaix's mm is avaliable. The implementation detail is
         left to archiecture
* ref:   we moved the preparation of boot_handoff after we have
         setup the virtual memory, to remove abuse of .*.boot sections
* fix:   remove the .bss.boot, it is not a good idea to have that
         in the middle of address space.
* feat:  add a reclaimable region that will automatically unmapped
         after exiting the bootstrapping stage. All temporary stuff
         that only matter during bootstrapping should go there.

* fix a statistical error in pmem usage stat

* ref: change u32_t to unsigned int

* dtb support (devicetre specification v0.4)

* ref:  remove trailing spaces

* remap and load the dtb during kinit stage.

* adjust the memory map of x86_32 to make room for dtb

* injection of sanitized LOAD PHDRs for kernel to setup page tables

* feat:  add a small program: elftool that give less verbose output
         than readelf. This program relies purely on standard POSIX
         library thus maximizing portability.

* manually planned program headers to make thing certain.

* remove iso packing and boot disk probing

* move -kernel/-append to autoqemu config

* dynamic high-memory setup based on linking time generated map

* fix: (vm) NX bit being lost due to incorrect pte attribute mask
* fix: (vm) instruction fetch permission issue. differentiate the
            permission for intermediate level from leaf level.
* fix:      unify all auto-generated data, now their exposed symbol
            are starts with __autogen_

* update readme, clean up out-dated stuff
76 files changed:
README.md
lunaix-os/.gitignore
lunaix-os/arch/x86/LBuild
lunaix-os/arch/x86/boot/boot_helper.c
lunaix-os/arch/x86/boot/bootmem.c [new file with mode: 0644]
lunaix-os/arch/x86/boot/i386/init32.c
lunaix-os/arch/x86/boot/i386/kremap32.c
lunaix-os/arch/x86/boot/i386/prologue32.S
lunaix-os/arch/x86/boot/mb_parser.c
lunaix-os/arch/x86/boot/x86_64/boot64.S
lunaix-os/arch/x86/boot/x86_64/init64.c
lunaix-os/arch/x86/boot/x86_64/kremap64.c
lunaix-os/arch/x86/boot/x86_64/prologue64.S
lunaix-os/arch/x86/includes/linking/boot_secs.ldx
lunaix-os/arch/x86/includes/sys/boot/bstage.h
lunaix-os/arch/x86/includes/sys/boot/multiboot.S.inc
lunaix-os/arch/x86/includes/sys/mm/memory.h
lunaix-os/arch/x86/includes/sys/mm/mempart32.h
lunaix-os/arch/x86/includes/sys/mm/pagetable.h
lunaix-os/arch/x86/mm/pmm.c
lunaix-os/hal/LBuild
lunaix-os/hal/LConfig
lunaix-os/hal/devtree.c [new file with mode: 0644]
lunaix-os/hal/term/term.c
lunaix-os/includes/hal/devtree.h [new file with mode: 0644]
lunaix-os/includes/lunaix/boot_generic.h
lunaix-os/includes/lunaix/ds/hstr.h
lunaix-os/includes/lunaix/fs.h
lunaix-os/includes/lunaix/fs/probe_boot.h [deleted file]
lunaix-os/includes/lunaix/generic/bootmem.h [new file with mode: 0644]
lunaix-os/includes/lunaix/kpreempt.h
lunaix-os/includes/lunaix/mm/pagetable.h
lunaix-os/includes/lunaix/mm/region.h
lunaix-os/includes/lunaix/process.h
lunaix-os/includes/lunaix/sections.h [new file with mode: 0644]
lunaix-os/includes/lunaix/types.h
lunaix-os/kernel.mk
lunaix-os/kernel/boot_helper.c
lunaix-os/kernel/debug/trace.c
lunaix-os/kernel/ds/mutex.c
lunaix-os/kernel/fs/LBuild
lunaix-os/kernel/fs/fsm.c
lunaix-os/kernel/fs/mount.c
lunaix-os/kernel/fs/probe_boot.c [deleted file]
lunaix-os/kernel/fs/vfs.c
lunaix-os/kernel/kinit.c
lunaix-os/kernel/lunad.c
lunaix-os/kernel/mm/fault.c
lunaix-os/kernel/mm/pmalloc_simple.c
lunaix-os/kernel/mm/procvm.c
lunaix-os/kernel/mm/vmm.c
lunaix-os/kernel/process/sched.c
lunaix-os/kernel/process/signal.c
lunaix-os/link/kernel.ldx
lunaix-os/link/lga.ldx
lunaix-os/link/lunaix.ldx
lunaix-os/live_debug.sh
lunaix-os/makefile
lunaix-os/scripts/elftool.c [new file with mode: 0644]
lunaix-os/scripts/gather-lga [moved from lunaix-os/scripts/gather_lga.sh with 100% similarity]
lunaix-os/scripts/gdb/lunadbg/mem.py
lunaix-os/scripts/gdb/lunadbg/profiling/pmstat.py
lunaix-os/scripts/gen-ksymtable [moved from lunaix-os/scripts/gen_ksymtable.sh with 72% similarity]
lunaix-os/scripts/grub/GRUB_TEMPLATE [deleted file]
lunaix-os/scripts/grub/config-grub.sh [deleted file]
lunaix-os/scripts/makefile [new file with mode: 0644]
lunaix-os/scripts/mkrootfs [new file with mode: 0755]
lunaix-os/scripts/mkrootfs-layout [new file with mode: 0755]
lunaix-os/scripts/qemu.py
lunaix-os/scripts/qemus/qemu_x86_dev.json
lunaix-os/usr/init/init.c
lunaix-os/usr/libc/arch/i386/trampoline.S
lunaix-os/usr/libc/arch/x86_64/trampoline.S
lunaix-os/usr/libc/makefile
lunaix-os/usr/makefile
lunaix-os/usr/sh/sh.c