Red Bear OS — microkernel OS in Rust, based on Redox
Derivative of Redox OS (https://www.redox-os.org) adding: - AMD GPU driver (amdgpu) via LinuxKPI compat layer - ext4 filesystem support (ext4d scheme daemon) - ACPI fixes for AMD bare metal (x2APIC, DMAR, IVRS, MCFG) - Custom branding (hostname, os-release, boot identity) Build system is full upstream Redox with RBOS overlay in local/. Patches for kernel, base, and relibc are symlinked from local/patches/ and protected from make clean/distclean. Custom recipes live in local/recipes/ with symlinks into the recipes/ search path. Build: make all CONFIG_NAME=redbear-full Sync: ./local/scripts/sync-upstream.sh
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
# System-wide .bashrc file for interactive bash(1) shells.
|
||||
|
||||
# To enable the settings / commands in this file for login shells as well,
|
||||
# this file has to be sourced in /etc/profile.
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
[ -z "$PS1" ] && return
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# TODO: redox_chroot
|
||||
if [ -z "${redox_chroot:-}" ] && [ -r /etc/redox_chroot ]; then
|
||||
redox_chroot=$(cat /etc/redox_chroot)
|
||||
fi
|
||||
|
||||
# set a fancy prompt (non-color, overwrite the one in /etc/profile)
|
||||
# but only if not SUDOing and have SUDO_PS1 set; then assume smart user.
|
||||
if ! [ -n "${SUDO_USER}" -a -n "${SUDO_PS1}" ]; then
|
||||
PS1='${redox_chroot:+($redox_chroot)}\u@\h:\w\$ '
|
||||
fi
|
||||
|
||||
# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
#case "$TERM" in
|
||||
#xterm*|rxvt*)
|
||||
# PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
|
||||
# ;;
|
||||
#*)
|
||||
# ;;
|
||||
#esac
|
||||
|
||||
# enable bash completion in interactive shells
|
||||
#if ! shopt -oq posix; then
|
||||
# if [ -f /etc/bash_completion ]; then
|
||||
# . /etc/bash_completion
|
||||
# fi
|
||||
#fi
|
||||
@@ -0,0 +1,27 @@
|
||||
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
|
||||
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
|
||||
|
||||
if [ "${PS1-}" ]; then
|
||||
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
|
||||
# The file bash.bashrc already sets the default PS1.
|
||||
# PS1='\h:\w\$ '
|
||||
if [ -f /etc/bash.bashrc ]; then
|
||||
. /etc/bash.bashrc
|
||||
fi
|
||||
else
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
PS1='# '
|
||||
else
|
||||
PS1='$ '
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d /etc/profile.d ]; then
|
||||
for i in /etc/profile.d/*.sh; do
|
||||
if [ -r $i ]; then
|
||||
. $i
|
||||
fi
|
||||
done
|
||||
unset i
|
||||
fi
|
||||
@@ -0,0 +1,99 @@
|
||||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
#shopt -s globstar
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color|*-256color) color_prompt=yes;;
|
||||
esac
|
||||
|
||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||
# off by default to not distract the user: the focus in a terminal window
|
||||
# should be on the output of commands, not on the prompt
|
||||
#force_color_prompt=yes
|
||||
|
||||
if [ -n "$force_color_prompt" ]; then
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
else
|
||||
color_prompt=
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='${redox_chroot:+($redox_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
|
||||
else
|
||||
PS1='${redox_chroot:+($redox_chroot)}\u@\h:\w\$ '
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# colored GCC warnings and errors
|
||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# some more ls aliases
|
||||
alias ll='ls -alF'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
|
||||
# TODO
|
||||
# Add an "alert" alias for long running commands. Use like so:
|
||||
# sleep 10; alert
|
||||
# alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
@@ -0,0 +1,25 @@
|
||||
# ~/.profile: executed by the command interpreter for login shells.
|
||||
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
|
||||
# exists.
|
||||
|
||||
# the default umask is set in /etc/profile; for setting the umask
|
||||
# for ssh logins, install and configure the libpam-umask package.
|
||||
#umask 022
|
||||
|
||||
# if running bash
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
# include .bashrc if it exists
|
||||
if [ -f "$HOME/.bashrc" ]; then
|
||||
. "$HOME/.bashrc"
|
||||
fi
|
||||
fi
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/bin" ] ; then
|
||||
PATH="$HOME/bin:$PATH"
|
||||
fi
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/.local/bin" ] ; then
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
@@ -0,0 +1,24 @@
|
||||
[source]
|
||||
tar = "https://ftp.gnu.org/gnu/bash/bash-5.2.15.tar.gz"
|
||||
blake3 = "c1548e3f2a9b6de5296e18c28b3d2007985e647273e03f039efd3e489edaa41f"
|
||||
patches = [
|
||||
"redox.patch"
|
||||
]
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"termcap",
|
||||
]
|
||||
script = """
|
||||
# compiled statically
|
||||
COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
bash_cv_func_sigsetjmp=no
|
||||
bash_cv_getenv_redef=no
|
||||
--enable-static-link # This ensures loadables are not built, which will fail
|
||||
)
|
||||
COOKBOOK_MAKE_JOBS=1 # workaround for parallel make bugs
|
||||
cookbook_configure
|
||||
ln -s "bash" "${COOKBOOK_STAGE}/usr/bin/sh"
|
||||
cp -r "${COOKBOOK_RECIPE}/etc" "${COOKBOOK_STAGE}/etc"
|
||||
"""
|
||||
@@ -0,0 +1,236 @@
|
||||
diff -ruwN source/bashline.c source-new/bashline.c
|
||||
--- source/bashline.c 2022-04-18 05:37:12.000000000 +0700
|
||||
+++ source-new/bashline.c 2025-09-01 04:36:35.272926519 +0700
|
||||
@@ -2645,7 +2645,7 @@
|
||||
const char *text;
|
||||
int state;
|
||||
{
|
||||
-#if defined (__WIN32__) || defined (__OPENNT) || !defined (HAVE_GRP_H)
|
||||
+#if defined (__WIN32__) || defined (__OPENNT) || !defined (HAVE_GRP_H) || defined(__redox__)
|
||||
return ((char *)NULL);
|
||||
#else
|
||||
static char *gname = (char *)NULL;
|
||||
diff -ruwN source/builtins/ulimit.def source-new/builtins/ulimit.def
|
||||
--- source/builtins/ulimit.def 2021-11-05 20:19:53.000000000 +0700
|
||||
+++ source-new/builtins/ulimit.def 2025-09-01 04:36:35.272926519 +0700
|
||||
@@ -609,7 +609,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
-#if defined (HAVE_RESOURCE)
|
||||
+#if defined (HAVE_RESOURCE) && !defined(__redox__)
|
||||
if (getrlimit (limits[ind].parameter, &limit) < 0)
|
||||
return -1;
|
||||
# if defined (HPUX9)
|
||||
diff -ruwN source/config-top.h source-new/config-top.h
|
||||
--- source/config-top.h 2021-11-05 20:11:12.000000000 +0700
|
||||
+++ source-new/config-top.h 2025-09-19 21:55:55.439030906 +0700
|
||||
@@ -199,3 +199,6 @@
|
||||
/* Undefine or define to 0 if you don't want to allow associative array
|
||||
assignment using a compound list of key-value pairs. */
|
||||
#define ASSOC_KVPAIR_ASSIGNMENT 1
|
||||
+
|
||||
+/* Don't check for a valid inode number when pattern matching on Redox */
|
||||
+#define BROKEN_DIRENT_D_INO 1
|
||||
diff -ruwN source/configure source-new/configure
|
||||
--- source/configure 2022-09-23 21:13:22.000000000 +0700
|
||||
+++ source-new/configure 2025-09-01 04:52:47.542177017 +0700
|
||||
@@ -3298,6 +3298,7 @@
|
||||
*-nsk*) opt_bash_malloc=no ;; # HP NonStop
|
||||
*-haiku*) opt_bash_malloc=no ;; # Haiku OS
|
||||
*-genode*) opt_bash_malloc=no ;; # Genode has no sbrk
|
||||
+*-redox*) opt_bash_malloc=no ;; # Redox OS
|
||||
esac
|
||||
|
||||
# memory scrambling on free()
|
||||
diff -ruwN source/configure.ac source-new/configure.ac
|
||||
--- source/configure.ac 2022-09-23 21:12:27.000000000 +0700
|
||||
+++ source-new/configure.ac 2025-09-01 04:36:35.275926660 +0700
|
||||
@@ -92,6 +92,7 @@
|
||||
*-nsk*) opt_bash_malloc=no ;; # HP NonStop
|
||||
*-haiku*) opt_bash_malloc=no ;; # Haiku OS
|
||||
*-genode*) opt_bash_malloc=no ;; # Genode has no sbrk
|
||||
+*-redox*) opt_bash_malloc=no ;; # Redox OS
|
||||
esac
|
||||
|
||||
# memory scrambling on free()
|
||||
diff -ruwN source/execute_cmd.c source-new/execute_cmd.c
|
||||
--- source/execute_cmd.c 2022-12-14 00:09:02.000000000 +0700
|
||||
+++ source-new/execute_cmd.c 2025-09-01 04:36:35.275926660 +0700
|
||||
@@ -1379,11 +1379,11 @@
|
||||
nullcmd = (command == 0) || (command->type == cm_simple && command->value.Simple->words == 0 && command->value.Simple->redirects == 0);
|
||||
if (posixly_correct && nullcmd)
|
||||
{
|
||||
-#if defined (HAVE_GETRUSAGE)
|
||||
+#if defined (HAVE_GETRUSAGE) && defined (HAVE_GETTIMEOFDAY)
|
||||
selfb.ru_utime.tv_sec = kidsb.ru_utime.tv_sec = selfb.ru_stime.tv_sec = kidsb.ru_stime.tv_sec = 0;
|
||||
selfb.ru_utime.tv_usec = kidsb.ru_utime.tv_usec = selfb.ru_stime.tv_usec = kidsb.ru_stime.tv_usec = 0;
|
||||
before = shellstart;
|
||||
-#else
|
||||
+#elif defined (HAVE_TIMES)
|
||||
before.tms_utime = before.tms_stime = before.tms_cutime = before.tms_cstime = 0;
|
||||
tbefore = shell_start_time;
|
||||
#endif
|
||||
diff -ruwN source/general.c source-new/general.c
|
||||
--- source/general.c 2022-11-24 05:10:12.000000000 +0700
|
||||
+++ source-new/general.c 2025-09-19 17:09:24.754782168 +0700
|
||||
@@ -589,6 +589,7 @@
|
||||
void
|
||||
check_dev_tty ()
|
||||
{
|
||||
+#if !defined(__redox__)
|
||||
int tty_fd;
|
||||
char *tty;
|
||||
|
||||
@@ -603,6 +604,7 @@
|
||||
}
|
||||
if (tty_fd >= 0)
|
||||
close (tty_fd);
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* Return 1 if PATH1 and PATH2 are the same file. This is kind of
|
||||
diff -ruwN source/include/posixwait.h source-new/include/posixwait.h
|
||||
--- source/include/posixwait.h 2019-03-30 00:25:52.000000000 +0700
|
||||
+++ source-new/include/posixwait.h 2025-09-01 04:36:35.276926707 +0700
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
/* How to get the status of a job. For Posix, this is just an
|
||||
int, but for other systems we have to crack the union wait. */
|
||||
-#if !defined (_POSIX_VERSION)
|
||||
+#if 0
|
||||
typedef union wait WAIT;
|
||||
# define WSTATUS(t) (t.w_status)
|
||||
#else /* _POSIX_VERSION */
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
/* More Posix P1003.1 definitions. In the POSIX versions, the parameter is
|
||||
passed as an `int', in the non-POSIX version, as `union wait'. */
|
||||
-#if defined (_POSIX_VERSION)
|
||||
+#if 1
|
||||
|
||||
# if !defined (WSTOPSIG)
|
||||
# define WSTOPSIG(s) ((s) >> 8)
|
||||
diff --color -ruwN source/jobs.c source-new/jobs.c
|
||||
--- source/jobs.c 2022-12-14 00:09:02.000000000 +0700
|
||||
+++ source-new/jobs.c 2026-02-09 23:29:28.811403291 +0700
|
||||
@@ -4417,9 +4417,11 @@
|
||||
{
|
||||
shell_pgrp = getpid ();
|
||||
setpgid (0, shell_pgrp);
|
||||
+ }
|
||||
+
|
||||
+ // shell pgrep is not set automatically on Redox
|
||||
if (shell_tty != -1)
|
||||
tcsetpgrp (shell_tty, shell_pgrp);
|
||||
- }
|
||||
|
||||
tty_sigs = 0;
|
||||
while ((terminal_pgrp = tcgetpgrp (shell_tty)) != -1)
|
||||
diff -ruwN source/lib/readline/input.c source-new/lib/readline/input.c
|
||||
--- source/lib/readline/input.c 2022-04-09 02:43:24.000000000 +0700
|
||||
+++ source-new/lib/readline/input.c 2025-09-01 04:36:35.276926707 +0700
|
||||
@@ -805,7 +805,7 @@
|
||||
int result;
|
||||
unsigned char c;
|
||||
int fd;
|
||||
-#if defined (HAVE_PSELECT)
|
||||
+#if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
|
||||
sigset_t empty_set;
|
||||
fd_set readfds;
|
||||
#endif
|
||||
diff -ruwN source/lib/readline/terminal.c source-new/lib/readline/terminal.c
|
||||
--- source/lib/readline/terminal.c 2022-04-05 21:44:17.000000000 +0700
|
||||
+++ source-new/lib/readline/terminal.c 2025-09-01 04:36:35.286927174 +0700
|
||||
@@ -102,7 +102,7 @@
|
||||
|
||||
static int tcap_initialized;
|
||||
|
||||
-#if !defined (__linux__) && !defined (NCURSES_VERSION)
|
||||
+#if !defined (__linux__) && !defined (NCURSES_VERSION) && !defined (__redox__)
|
||||
# if defined (__EMX__) || defined (NEED_EXTERN_PC)
|
||||
extern
|
||||
# endif /* __EMX__ || NEED_EXTERN_PC */
|
||||
diff -ruwN source/lib/sh/getcwd.c source-new/lib/sh/getcwd.c
|
||||
--- source/lib/sh/getcwd.c 2012-03-10 22:48:50.000000000 +0700
|
||||
+++ source-new/lib/sh/getcwd.c 2025-09-01 04:36:35.286927174 +0700
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
-#if !defined (HAVE_GETCWD)
|
||||
+#if !defined (HAVE_GETCWD) && !defined(__redox__)
|
||||
|
||||
#if !defined (__GNUC__) && !defined (HAVE_ALLOCA_H) && defined (_AIX)
|
||||
#pragma alloca
|
||||
diff -ruwN source/lib/sh/input_avail.c source-new/lib/sh/input_avail.c
|
||||
--- source/lib/sh/input_avail.c 2021-05-24 22:16:33.000000000 +0700
|
||||
+++ source-new/lib/sh/input_avail.c 2025-09-01 04:36:35.298927735 +0700
|
||||
@@ -33,7 +33,7 @@
|
||||
# include <sys/file.h>
|
||||
#endif /* HAVE_SYS_FILE_H */
|
||||
|
||||
-#if defined (HAVE_PSELECT)
|
||||
+#if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
|
||||
# include <signal.h>
|
||||
#endif
|
||||
|
||||
diff -ruwN source/lib/sh/strtoimax.c source-new/lib/sh/strtoimax.c
|
||||
--- source/lib/sh/strtoimax.c 2021-09-10 21:32:35.000000000 +0700
|
||||
+++ source-new/lib/sh/strtoimax.c 2025-09-01 04:36:35.301927876 +0700
|
||||
@@ -55,6 +55,8 @@
|
||||
extern long long strtoll PARAMS((const char *, char **, int));
|
||||
#endif
|
||||
|
||||
+#if !defined (__redox__)
|
||||
+
|
||||
#ifdef strtoimax
|
||||
#undef strtoimax
|
||||
#endif
|
||||
@@ -79,6 +81,8 @@
|
||||
return (strtol (ptr, endptr, base));
|
||||
}
|
||||
|
||||
+#endif
|
||||
+
|
||||
#ifdef TESTING
|
||||
# include <stdio.h>
|
||||
int
|
||||
diff -ruwN source/parse.y source-new/parse.y
|
||||
--- source/parse.y 2022-12-14 00:09:02.000000000 +0700
|
||||
+++ source-new/parse.y 2025-09-01 04:36:35.302927923 +0700
|
||||
@@ -2625,6 +2625,7 @@
|
||||
parser_state |= PST_ENDALIAS;
|
||||
/* We need to do this to make sure last_shell_getc_is_singlebyte returns
|
||||
true, since we are returning a single-byte space. */
|
||||
+#if defined (HANDLE_MULTIBYTE)
|
||||
if (shell_input_line_index == shell_input_line_len && last_shell_getc_is_singlebyte == 0)
|
||||
{
|
||||
#if 0
|
||||
@@ -2638,6 +2639,7 @@
|
||||
shell_input_line_property[shell_input_line_index - 1] = 1;
|
||||
#endif
|
||||
}
|
||||
+#endif /* HANDLE_MULTIBYTE */
|
||||
return ' '; /* END_ALIAS */
|
||||
}
|
||||
#endif
|
||||
diff -ruwN source/y.tab.c source-new/y.tab.c
|
||||
--- source/y.tab.c 2022-12-14 00:09:02.000000000 +0700
|
||||
+++ source-new/y.tab.c 2025-09-01 04:36:35.307928157 +0700
|
||||
@@ -4936,6 +4936,7 @@
|
||||
parser_state |= PST_ENDALIAS;
|
||||
/* We need to do this to make sure last_shell_getc_is_singlebyte returns
|
||||
true, since we are returning a single-byte space. */
|
||||
+#if defined (HANDLE_MULTIBYTE)
|
||||
if (shell_input_line_index == shell_input_line_len && last_shell_getc_is_singlebyte == 0)
|
||||
{
|
||||
#if 0
|
||||
@@ -4949,6 +4950,7 @@
|
||||
shell_input_line_property[shell_input_line_index - 1] = 1;
|
||||
#endif
|
||||
}
|
||||
+#endif /* HANDLE_MULTIBYTE */
|
||||
return ' '; /* END_ALIAS */
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user