Compare commits
5 Commits
938f2390dd
...
b4665bc8ce
Author | SHA1 | Date |
---|---|---|
Jonas 'Sortie' Termansen | b4665bc8ce | |
Jonas 'Sortie' Termansen | 2465f9b5dc | |
Jonas 'Sortie' Termansen | 95cf3fba98 | |
Jonas 'Sortie' Termansen | dc98bcf0ca | |
Jonas 'Sortie' Termansen | 4aadc182a6 |
22
Makefile
22
Makefile
|
@ -75,7 +75,7 @@ BUILD_NAME:=sortix-$(RELEASE)-$(MACHINE)
|
||||||
LIVE_INITRD:=$(SORTIX_BUILDS_DIR)/$(BUILD_NAME).live.tar
|
LIVE_INITRD:=$(SORTIX_BUILDS_DIR)/$(BUILD_NAME).live.tar
|
||||||
OVERLAY_INITRD:=$(SORTIX_BUILDS_DIR)/$(BUILD_NAME).overlay.tar
|
OVERLAY_INITRD:=$(SORTIX_BUILDS_DIR)/$(BUILD_NAME).overlay.tar
|
||||||
SRC_INITRD:=$(SORTIX_BUILDS_DIR)/$(BUILD_NAME).src.tar
|
SRC_INITRD:=$(SORTIX_BUILDS_DIR)/$(BUILD_NAME).src.tar
|
||||||
SYSTEM_INITRD:=$(SORTIX_BUILDS_DIR)/$(BUILD_NAME).system.tar
|
SYSTEM_INITRD:=$(SORTIX_BUILDS_DIR)/$(BUILD_NAME).system.tix.tar
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: sysroot
|
all: sysroot
|
||||||
|
@ -246,6 +246,7 @@ sysroot-system: sysroot-fsh sysroot-base-headers
|
||||||
|| exit $$?; done)
|
|| exit $$?; done)
|
||||||
LC_ALL=C sort -u "$(SYSROOT)/tix/manifest/system" > "$(SYSROOT)/tix/manifest/system.new"
|
LC_ALL=C sort -u "$(SYSROOT)/tix/manifest/system" > "$(SYSROOT)/tix/manifest/system.new"
|
||||||
mv "$(SYSROOT)/tix/manifest/system.new" "$(SYSROOT)/tix/manifest/system"
|
mv "$(SYSROOT)/tix/manifest/system.new" "$(SYSROOT)/tix/manifest/system"
|
||||||
|
printf 'TIX_VERSION=3\nNAME=system\nPLATFORM=$(HOST)\nPREFIX=\nSYSTEM=true\n' > "$(SYSROOT)/tix/tixinfo/system"
|
||||||
|
|
||||||
.PHONY: sysroot-source
|
.PHONY: sysroot-source
|
||||||
sysroot-source: sysroot-fsh
|
sysroot-source: sysroot-fsh
|
||||||
|
@ -477,7 +478,7 @@ $(SRC_INITRD): sysroot
|
||||||
|
|
||||||
$(SYSTEM_INITRD): sysroot
|
$(SYSTEM_INITRD): sysroot
|
||||||
sed -E 's,^/,,' "$(SYSROOT)/tix/manifest/system" | \
|
sed -E 's,^/,,' "$(SYSROOT)/tix/manifest/system" | \
|
||||||
tar -cf $(SYSTEM_INITRD) -C "$(SYSROOT)" --numeric-owner --owner=0 --group=0 --no-recursion -T - tix/manifest/system
|
tar -cf $(SYSTEM_INITRD) -C "$(SYSROOT)" --numeric-owner --owner=0 --group=0 --no-recursion -T - tix/manifest/system tix/tixinfo/system
|
||||||
|
|
||||||
# Packaging
|
# Packaging
|
||||||
|
|
||||||
|
@ -502,7 +503,7 @@ ifeq ($(SORTIX_ISO_COMPRESSION),xz)
|
||||||
test ! -e "$(OVERLAY_INITRD)" || \
|
test ! -e "$(OVERLAY_INITRD)" || \
|
||||||
xz -c $(OVERLAY_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/overlay.tar.xz
|
xz -c $(OVERLAY_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/overlay.tar.xz
|
||||||
xz -c $(SRC_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/src.tar.xz
|
xz -c $(SRC_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/src.tar.xz
|
||||||
xz -c $(SYSTEM_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/system.tar.xz
|
xz -c $(SYSTEM_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/repository/system.tix.tar.xz
|
||||||
build-aux/iso-grub-cfg.sh --platform $(HOST) --version $(VERSION) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
|
build-aux/iso-grub-cfg.sh --platform $(HOST) --version $(VERSION) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
|
||||||
grub-mkrescue --compress=xz -o $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
|
grub-mkrescue --compress=xz -o $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
|
||||||
else ifeq ($(SORTIX_ISO_COMPRESSION),gzip)
|
else ifeq ($(SORTIX_ISO_COMPRESSION),gzip)
|
||||||
|
@ -511,7 +512,7 @@ else ifeq ($(SORTIX_ISO_COMPRESSION),gzip)
|
||||||
test ! -e "$(OVERLAY_INITRD)" || \
|
test ! -e "$(OVERLAY_INITRD)" || \
|
||||||
gzip -c $(OVERLAY_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/overlay.tar.gz
|
gzip -c $(OVERLAY_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/overlay.tar.gz
|
||||||
gzip -c $(SRC_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/src.tar.gz
|
gzip -c $(SRC_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/src.tar.gz
|
||||||
gzip -c $(SYSTEM_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/system.tar.gz
|
gzip -c $(SYSTEM_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/repository/system.tix.tar.gz
|
||||||
build-aux/iso-grub-cfg.sh --platform $(HOST) --version $(VERSION) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
|
build-aux/iso-grub-cfg.sh --platform $(HOST) --version $(VERSION) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
|
||||||
grub-mkrescue --compress=gz -o $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
|
grub-mkrescue --compress=gz -o $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
|
||||||
else # none
|
else # none
|
||||||
|
@ -520,7 +521,7 @@ else # none
|
||||||
test ! -e "$(OVERLAY_INITRD)" || \
|
test ! -e "$(OVERLAY_INITRD)" || \
|
||||||
cp $(OVERLAY_INITRD) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/overlay.tar
|
cp $(OVERLAY_INITRD) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/overlay.tar
|
||||||
cp $(SRC_INITRD) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/src.tar
|
cp $(SRC_INITRD) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/src.tar
|
||||||
cp $(SYSTEM_INITRD) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/system.tar
|
cp $(SYSTEM_INITRD) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/repository/system.tix.tar
|
||||||
build-aux/iso-grub-cfg.sh --platform $(HOST) --version $(VERSION) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
|
build-aux/iso-grub-cfg.sh --platform $(HOST) --version $(VERSION) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
|
||||||
grub-mkrescue -o $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
|
grub-mkrescue -o $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
|
||||||
endif
|
endif
|
||||||
|
@ -563,16 +564,12 @@ $(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/overlay.tar.xz: $(OVERLAY_INITR
|
||||||
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/src.tar.xz: $(SRC_INITRD) $(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot
|
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/src.tar.xz: $(SRC_INITRD) $(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot
|
||||||
xz -c $< > $@
|
xz -c $< > $@
|
||||||
|
|
||||||
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/system.tar.xz: $(SYSTEM_INITRD) $(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot
|
|
||||||
xz -c $< > $@
|
|
||||||
|
|
||||||
.PHONY: release-boot
|
.PHONY: release-boot
|
||||||
release-boot: \
|
release-boot: \
|
||||||
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/sortix.bin.xz \
|
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/sortix.bin.xz \
|
||||||
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/live.tar.xz \
|
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/live.tar.xz \
|
||||||
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/overlay.tar.xz \
|
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/overlay.tar.xz \
|
||||||
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/src.tar.xz \
|
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/src.tar.xz \
|
||||||
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/system.tar.xz \
|
|
||||||
|
|
||||||
.PHONY: release-iso
|
.PHONY: release-iso
|
||||||
release-iso: $(SORTIX_RELEASE_DIR)/$(RELEASE)/builds/$(BUILD_NAME).iso
|
release-iso: $(SORTIX_RELEASE_DIR)/$(RELEASE)/builds/$(BUILD_NAME).iso
|
||||||
|
@ -597,7 +594,7 @@ $(SORTIX_RELEASE_DIR)/$(RELEASE)/man:
|
||||||
|
|
||||||
$(SORTIX_RELEASE_DIR)/$(RELEASE)/man/ports.list: sysroot $(SORTIX_RELEASE_DIR)/$(RELEASE)/man
|
$(SORTIX_RELEASE_DIR)/$(RELEASE)/man/ports.list: sysroot $(SORTIX_RELEASE_DIR)/$(RELEASE)/man
|
||||||
for section in 1 2 3 4 5 6 7 8 9; do mkdir -p $(SORTIX_RELEASE_DIR)/$(RELEASE)/man/man$$section; done
|
for section in 1 2 3 4 5 6 7 8 9; do mkdir -p $(SORTIX_RELEASE_DIR)/$(RELEASE)/man/man$$section; done
|
||||||
for port in system `LC_ALL=C ls "$(SYSROOT)/tix/tixinfo"`; do \
|
for port in `LC_ALL=C ls "$(SYSROOT)/tix/tixinfo"`; do \
|
||||||
for manpage in `grep -E "^/share/man/man[1-9]/.*\.[1-9]$$" "$(SYSROOT)/tix/manifest/$$port" | \
|
for manpage in `grep -E "^/share/man/man[1-9]/.*\.[1-9]$$" "$(SYSROOT)/tix/manifest/$$port" | \
|
||||||
LC_ALL=C sort | \
|
LC_ALL=C sort | \
|
||||||
tee $(SORTIX_RELEASE_DIR)/$(RELEASE)/man/$$port.list | \
|
tee $(SORTIX_RELEASE_DIR)/$(RELEASE)/man/$$port.list | \
|
||||||
|
@ -612,8 +609,9 @@ $(SORTIX_RELEASE_DIR)/$(RELEASE)/repository/$(HOST):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
.PHONY: release-repository
|
.PHONY: release-repository
|
||||||
release-repository: sysroot $(SORTIX_RELEASE_DIR)/$(RELEASE)/repository/$(HOST)
|
release-repository: sysroot $(SYSTEM_INITRD) $(SORTIX_RELEASE_DIR)/$(RELEASE)/repository/$(HOST)
|
||||||
for port in `LC_ALL=C ls "$(SYSROOT)/tix/tixinfo"`; do \
|
xz -c $(SYSTEM_INITRD) > $(SORTIX_RELEASE_DIR)/$(RELEASE)/repository/$(HOST)/system.tix.tar.xz
|
||||||
|
for port in `LC_ALL=C ls "$(SYSROOT)/tix/tixinfo" | (grep -Ev '^system$$' || true)`; do \
|
||||||
cp $(SORTIX_REPOSITORY_DIR)/$(HOST)/$$port.tix.tar.xz $(SORTIX_RELEASE_DIR)/$(RELEASE)/repository/$(HOST) && \
|
cp $(SORTIX_REPOSITORY_DIR)/$(HOST)/$$port.tix.tar.xz $(SORTIX_RELEASE_DIR)/$(RELEASE)/repository/$(HOST) && \
|
||||||
cp $(SORTIX_REPOSITORY_DIR)/$(HOST)/$$port.version $(SORTIX_RELEASE_DIR)/$(RELEASE)/repository/$(HOST); \
|
cp $(SORTIX_REPOSITORY_DIR)/$(HOST)/$$port.version $(SORTIX_RELEASE_DIR)/$(RELEASE)/repository/$(HOST); \
|
||||||
done
|
done
|
||||||
|
|
|
@ -114,10 +114,11 @@ kernel=$(maybe_compressed boot/sortix.bin)
|
||||||
live_initrd=$(maybe_compressed boot/live.tar)
|
live_initrd=$(maybe_compressed boot/live.tar)
|
||||||
overlay_initrd=$(maybe_compressed boot/overlay.tar)
|
overlay_initrd=$(maybe_compressed boot/overlay.tar)
|
||||||
src_initrd=$(maybe_compressed boot/src.tar)
|
src_initrd=$(maybe_compressed boot/src.tar)
|
||||||
system_initrd=$(maybe_compressed boot/system.tar)
|
system_initrd=$(maybe_compressed repository/system.tix.tar)
|
||||||
ports=$(ls repository |
|
ports=$(ls repository |
|
||||||
grep -E '\.tix\.tar\.xz$' |
|
grep -E '\.tix\.tar\.xz$' |
|
||||||
sed -E 's/\.tix\.tar\.xz$//')
|
sed -E 's/\.tix\.tar\.xz$//' |
|
||||||
|
(grep -Ev '^system$' || true))
|
||||||
|
|
||||||
mkdir -p boot/grub
|
mkdir -p boot/grub
|
||||||
mkdir -p boot/grub/init
|
mkdir -p boot/grub/init
|
||||||
|
|
|
@ -281,7 +281,7 @@ echo "Generating manhtml index"
|
||||||
ep
|
ep
|
||||||
section "Ports manual pages" "ports"
|
section "Ports manual pages" "ports"
|
||||||
bp
|
bp
|
||||||
cat ports.list | sort |
|
grep -Ev '^system$' ports.list | sort |
|
||||||
while read port; do
|
while read port; do
|
||||||
if [ -s "$port.list" ]; then
|
if [ -s "$port.list" ]; then
|
||||||
link "$port.html" "$port"
|
link "$port.html" "$port"
|
||||||
|
@ -292,7 +292,7 @@ echo "Generating manhtml index"
|
||||||
ep
|
ep
|
||||||
end_html) | finalize_html index.html
|
end_html) | finalize_html index.html
|
||||||
|
|
||||||
(echo system && cat ports.list) |
|
(echo system && grep -Ev '^system$' ports.list) |
|
||||||
while read port; do
|
while read port; do
|
||||||
echo "Generating manhtml index for $port"
|
echo "Generating manhtml index for $port"
|
||||||
(if [ "$port" = system ]; then prettyport="System"; else prettyport=$port; fi
|
(if [ "$port" = system ]; then prettyport="System"; else prettyport=$port; fi
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
set_minimal="cut dash e2fsprogs grep grub mdocml sed xargs"
|
set_minimal="cut dash e2fsprogs grep grub mdocml sed xargs"
|
||||||
set_basic="$set_minimal binutils bison bzip2 diffutils ed flex gawk gcc git gzip libcurl libcurses libssl libstdc++ nano ntpd make patch pkg-config python ssh tar vim wget xz xorriso"
|
set_basic="$set_minimal binutils bison bzip2 diffutils ed flex gawk gcc git gzip libcurl libcurses libssl libstdc++ m4 make nano ntpd patch perl pkg-config python ssh tar texinfo vim wget xz xorriso"
|
||||||
sets="basic minimal"
|
sets="basic minimal"
|
||||||
|
|
|
@ -17,7 +17,7 @@ in windows.
|
||||||
.Pp
|
.Pp
|
||||||
The user's preferred startup applications are launched on startup by launching
|
The user's preferred startup applications are launched on startup by launching
|
||||||
the
|
the
|
||||||
.Xr session
|
.Xr session 5
|
||||||
program (if set) or otherwise the
|
program (if set) or otherwise the
|
||||||
.Xr displayrc 5
|
.Xr displayrc 5
|
||||||
script in the background.
|
script in the background.
|
||||||
|
|
|
@ -80,6 +80,7 @@
|
||||||
#include "kb/default-kblayout.h"
|
#include "kb/default-kblayout.h"
|
||||||
#include "kb/kblayout.h"
|
#include "kb/kblayout.h"
|
||||||
#include "kb/ps2.h"
|
#include "kb/ps2.h"
|
||||||
|
#include "kernelinfo.h"
|
||||||
#include "logterminal.h"
|
#include "logterminal.h"
|
||||||
#include "mouse/ps2.h"
|
#include "mouse/ps2.h"
|
||||||
#include "multiboot.h"
|
#include "multiboot.h"
|
||||||
|
@ -228,6 +229,9 @@ extern "C" void KernelInit(unsigned long magic, multiboot_info_t* bootinfo_p)
|
||||||
FreeKernelAddress(&alloc);
|
FreeKernelAddress(&alloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !(kernel_options = strdup(cmdline ? cmdline : "")) )
|
||||||
|
Panic("Failed to allocate kernel command line");
|
||||||
|
|
||||||
int argmax = 1;
|
int argmax = 1;
|
||||||
argv = new char*[argmax + 1];
|
argv = new char*[argmax + 1];
|
||||||
if ( !argv )
|
if ( !argv )
|
||||||
|
@ -251,6 +255,7 @@ extern "C" void KernelInit(unsigned long magic, multiboot_info_t* bootinfo_p)
|
||||||
}
|
}
|
||||||
argv[argc] = NULL;
|
argv[argc] = NULL;
|
||||||
|
|
||||||
|
// Add new once-only options to sysinstall's normalize_kernel_options.
|
||||||
bool no_random_seed = false;
|
bool no_random_seed = false;
|
||||||
for ( int i = 0; i < argc; i++ )
|
for ( int i = 0; i < argc; i++ )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2015, 2022 Jonas 'Sortie' Termansen.
|
* Copyright (c) 2012, 2015, 2022, 2023 Jonas 'Sortie' Termansen.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -24,17 +24,22 @@
|
||||||
#include <sortix/kernel/kernel.h>
|
#include <sortix/kernel/kernel.h>
|
||||||
#include <sortix/kernel/syscall.h>
|
#include <sortix/kernel/syscall.h>
|
||||||
|
|
||||||
|
#include "kernelinfo.h"
|
||||||
|
|
||||||
#ifndef VERSIONSTR
|
#ifndef VERSIONSTR
|
||||||
#define VERSIONSTR "unknown"
|
#define VERSIONSTR "unknown"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Sortix {
|
namespace Sortix {
|
||||||
|
|
||||||
|
char* kernel_options;
|
||||||
|
|
||||||
static const char* KernelInfo(const char* req)
|
static const char* KernelInfo(const char* req)
|
||||||
{
|
{
|
||||||
if ( strcmp(req, "name") == 0 ) { return BRAND_KERNEL_NAME; }
|
if ( strcmp(req, "name") == 0 ) { return BRAND_KERNEL_NAME; }
|
||||||
if ( strcmp(req, "version") == 0 ) { return VERSIONSTR; }
|
if ( strcmp(req, "version") == 0 ) { return VERSIONSTR; }
|
||||||
if ( strcmp(req, "tagline") == 0 ) { return BRAND_RELEASE_TAGLINE; }
|
if ( strcmp(req, "tagline") == 0 ) { return BRAND_RELEASE_TAGLINE; }
|
||||||
|
if ( strcmp(req, "options") == 0 ) { return kernel_options; }
|
||||||
if ( strcmp(req, "builddate") == 0 ) { return __DATE__; }
|
if ( strcmp(req, "builddate") == 0 ) { return __DATE__; }
|
||||||
if ( strcmp(req, "buildtime") == 0 ) { return __TIME__; }
|
if ( strcmp(req, "buildtime") == 0 ) { return __TIME__; }
|
||||||
#if defined(__i386__) || defined(__x86_64__)
|
#if defined(__i386__) || defined(__x86_64__)
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 Jonas 'Sortie' Termansen.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
|
* kernelinfo.h
|
||||||
|
* Lets user-space query information about the kernel.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef KERNELINFO_H
|
||||||
|
#define KERNELINFO_H
|
||||||
|
|
||||||
|
namespace Sortix {
|
||||||
|
|
||||||
|
extern char* kernel_options;
|
||||||
|
|
||||||
|
} // namespace Sortix
|
||||||
|
|
||||||
|
#endif
|
2
sh/sh.1
2
sh/sh.1
|
@ -55,7 +55,7 @@ The shell is a login shell.
|
||||||
Interactive shells run the
|
Interactive shells run the
|
||||||
.Xr profile 5
|
.Xr profile 5
|
||||||
script on startup instead of the
|
script on startup instead of the
|
||||||
.Xr shrc
|
.Xr shrc 5
|
||||||
script.
|
script.
|
||||||
This option is set if the shell is invoked by a name starting with a dash
|
This option is set if the shell is invoked by a name starting with a dash
|
||||||
.Sq - .
|
.Sq - .
|
||||||
|
|
|
@ -154,6 +154,15 @@ question could be answered with
|
||||||
to dynamically hash the bootloader password.
|
to dynamically hash the bootloader password.
|
||||||
.It Sy grub_password_empty Ns "=" Ns Oo Sy no "|" Sy yes Oc ( default Sy no )
|
.It Sy grub_password_empty Ns "=" Ns Oo Sy no "|" Sy yes Oc ( default Sy no )
|
||||||
Allow an insecure empty bootloader password typed interactively?
|
Allow an insecure empty bootloader password typed interactively?
|
||||||
|
.It Sy kernel_options Ns "=" Ns Ar options
|
||||||
|
What
|
||||||
|
.Xr kernel 7
|
||||||
|
options should be set in
|
||||||
|
.Xr grub 5
|
||||||
|
with
|
||||||
|
.Sy GRUB_CMDLINE_SORTIX ?
|
||||||
|
This question is asked only the GRUB port is installed, if the kernel was booted
|
||||||
|
with explicit options or this question is set.
|
||||||
.It Sy disked Ns "=" Ns Ar commands
|
.It Sy disked Ns "=" Ns Ar commands
|
||||||
Commands to create partitions and filesystems with
|
Commands to create partitions and filesystems with
|
||||||
.Xr disked 8 ?
|
.Xr disked 8 ?
|
||||||
|
|
|
@ -168,7 +168,7 @@ Like
|
||||||
but runs it in
|
but runs it in
|
||||||
.Xr terminal 1
|
.Xr terminal 1
|
||||||
inside the
|
inside the
|
||||||
.Xr display 8
|
.Xr display 1
|
||||||
graphical user interface environment.
|
graphical user interface environment.
|
||||||
This operating system mode is insecure because it boots straight to root access
|
This operating system mode is insecure because it boots straight to root access
|
||||||
without a password.
|
without a password.
|
||||||
|
|
|
@ -143,7 +143,7 @@ internal layout that can be directly extracted into the filesystem.
|
||||||
The metatdata in
|
The metatdata in
|
||||||
.Pa /tix
|
.Pa /tix
|
||||||
is now using the
|
is now using the
|
||||||
.Xr tix-vars 1
|
.Xr tix-vars 8
|
||||||
format in the style of
|
format in the style of
|
||||||
.Xr port 5 .
|
.Xr port 5 .
|
||||||
.Pp
|
.Pp
|
||||||
|
|
|
@ -170,8 +170,8 @@ selecting
|
||||||
.Sy Disable network drivers .
|
.Sy Disable network drivers .
|
||||||
It can be useful to disable the network drivers if it's undesirable to put the
|
It can be useful to disable the network drivers if it's undesirable to put the
|
||||||
system on the network for security reasons.
|
system on the network for security reasons.
|
||||||
You can disable network drivers by default by editing the bootloader
|
You will be asked later if you'd like to save this choice in the kernel
|
||||||
configuration as described below after completing the installation.
|
options.
|
||||||
.Pp
|
.Pp
|
||||||
By default
|
By default
|
||||||
.Xr dhclient 8
|
.Xr dhclient 8
|
||||||
|
@ -271,6 +271,18 @@ The password will be hashed and stored in
|
||||||
and is inserted into the GRUB configuration when
|
and is inserted into the GRUB configuration when
|
||||||
.Xr update-grub 8
|
.Xr update-grub 8
|
||||||
is run.
|
is run.
|
||||||
|
.Pp
|
||||||
|
If the
|
||||||
|
.Xr kernel 7
|
||||||
|
was booted with explicit options via the advanced bootloader menu, then you
|
||||||
|
will be asked if you'd like to make these changes permanent via the
|
||||||
|
.Sy GRUB_CMDLINE_SORTIX
|
||||||
|
variable in the
|
||||||
|
.Pa /etc/grub
|
||||||
|
configuration file.
|
||||||
|
Run
|
||||||
|
.Xr update-grub 8
|
||||||
|
to apply the changes if you edit this file.
|
||||||
.Ss Partitioning
|
.Ss Partitioning
|
||||||
You will now need to set up a partition for the root filesystem and other
|
You will now need to set up a partition for the root filesystem and other
|
||||||
filesystems you wish to use.
|
filesystems you wish to use.
|
||||||
|
@ -495,55 +507,6 @@ The
|
||||||
manual page is a basic overview of the system for new users.
|
manual page is a basic overview of the system for new users.
|
||||||
.Pp
|
.Pp
|
||||||
Congratulations on your new Sortix system.
|
Congratulations on your new Sortix system.
|
||||||
.Ss Disabling Networking by Default
|
|
||||||
To disable networking drivers by default, edit the bootloader configuration to
|
|
||||||
pass the
|
|
||||||
.Fl \-disable-network-drivers
|
|
||||||
option by default on the
|
|
||||||
.Xr kernel 7
|
|
||||||
command line.
|
|
||||||
.Pp
|
|
||||||
If you are at the final stage of installation, you can answer
|
|
||||||
.Sy '!'
|
|
||||||
to get a shell in the live environment and then run
|
|
||||||
.Sy "chroot -d ."
|
|
||||||
to enter a shell inside the new installation.
|
|
||||||
.Pp
|
|
||||||
For instance, if GRUB is used the bootloader, networking can be disabled by
|
|
||||||
default by done by editing
|
|
||||||
.Pa /etc/grub.d/10_sortix
|
|
||||||
of the new installation.
|
|
||||||
.Xr editor 1
|
|
||||||
or any editor can be used to edit the file.
|
|
||||||
Change the line from
|
|
||||||
.Bd -literal
|
|
||||||
multiboot $BOOT_REL/sortix.bin
|
|
||||||
.Ed
|
|
||||||
.Pp
|
|
||||||
to instead be
|
|
||||||
.Bd -literal
|
|
||||||
multiboot $BOOT_REL/sortix.bin --disable-network-drivers
|
|
||||||
.Ed
|
|
||||||
.Pp
|
|
||||||
If the included GRUB bootloader is used, after making the above edit, run
|
|
||||||
.Xr update-grub 8
|
|
||||||
within the new installation to regenerate the bootloader configuration.
|
|
||||||
Note that
|
|
||||||
.Pa /etc/default/grub.d/10_sortix
|
|
||||||
is part of the GRUB package and local changes will be undone when the GRUB
|
|
||||||
package is updated or reinstalled, in which case you must make this change again
|
|
||||||
and run
|
|
||||||
.Xr update-grub 8
|
|
||||||
again.
|
|
||||||
.Pp
|
|
||||||
If the included GRUB bootloader is not used, but instead the
|
|
||||||
.Pa /etc/default/grub.d/10_sortix.cache
|
|
||||||
fragment is spliced into another GRUB installation, make the above change and
|
|
||||||
then run the
|
|
||||||
.Pa /etc/default/grub.d/10_sortix
|
|
||||||
command and use the freshly regenerated
|
|
||||||
.Pa /etc/default/grub.d/10_sortix.cache
|
|
||||||
fragment instead.
|
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr chkblayout 1 ,
|
.Xr chkblayout 1 ,
|
||||||
.Xr chvideomode 1 ,
|
.Xr chvideomode 1 ,
|
||||||
|
|
|
@ -83,11 +83,6 @@ The format of each multiboot module is automatically detected by default:
|
||||||
.Xr tar 7
|
.Xr tar 7
|
||||||
archives in the ustar format are extracted into the root directory.
|
archives in the ustar format are extracted into the root directory.
|
||||||
The bootloader must already have decompressed the archive.
|
The bootloader must already have decompressed the archive.
|
||||||
If the archive contains the
|
|
||||||
.Pa tix/tixinfo
|
|
||||||
file, it is instead installed into the root directory as a
|
|
||||||
.Xr tix 7
|
|
||||||
binary package.
|
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
Each multiboot module has its own command line where the options are as follows:
|
Each multiboot module has its own command line where the options are as follows:
|
||||||
|
|
|
@ -393,7 +393,7 @@ Ports should never install such files and instead rely on
|
||||||
for locating dependencies.
|
for locating dependencies.
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
.Xr tix-eradicate-libtool-la 1
|
.Xr tix-eradicate-libtool-la 8
|
||||||
program can be used to remove any installed
|
program can be used to remove any installed
|
||||||
.Pa .la
|
.Pa .la
|
||||||
files in the
|
files in the
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* File operation utility functions.
|
* File operation utility functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/kernelinfo.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
@ -221,3 +222,22 @@ char** read_lines_file(const char* path, size_t* out_count)
|
||||||
*out_count = count;
|
*out_count = count;
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* akernelinfo(const char* request)
|
||||||
|
{
|
||||||
|
char* buffer = NULL;
|
||||||
|
size_t size = 0;
|
||||||
|
while ( true )
|
||||||
|
{
|
||||||
|
errno = 0;
|
||||||
|
ssize_t needed = kernelinfo(request, buffer, size);
|
||||||
|
if ( needed < 0 )
|
||||||
|
return free(buffer), NULL;
|
||||||
|
if ( errno != ERANGE )
|
||||||
|
return buffer;
|
||||||
|
size = (size_t) needed + 1;
|
||||||
|
free(buffer);
|
||||||
|
if ( !(buffer = malloc(size)) )
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -27,5 +27,6 @@ void mkdir_or_chmod_or_die(const char* path, mode_t mode);
|
||||||
void write_random_seed(const char* path);
|
void write_random_seed(const char* path);
|
||||||
char* read_string_file(const char* path);
|
char* read_string_file(const char* path);
|
||||||
char** read_lines_file(const char* path, size_t* out_count);
|
char** read_lines_file(const char* path, size_t* out_count);
|
||||||
|
char* akernelinfo(const char* request);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -654,6 +654,8 @@ char** read_installed_list(const char* prefix, size_t* out_count)
|
||||||
{
|
{
|
||||||
if ( entry->d_name[0] == '.' )
|
if ( entry->d_name[0] == '.' )
|
||||||
continue;
|
continue;
|
||||||
|
if ( !strcmp(entry->d_name, "system") )
|
||||||
|
continue;
|
||||||
if ( !string_array_append(&installed, &count, &length, entry->d_name) )
|
if ( !string_array_append(&installed, &count, &length, entry->d_name) )
|
||||||
{
|
{
|
||||||
warn("malloc");
|
warn("malloc");
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <brand.h>
|
#include <brand.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -341,6 +342,84 @@ static void grub_hash_password(char* buffer, size_t buffer_size, const char* pw)
|
||||||
errx(2, "grub password hash failed");
|
errx(2, "grub password hash failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const char* const ignore_kernel_options[] =
|
||||||
|
{
|
||||||
|
"--no-random-seed",
|
||||||
|
"--random-seed",
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static char* normalize_kernel_options(void)
|
||||||
|
{
|
||||||
|
char* options = akernelinfo("options");
|
||||||
|
if ( !options )
|
||||||
|
{
|
||||||
|
warn("kernelinfo: options");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
size_t i = 0, o = 0;
|
||||||
|
while ( options[i] )
|
||||||
|
{
|
||||||
|
if ( isspace((unsigned char) options[i]) )
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( options[i] != '-' ) // Imperfect since quoting options is allowed.
|
||||||
|
break;
|
||||||
|
if ( !strncmp(options + i, "--", 2) &&
|
||||||
|
(!options[i + 2] || isspace((unsigned char) options[i + 2])) )
|
||||||
|
break;
|
||||||
|
bool ignored = false;
|
||||||
|
for ( size_t n = 0; ignore_kernel_options[n]; n++ )
|
||||||
|
{
|
||||||
|
const char* opt = ignore_kernel_options[n];
|
||||||
|
size_t len = strlen(opt);
|
||||||
|
if ( !strncmp(options + i, opt, len) &&
|
||||||
|
(!options[i + len] ||
|
||||||
|
isspace((unsigned char) options[i + len])) )
|
||||||
|
{
|
||||||
|
i += len;
|
||||||
|
ignored = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( ignored )
|
||||||
|
continue;
|
||||||
|
bool singly = false;
|
||||||
|
bool doubly = false;
|
||||||
|
bool escaped = false;
|
||||||
|
for ( ; options[i]; i++ )
|
||||||
|
{
|
||||||
|
char c = options[i];
|
||||||
|
options[o++] = c;
|
||||||
|
if ( !escaped && !singly && !doubly && isspace((unsigned char) c) )
|
||||||
|
break;
|
||||||
|
if ( !escaped && !doubly && c == '\'' )
|
||||||
|
{
|
||||||
|
singly = !singly;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( !escaped && !singly && c == '"' )
|
||||||
|
{
|
||||||
|
doubly = !doubly;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( !singly && !escaped && c == '\\' )
|
||||||
|
{
|
||||||
|
escaped = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
escaped = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while ( o && isspace((unsigned char) options[o - 1]) )
|
||||||
|
o--;
|
||||||
|
options[o] = '\0';
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
static pid_t main_pid;
|
static pid_t main_pid;
|
||||||
static struct mountpoint* mountpoints;
|
static struct mountpoint* mountpoints;
|
||||||
static size_t mountpoints_used;
|
static size_t mountpoints_used;
|
||||||
|
@ -748,6 +827,36 @@ int main(void)
|
||||||
text("\n");
|
text("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* kernel_options = normalize_kernel_options();
|
||||||
|
if ( (autoconf_has("kernel_options") ||
|
||||||
|
(kernel_options && kernel_options[0])) &&
|
||||||
|
!access_or_die("/tix/tixinfo/grub", F_OK) )
|
||||||
|
{
|
||||||
|
text("The operating system was booted with explicit kernel(7) options. "
|
||||||
|
"Would you like set them permanently in /etc/grub?\n\n");
|
||||||
|
|
||||||
|
while ( true )
|
||||||
|
{
|
||||||
|
char options[1024];
|
||||||
|
prompt(options, sizeof(options), "kernel_options",
|
||||||
|
"Kernel options? (OPTIONS/no)", kernel_options);
|
||||||
|
if ( !strcasecmp(options, "no") )
|
||||||
|
{
|
||||||
|
kernel_options = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ( options[0] )
|
||||||
|
{
|
||||||
|
install_configurationf("grub", "w",
|
||||||
|
"GRUB_CMDLINE_SORTIX='%s'\n", options);
|
||||||
|
textf("/etc/grub will be made with the kernel options.\n");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
text("\n");
|
||||||
|
}
|
||||||
|
free(kernel_options);
|
||||||
|
|
||||||
// TODO: Offer the user an automatic layout of partitions if the disk is
|
// TODO: Offer the user an automatic layout of partitions if the disk is
|
||||||
// empty.
|
// empty.
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ builds a source code directory containing a
|
||||||
of software for this operating system.
|
of software for this operating system.
|
||||||
.Nm
|
.Nm
|
||||||
is usually invoked through the higher level
|
is usually invoked through the higher level
|
||||||
.Xr tix-port 7 .
|
.Xr tix-port 8 .
|
||||||
.Pp
|
.Pp
|
||||||
The mandatory
|
The mandatory
|
||||||
.Ar port
|
.Ar port
|
||||||
|
|
|
@ -21,6 +21,10 @@ The name of the current kernel.
|
||||||
The version of the current kernel.
|
The version of the current kernel.
|
||||||
.It Sy tagline
|
.It Sy tagline
|
||||||
The tagline (slogan) of the release.
|
The tagline (slogan) of the release.
|
||||||
|
.It Sy options
|
||||||
|
The
|
||||||
|
.Xr kernel 7
|
||||||
|
options.
|
||||||
.It Sy builddate
|
.It Sy builddate
|
||||||
The date on which the current kernel was built.
|
The date on which the current kernel was built.
|
||||||
.It Sy buildtime
|
.It Sy buildtime
|
||||||
|
@ -33,4 +37,5 @@ The firmware of the system (e.g. "bios" or "uefi")
|
||||||
will exit 0 on success and non-zero otherwise.
|
will exit 0 on success and non-zero otherwise.
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr uname 1 ,
|
.Xr uname 1 ,
|
||||||
.Xr kernelinfo 2
|
.Xr kernelinfo 2 ,
|
||||||
|
.Xr kernel 7
|
||||||
|
|
Loading…
Reference in New Issue