4000th COMMIT: Add a package manager, xbps
Now you don't have to wait painstakingly long for ports to compile!
This commit is contained in:
@@ -9,7 +9,7 @@ This is my hobby operating system written in C++. Currently supports x86\_64 and
|
|||||||
|
|
||||||
You can find a live demo [here](https://bananymous.com/banan-os)
|
You can find a live demo [here](https://bananymous.com/banan-os)
|
||||||
|
|
||||||
If you want to try out DOOM, you should first enter the GUI environment using the `start-gui` command. Then you can run `doom` in the GUI terminal.
|

|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
@@ -18,6 +18,8 @@ If you want to try out DOOM, you should first enter the GUI environment using th
|
|||||||
- [x] SMP (multiprocessing)
|
- [x] SMP (multiprocessing)
|
||||||
- [x] Linear framebuffer (VESA and GOP)
|
- [x] Linear framebuffer (VESA and GOP)
|
||||||
- [x] Network stack
|
- [x] Network stack
|
||||||
|
- [x] USB stack
|
||||||
|
- [x] Audio support
|
||||||
- [x] ELF executable loading
|
- [x] ELF executable loading
|
||||||
- [x] AML interpreter (partial)
|
- [x] AML interpreter (partial)
|
||||||
- [x] Basic graphical environment
|
- [x] Basic graphical environment
|
||||||
@@ -27,16 +29,14 @@ If you want to try out DOOM, you should first enter the GUI environment using th
|
|||||||
- [ ] Some nice apps
|
- [ ] Some nice apps
|
||||||
- [x] ELF dynamic linking
|
- [x] ELF dynamic linking
|
||||||
- [x] copy-on-write memory
|
- [x] copy-on-write memory
|
||||||
- [x] file mappings
|
|
||||||
- [ ] anonymous mappings
|
|
||||||
|
|
||||||
#### Drivers
|
#### Drivers
|
||||||
- [x] NVMe disks
|
- [x] NVMe disks
|
||||||
- [x] ATA (IDE, SATA) disks
|
- [x] ATA (IDE, SATA) disks
|
||||||
- [x] E1000 and E1000E NICs
|
- [x] E1000 and E1000E NICs
|
||||||
- [x] RTL8111/8168/8211/8411 NICs
|
- [x] RTL8111/8168/8211/8411 NICs
|
||||||
- [x] PS2 keyboard (all scancode sets)
|
- [x] AC97 and iHDA audio cards
|
||||||
- [x] PS2 mouse
|
- [x] PS2 keyboard and mouse
|
||||||
- [x] USB
|
- [x] USB
|
||||||
- [x] xHCI
|
- [x] xHCI
|
||||||
- [ ] EHCI
|
- [ ] EHCI
|
||||||
@@ -46,7 +46,8 @@ If you want to try out DOOM, you should first enter the GUI environment using th
|
|||||||
- [x] Mouse
|
- [x] Mouse
|
||||||
- [x] Mass storage
|
- [x] Mass storage
|
||||||
- [x] Hubs
|
- [x] Hubs
|
||||||
- [ ] ...
|
- [ ] Network
|
||||||
|
- [ ] Audio
|
||||||
- [ ] virtio devices (network, storage)
|
- [ ] virtio devices (network, storage)
|
||||||
|
|
||||||
#### Network
|
#### Network
|
||||||
@@ -54,7 +55,7 @@ If you want to try out DOOM, you should first enter the GUI environment using th
|
|||||||
- [x] ICMP
|
- [x] ICMP
|
||||||
- [x] IPv4
|
- [x] IPv4
|
||||||
- [x] UDP
|
- [x] UDP
|
||||||
- [x] TCP (partial and buggy)
|
- [x] TCP
|
||||||
- [x] Unix domain sockets
|
- [x] Unix domain sockets
|
||||||
- [ ] SSL
|
- [ ] SSL
|
||||||
|
|
||||||
@@ -65,7 +66,6 @@ If you want to try out DOOM, you should first enter the GUI environment using th
|
|||||||
- [x] Dev
|
- [x] Dev
|
||||||
- [x] Ram
|
- [x] Ram
|
||||||
- [x] Proc
|
- [x] Proc
|
||||||
- [ ] Sys
|
|
||||||
- [ ] 9P
|
- [ ] 9P
|
||||||
|
|
||||||
#### Bootloader support
|
#### Bootloader support
|
||||||
@@ -73,8 +73,6 @@ If you want to try out DOOM, you should first enter the GUI environment using th
|
|||||||
- [x] Custom BIOS bootloader
|
- [x] Custom BIOS bootloader
|
||||||
- [ ] Custom UEFI bootloader
|
- [ ] Custom UEFI bootloader
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Code structure
|
## Code structure
|
||||||
|
|
||||||
Each major component and library has its own subdirectory (kernel, userspace, libc, ...). Each directory contains directory *include*, which has **all** of the header files of the component. Every header is included by its absolute path.
|
Each major component and library has its own subdirectory (kernel, userspace, libc, ...). Each directory contains directory *include*, which has **all** of the header files of the component. Every header is included by its absolute path.
|
||||||
@@ -125,8 +123,22 @@ If you have corrupted your disk image or want to create new one, you can either
|
|||||||
./bos image-full
|
./bos image-full
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To test on real hardware, I have a script to generate a compressed ISO. The ISO can be copied directly to an USB drive with for example `dd`. The file is created at build/banan-os.iso and can be generated with
|
||||||
|
```sh
|
||||||
|
./bos iso
|
||||||
|
```
|
||||||
|
|
||||||
I have also created shell completion script for zsh. You can either copy the file in _script/shell-completion/zsh/\_bos_ to _/usr/share/zsh/site-functions/_ or add the _script/shell-completion/zsh_ to your fpath in _.zshrc_.
|
I have also created shell completion script for zsh. You can either copy the file in _script/shell-completion/zsh/\_bos_ to _/usr/share/zsh/site-functions/_ or add the _script/shell-completion/zsh_ to your fpath in _.zshrc_.
|
||||||
|
|
||||||
|
### Package Manager
|
||||||
|
|
||||||
|
banan-os uses xbps as its package manager for ports. All upstream ports are packaged into xbps packages hosted on a [repository on my server](https://packages.bananymous.com/banan-os). You can manage sysroot's xbps packages with `./bos` wrapper. You can use `xbps-install`, `xbps-remove` and `xbps-query` with repository and sysroot set to the correct values. For example to install xbps that can be used inside banan-os you can use
|
||||||
|
```sh
|
||||||
|
./bos xbps-install -S xbps
|
||||||
|
```
|
||||||
|
For xbps usage see [their documentation](https://docs.voidlinux.org/xbps/index.html).
|
||||||
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
As the upstream is hosted on my server https://git.bananymous.com/Bananymous/banan-os, merging contributions is not as trivial as it would be on GitHub. You can still send PRs in GitHub in which case I should be able to download the diff and apply it manually. If you want, I can also provide you an account to my git server. In this case please contact me ([email](mailto:[email protected]), [discord](https://discord.gg/ehjGySwYdK)).
|
As the upstream is hosted on my server https://git.bananymous.com/Bananymous/banan-os, merging contributions is not as trivial as it would be on GitHub. You can still send PRs in GitHub in which case I should be able to download the diff and apply it manually. If you want, I can also provide you an account to my git server. In this case please contact me ([email](mailto:[email protected]), [discord](https://discord.gg/ehjGySwYdK)).
|
||||||
|
|||||||
+2
-2
@@ -301,6 +301,6 @@ if (( $PACKAGE )); then
|
|||||||
|
|
||||||
mkdir -p "$PACKAGE_REPO"
|
mkdir -p "$PACKAGE_REPO"
|
||||||
cd "$PACKAGE_REPO"
|
cd "$PACKAGE_REPO"
|
||||||
xbps-create -A "$BANAN_ARCH" -n "${version_string%.*}" -s "$DESCRIPTION" -D "$dependencies" "$package_dir"
|
run_xbps xbps-create -A "$BANAN_ARCH" -n "${version_string%.*}" -s "$DESCRIPTION" -D "$dependencies" "$package_dir"
|
||||||
xbps-rindex -af "$version_string.xbps"
|
run_xbps xbps-rindex -af "$version_string.xbps"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Executable
+6
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash ../install.sh
|
||||||
|
|
||||||
|
NAME='xbps'
|
||||||
|
VERSION='0.60.7'
|
||||||
|
DOWNLOAD_URL="https://github.com/void-linux/xbps/archive/refs/tags/$VERSION.tar.gz#ec8c2e4d595863b5748c10d9ada1d51ac1da6f910a9d31682acd1a477310c64e"
|
||||||
|
DEPENDENCIES=('libarchive' 'openssl')
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
diff -ruN xbps-0.60.7/lib/fetch/common.c xbps-0.60.7-banan_os/lib/fetch/common.c
|
||||||
|
--- xbps-0.60.7/lib/fetch/common.c 2026-02-09 22:23:08.000000000 +0200
|
||||||
|
+++ xbps-0.60.7-banan_os/lib/fetch/common.c 2026-04-18 14:03:30.521070264 +0300
|
||||||
|
@@ -163,7 +163,9 @@
|
||||||
|
fetchLastErrCode = FETCH_TIMEOUT;
|
||||||
|
break;
|
||||||
|
case ECONNREFUSED:
|
||||||
|
+#ifdef EHOSTDOWN
|
||||||
|
case EHOSTDOWN:
|
||||||
|
+#endif
|
||||||
|
fetchLastErrCode = FETCH_DOWN;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
diff -ruN xbps-0.60.7/lib/fetch/ftp.c xbps-0.60.7-banan_os/lib/fetch/ftp.c
|
||||||
|
--- xbps-0.60.7/lib/fetch/ftp.c 2026-02-09 22:23:08.000000000 +0200
|
||||||
|
+++ xbps-0.60.7-banan_os/lib/fetch/ftp.c 2026-04-18 14:04:26.685837239 +0300
|
||||||
|
@@ -138,7 +138,7 @@
|
||||||
|
sin4->sin_port = port;
|
||||||
|
sin4->sin_family = AF_INET;
|
||||||
|
*len = sizeof(struct sockaddr_in);
|
||||||
|
-#ifndef __linux__
|
||||||
|
+#if !defined(__linux__) && !defined(__banan_os__)
|
||||||
|
sin4->sin_len = sizeof(struct sockaddr_in);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@@ -508,7 +508,7 @@
|
||||||
|
tm.tm_mon--;
|
||||||
|
tm.tm_year = year - 1900;
|
||||||
|
tm.tm_isdst = -1;
|
||||||
|
- t = timegm(&tm);
|
||||||
|
+ t = mktime(&tm);
|
||||||
|
if (t == (time_t)-1)
|
||||||
|
t = time(NULL);
|
||||||
|
us->mtime = t;
|
||||||
|
diff -ruN xbps-0.60.7/lib/fetch/http.c xbps-0.60.7-banan_os/lib/fetch/http.c
|
||||||
|
--- xbps-0.60.7/lib/fetch/http.c 2026-02-09 22:23:08.000000000 +0200
|
||||||
|
+++ xbps-0.60.7-banan_os/lib/fetch/http.c 2026-04-18 14:03:46.645405420 +0300
|
||||||
|
@@ -525,7 +525,7 @@
|
||||||
|
setlocale(LC_TIME, locale);
|
||||||
|
if (r == NULL)
|
||||||
|
return (-1);
|
||||||
|
- *mtime = timegm(&tm);
|
||||||
|
+ *mtime = mktime(&tm);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
diff -ruN xbps-0.60.7/data/repod-main.conf xbps-0.60.7-banan_os/data/repod-main.conf
|
||||||
|
--- xbps-0.60.7/data/repod-main.conf 2026-02-09 22:23:08.000000000 +0200
|
||||||
|
+++ xbps-0.60.7-banan_os/data/repod-main.conf 2026-04-18 14:07:59.005131620 +0300
|
||||||
|
@@ -1 +1 @@
|
||||||
|
-repository=https://repo-default.voidlinux.org/current
|
||||||
|
+repository=https://packages.bananymous.com/banan-os
|
||||||
+24
-1
@@ -35,7 +35,7 @@ build_target () {
|
|||||||
echo "No target provided"
|
echo "No target provided"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
run_fakeroot $BANAN_CMAKE --build $BANAN_BUILD_DIR -- -j$(nproc) $1
|
run_fakeroot $BANAN_CMAKE --build $BANAN_BUILD_DIR -- -j$(nproc) "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
build_toolchain () {
|
build_toolchain () {
|
||||||
@@ -138,6 +138,29 @@ case $1 in
|
|||||||
rm -rf $BANAN_BUILD_DIR
|
rm -rf $BANAN_BUILD_DIR
|
||||||
find $BANAN_ROOT_DIR/ports -name '.compile_hash' -exec rm {} +
|
find $BANAN_ROOT_DIR/ports -name '.compile_hash' -exec rm {} +
|
||||||
;;
|
;;
|
||||||
|
xbps-*)
|
||||||
|
command="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
build_target all
|
||||||
|
build_target install
|
||||||
|
|
||||||
|
xbps_args=()
|
||||||
|
|
||||||
|
case "$command" in
|
||||||
|
xbps-install|xbps-remove|xbps-query)
|
||||||
|
xbps_args+=(--rootdir "$BANAN_SYSROOT")
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "$command" in
|
||||||
|
xbps-install|xbps-query)
|
||||||
|
xbps_args+=(--repository "$BANAN_XBPS_REPO")
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
run_xbps "$command" "${xbps_args[@]}" "$@"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
build_target $1
|
build_target $1
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -41,3 +41,9 @@ if [[ -z $BANAN_BOOTLOADER ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
export BANAN_CMAKE="$BANAN_TOOLCHAIN_PREFIX/bin/cmake"
|
export BANAN_CMAKE="$BANAN_TOOLCHAIN_PREFIX/bin/cmake"
|
||||||
|
|
||||||
|
run_xbps() {
|
||||||
|
PATH="$BANAN_TOOLCHAIN_PREFIX/bin:$PATH" LD_LIBRARY_PATH="$BANAN_TOOLCHAIN_PREFIX/lib" "$@"
|
||||||
|
}
|
||||||
|
export -f run_xbps
|
||||||
|
export BANAN_XBPS_REPO='https://packages.bananymous.com/banan-os'
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ MESON_VERSION="meson-1.10.0"
|
|||||||
MESON_TAR="$MESON_VERSION.tar.gz"
|
MESON_TAR="$MESON_VERSION.tar.gz"
|
||||||
MESON_URL="https://github.com/mesonbuild/meson/releases/download/1.10.0/$MESON_TAR"
|
MESON_URL="https://github.com/mesonbuild/meson/releases/download/1.10.0/$MESON_TAR"
|
||||||
|
|
||||||
|
XBPS_VERSION="0.60.7"
|
||||||
|
XBPS_TAR="$XBPS_VERSION.tar.gz"
|
||||||
|
XBPS_URL="https://github.com/void-linux/xbps/archive/refs/tags/$XBPS_TAR"
|
||||||
|
|
||||||
if [[ -z $BANAN_SYSROOT ]]; then
|
if [[ -z $BANAN_SYSROOT ]]; then
|
||||||
echo "You must set the BANAN_SYSROOT environment variable" >&2
|
echo "You must set the BANAN_SYSROOT environment variable" >&2
|
||||||
exit 1
|
exit 1
|
||||||
@@ -230,6 +234,30 @@ build_meson() {
|
|||||||
./packaging/create_zipapp.py --outfile "$BANAN_TOOLCHAIN_PREFIX/bin/meson" --interpreter '/usr/bin/env python3'
|
./packaging/create_zipapp.py --outfile "$BANAN_TOOLCHAIN_PREFIX/bin/meson" --interpreter '/usr/bin/env python3'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
build_xbps() {
|
||||||
|
cd "$BANAN_BUILD_DIR/toolchain"
|
||||||
|
|
||||||
|
if [ ! -d "xbps-$XBPS_VERSION" ]; then
|
||||||
|
if [ ! -f "$XBPS_TAR" ]; then
|
||||||
|
echo "Downloading xbps-$XBPS_TAR"
|
||||||
|
wget "$XBPS_URL"
|
||||||
|
fi
|
||||||
|
echo "Unpacking ${XBPS_TAR}"
|
||||||
|
tar xvf "$XBPS_TAR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "xbps-$XBPS_VERSION"
|
||||||
|
|
||||||
|
echo "Building xbps-$XBPS_VERSION"
|
||||||
|
|
||||||
|
CFLAGS=-Wno-discarded-qualifiers \
|
||||||
|
./configure \
|
||||||
|
--prefix="$BANAN_TOOLCHAIN_PREFIX" \
|
||||||
|
--dbdir="$BANAN_TOOLCHAIN_PREFIX/db"
|
||||||
|
make $MAKE_JOBS
|
||||||
|
make install
|
||||||
|
}
|
||||||
|
|
||||||
BUILD_BINUTILS=1
|
BUILD_BINUTILS=1
|
||||||
if [[ -f $BANAN_TOOLCHAIN_PREFIX/bin/$BANAN_TOOLCHAIN_TRIPLE-ld ]]; then
|
if [[ -f $BANAN_TOOLCHAIN_PREFIX/bin/$BANAN_TOOLCHAIN_TRIPLE-ld ]]; then
|
||||||
echo "You already seem to have a binutils installed."
|
echo "You already seem to have a binutils installed."
|
||||||
@@ -283,6 +311,15 @@ if [[ -f $BANAN_TOOLCHAIN_PREFIX/bin/meson ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
BUILD_XBPS=1
|
||||||
|
if [[ -f $BANAN_TOOLCHAIN_PREFIX/bin/xbps-install ]]; then
|
||||||
|
echo "You already seem to have a xbps installed."
|
||||||
|
read -e -p "Do you want to rebuild it [y/N]? " choice
|
||||||
|
if ! [[ "$choice" == [Yy]* ]]; then
|
||||||
|
BUILD_XBPS=0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# delete everything but toolchain
|
# delete everything but toolchain
|
||||||
mkdir -p $BANAN_BUILD_DIR
|
mkdir -p $BANAN_BUILD_DIR
|
||||||
find $BANAN_BUILD_DIR -mindepth 1 -maxdepth 1 ! -name toolchain -exec rm -r {} +
|
find $BANAN_BUILD_DIR -mindepth 1 -maxdepth 1 ! -name toolchain -exec rm -r {} +
|
||||||
@@ -314,6 +351,10 @@ if (($BUILD_MESON)); then
|
|||||||
build_meson
|
build_meson
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if (($BUILD_XBPS)); then
|
||||||
|
build_xbps
|
||||||
|
fi
|
||||||
|
|
||||||
if (($BUILD_LIBSTDCPP)); then
|
if (($BUILD_LIBSTDCPP)); then
|
||||||
# delete sysroot and install libc
|
# delete sysroot and install libc
|
||||||
rm -r $BANAN_SYSROOT
|
rm -r $BANAN_SYSROOT
|
||||||
|
|||||||
Reference in New Issue
Block a user