diff options
-rw-r--r-- | README | 94 | ||||
-rw-r--r-- | configs/versions | 3 | ||||
-rw-r--r-- | patches/tinyxlib-tcc.patch | 11 | ||||
-rw-r--r-- | patches/tinyxserver-tcc.patch | 59 | ||||
-rw-r--r-- | patches/uflbbl-boot-options.patch | 8 | ||||
-rwxr-xr-x | scripts/build.sh | 42 | ||||
-rwxr-xr-x | scripts/create_root.sh | 2 | ||||
-rwxr-xr-x | scripts/run_qemu_direct.sh | 3 |
8 files changed, 215 insertions, 7 deletions
@@ -235,6 +235,50 @@ Memory optimization: CONFIG_PHYSICAL_ALIGN=0x2000 8K CONFIG_RELOCATABLE=n boot.asm: set ramdisk and linux addresses correctly + +tinyx/framebuffer: + +- CONFIG_FB=y + => generic framebuffer support + +- CONFIG_FRAMEBUFFER_CONSOLE=y + => console on framebuffer + +- CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION=y +- CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y + +- CONFIG_FONTS + => do we need them, at least fk.ko complains about font functions otherwise + +- CONFIG_FB_VESA=y + => only selectable if framebuffer support is NOT built as modules + => this also means we can only start x framebuffer X in the most generic + SVGA case when using no modules for the framebuffer modules + => works only if a vga=XXX parameter is passed on boot? + + +TODO: CONFIG_FB_VGA16=m + => for lowest VGA mode + => never got that one working + +TODO: looks optional for a simple running system +- CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION=y + => we use fbdev low-level drivers for Cirrus, Alix, etc. + +- CONFIG_FB_CIRRUS=y + => for the Unisys 486 machine, also for qemu? + +- CONFIG_FB_GEODE_LX=y + => for the Alix 1.E + +- CONFIG_MOUSE_PS2=m +- CONFIG_INPUT_MOUSEDEV=m + CONFIG_INPUT_MOUSEDEV_PSAUX=y + +- CONFIG_INPUT_EVDEV=m + => /dev/input/eventX + +TODO: CONFIG_SYSFB_SIMPLEFB=y TODO FROM HERE: @@ -358,7 +402,39 @@ bugs -> right, where to, or does it live in the cache only? Freeing initrd memory: 688K -> is this our ramdisk? we didn't to switch_root yet - +- tcc is almost usable inside the i486 system, just some pathes are + wrong, this small example works fine: + mkdir -p /home/abaumann/projects/i486tcc-linux/build/stage1 + /home/abaumann/projects/i486tcc-linux/build/stage1 + ln -s /include . + ln -s /lib . + cat test.c <<EOF +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +int main( int argc, char *argv[] ) +{ + puts( "hello" ); + + exit( EXIT_SUCCESS ); +} +EOF + i386-tcc -c -o test.o test.c + i386-tcc -static -o test test.o + => recompilation of tcc inside the 486 system might be a problem because + of the build system +- modern Xorg ist out of reach (and old devices DO have good framebuffer support!), + Xvesa from tinyx doesn't build because of missin vm86 stuff (presumable for mode + timing), this might be because we use musl? + Xfbdev builds, vesafb only works when started at boot time (not as module) which is + annoying. +- "Could not init font path element ../share/X11/fonts/, removing from list" + https://www.x.org/releases/X11R7.5/doc/libXfont/fontlib.html + => the pathes must be absolute and no errors in any file whatsover! + Only BCF, PCF are supported +- font handling when installing, currently in local/share/fonts/X11, we + should generate them from BCF files + missing things -------------- @@ -638,7 +714,21 @@ links - https://patchwork.kernel.org/project/linux-block/patch_20190612163144.18486-2/roman.stratiienko@globallogic.com/ - debugging - https://www.kernel.org/doc/html/v4.15/dev-tools/kgdb.html - +- X + - tiny X + - https://github.com/idunham/tinyxserver (puppy linux): has nice simple + makefiles + - https://github.com/tinycorelinux/tinyx, is newer, but requires autoconf mess + to build + - X terminal + - xterm: bloat + - st, requires Xft, requiring fontconfig, freetype2, etc. can eventually + be redone to use old font library? + - rxvt: simple and uses normal bitmap fonts (old font library) +- terminal multiplexing + - tmux: newer + - screen: looks a little bit aged, might habe more features but also more code + Real hardware ------------- diff --git a/configs/versions b/configs/versions index 0ba20c4..6513275 100644 --- a/configs/versions +++ b/configs/versions @@ -20,3 +20,6 @@ NBD_VERSION="3.25" SAMURAI_VERSION="1.2" JOE_VERSION="4.6" DROPBEAR_VERSION="2022.83" +TINYXLIB_VERSION="9862f35" +TINYXSERVER_VERSION="b010434" +RXVT_VERSION="2.6.4" diff --git a/patches/tinyxlib-tcc.patch b/patches/tinyxlib-tcc.patch new file mode 100644 index 0000000..38e7c29 --- /dev/null +++ b/patches/tinyxlib-tcc.patch @@ -0,0 +1,11 @@ +diff -rauN tinyxlib/libXfont/bitmap/bdfread.c tinyxlib-tcc-patch/libXfont/bitmap/bdfread.c +--- tinyxlib/libXfont/bitmap/bdfread.c 2023-07-13 15:03:17.000000000 +0200 ++++ tinyxlib-tcc-patch/libXfont/bitmap/bdfread.c 2023-07-13 15:24:35.465753463 +0200 +@@ -60,6 +60,7 @@ + /* use bitmap structure */ + #include "../include/bitmap.h" + #include "bdfint.h" ++#include <stdint.h> + + #define INDICES 256 + #define MAXENCODING 0xFFFF diff --git a/patches/tinyxserver-tcc.patch b/patches/tinyxserver-tcc.patch new file mode 100644 index 0000000..6c68fdd --- /dev/null +++ b/patches/tinyxserver-tcc.patch @@ -0,0 +1,59 @@ +diff -rauN tinyxserver/Makefile tinyxserver-tcc-patch/Makefile +--- tinyxserver/Makefile 2023-07-14 09:31:20.000000000 +0200 ++++ tinyxserver-tcc-patch/Makefile 2023-07-14 10:14:19.897926578 +0200 +@@ -61,7 +61,7 @@ + install: + install -D -m 755 Xfbdev $(DESTDIR)/$(BINDIR)/Xfbdev + install -m 755 xinit $(DESTDIR)/$(BINDIR)/xinit +- ln -s $(BINDIR)/Xfbdev $(DESTDIR)/$(BINDIR)/X ++ ln -fs $(BINDIR)/Xfbdev $(DESTDIR)/$(BINDIR)/X + install -D -m 644 init/xinit.1 $(DESTDIR)/$(MANDIR)/man1/xinit.1 + install -D -m 644 README $(DESTDIR)/$(DOCDIR)/tinyxserver/README + install -m 644 changelog $(DESTDIR)/$(DOCDIR)/tinyxserver/changelog +diff -rauN tinyxserver/standard_definitions.mk tinyxserver-tcc-patch/standard_definitions.mk +--- tinyxserver/standard_definitions.mk 2023-07-14 09:31:21.000000000 +0200 ++++ tinyxserver-tcc-patch/standard_definitions.mk 2023-07-21 17:23:14.589816273 +0200 +@@ -2,12 +2,16 @@ + ####compiler#### + CC=/usr/bin/gcc + #CC=/opt/musl/bin/musl-gcc ++CC="${BASE}/build/stage1/bin/i386-tcc" + + ####compilerflags#### +-COMPFLAGS=-pipe -fPIC -Os -Wall -D_BSD_SOURCE -D_GNU_SOURCE -D__KERNEL_STRICT_NAMES \ +--fno-strength-reduce -nodefaultlibs -fno-strict-aliasing \ +--ffunction-sections -fdata-sections \ +--I. -I/usr/xsrc/pkg/usr/include ++COMPFLAGS="-Os -I${BASE}/build/stage1/include/X11" ++#LDFLAGS=-static \ ++# COMPFLAGS="-Os -Wall -D_DEFAULT_SOURCE -I${BASE}/include/X11" \ ++#COMPFLAGS=-pipe -fPIC -Os -Wall -D_BSD_SOURCE -D_GNU_SOURCE -D__KERNEL_STRICT_NAMES \ ++#-fno-strength-reduce -nodefaultlibs -fno-strict-aliasing \ ++#-ffunction-sections -fdata-sections \ ++#-I. -I/usr/xsrc/pkg/usr/include + + + ####extensions#### +@@ -101,14 +105,17 @@ + $(BIGREQS) \ + -D__KERNEL_STRICT_NAMES + +-LDFLAGS=-static -Wl,--gc-sections,--sort-common,-s +-LINKDIR=-L/usr/xsrc/pkg/usr/lib ++LDFLAGS=-static ++LINKDIR="-L${BASE}/lib" + + #LINKDIR=-L/opt/musl/lib + #LIBDIR=/opt/musl/lib + #INCDIR=/opt/musl/include + +-PREDIR=/usr ++PREDIR=/ + LIBDIR=$(DESTDIR)$(PREDIR)/lib +-INCDIR=$(DESTIR)$(PREDIR)/include +- ++INCDIR=$(DESTDIR)$(PREDIR)/include ++BINDIR=$(PREDIR)/bin ++MANDIR=$(PREDIR)/share/man ++DOCDIR=$(PREDIR)/share/doc ++FONTDIR=$(PREDIR)/share/fonts diff --git a/patches/uflbbl-boot-options.patch b/patches/uflbbl-boot-options.patch index ccf4c98..9d417ed 100644 --- a/patches/uflbbl-boot-options.patch +++ b/patches/uflbbl-boot-options.patch @@ -1,6 +1,6 @@ -diff -rauN a/src/boot.asm b/src/boot.asm ---- a/src/boot.asm 2023-05-05 18:48:22.000000000 +0200 -+++ b/src/boot.asm 2023-05-19 15:44:17.984926907 +0200 +diff -rauN uflbbl/src/boot.asm uflbbl-boot-options/src/boot.asm +--- uflbbl/src/boot.asm 2023-07-13 08:47:23.000000000 +0200 ++++ uflbbl-boot-options/src/boot.asm 2023-07-15 15:52:51.045860124 +0200 @@ -468,10 +468,10 @@ mov [READ_STATE], byte STATE_READ_INITRD ; qemu initrd start location 7fab000, 133869568 (this is 128MB) too high for us, @@ -20,7 +20,7 @@ diff -rauN a/src/boot.asm b/src/boot.asm KERNEL_CMD_LINE: - db "debug loglevel=7 earlycon=uart8250,io,0x3f8,9600n8 console=tty0 console=ttyS0,9600n8 rdinit=/bin/sinit root=/dev/ram0 rootfstype=ramfs iommu=off", 0 -+ db "debug loglevel=7 earlyprintk=vga earlycon=uart8250,io,0x3f8,9600n8 console=tty0 console=ttyS0,9600n8 init=/init iommu=off nomodeset", 0 ++ db "debug loglevel=7 earlyprintk=vga earlycon=uart8250,io,0x3f8,9600n8 console=tty0 console=ttyS0,9600n8 init=/init iommu=off vga=0x311", 0 KERNEL_CMD_SIZE equ $-KERNEL_CMD_LINE diff --git a/scripts/build.sh b/scripts/build.sh index 6f8477f..f6b9722 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -422,6 +422,48 @@ else echo "stage1 dropbear exists" fi +if [ ! -f "${BASE}/build/stage1/lib/libX11.a" ]; then + rm -rf "tinyxlib-${TINYXLIB_VERSION}" + tar xf "${BASE}/downloads/tinyxlib-${TINYXLIB_VERSION}.tar.gz" + cd "tinyxlib-${TINYXLIB_VERSION}" + patch -Np1 < "${BASE}/patches/tinyxlib-tcc.patch" + make -j$CPUS CC="${BASE}/build/stage1/bin/i386-tcc" \ + COMPFLAGS="-Os -march=i486 -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_GNU_SOURCE -fno-strength-reduce -nostdlib -fno-strict-aliasing -I. -ffunction-sections -fdata-sections" \ + LDFLAGS="" + mkdir -p "${BASE}/build/stage1/share/X11" + make -j$CPUS DESTDIR="${BASE}/build/stage1" PREDIR=/ -j$CPUS install + cd .. +else + echo "stage1 tinyxlib exists" +fi + +if [ ! -f "${BASE}/build/stage1/bin/Xfbdev" ]; then + rm -rf "tinyxserver-${TINYXSERVER_VERSION}" + tar xf "${BASE}/downloads/tinyxserver-${TINYXSERVER_VERSION}.tar.gz" + cd "tinyxserver-${TINYXSERVER_VERSION}" + patch -Np1 < "${BASE}/patches/tinyxserver-tcc.patch" + make -j$CPUS BASE="${BASE}" core Xfbdev xinit + make -j$CPUS BASE="${BASE}" DESTDIR="${BASE}/build/stage1" PREDIR=/ -j$CPUS install + cd .. +else + echo "stage1 Xfbdev exists" +fi + +if [ ! -f "${BASE}/build/stage1/bin/rxvt" ]; then + rm -rf "rxvt-${RXVT_VERSION}" + tar xf "${BASE}/downloads/rxvt-${RXVT_VERSION}.tar.gz" + cd "rxvt-${RXVT_VERSION}" + CC="${BASE}/build/stage1/bin/i386-tcc" \ + ./configure --enable-static --prefix="${BASE}/build/stage1" \ + --x-includes="${BASE}/build/stage1/include" \ + --x-libraries="${BASE}/build/stage1/lib" + make -j$CPUS LDFLAGS="-static" + make -j$CPUS install + cd .. +else + echo "stage1 rxvt exists" +fi + # TODO FROM HERE # TODO: have some way to deal with dependencies and with the user diff --git a/scripts/create_root.sh b/scripts/create_root.sh index 1adc8e9..727093f 100755 --- a/scripts/create_root.sh +++ b/scripts/create_root.sh @@ -77,6 +77,8 @@ test -d "${ROOT}/bin" || mkdir "${ROOT}/bin" cp -dR "${LOCAL}"/bin/* "${ROOT}/bin" test -d "${ROOT}/etc" || mkdir "${ROOT}/etc" cp -dR "${LOCAL}"/etc/* "${ROOT}/etc" +test -d "${ROOT}/share" || mkdir "${ROOT}/share" +cp -dR "${LOCAL}"/share/* "${ROOT}/share" # copy ramdisk, boot loader and kernel to /boot cp ramdisk.img "${ROOT}/boot" diff --git a/scripts/run_qemu_direct.sh b/scripts/run_qemu_direct.sh index 0e34b13..974515e 100755 --- a/scripts/run_qemu_direct.sh +++ b/scripts/run_qemu_direct.sh @@ -4,7 +4,8 @@ qemu-nbd -f raw root.img -x ROOT & sleep 2 && \ qemu-system-i386 -cpu 486 -m 24M -machine isapc \ -kernel bzImage -initrd ramdisk.img \ - -append "debug loglevel=7 earlycon=vga earlycon=uart8250,io,0x3f8,9600n8 console=tty0 console=ttyS0,9600n8 iommu=off nomodeset init=/init" \ + -append "debug loglevel=7 earlycon=vga earlycon=uart8250,io,0x3f8,9600n8 console=tty0 console=ttyS0,9600n8 iommu=off init=/init vga=0x311" \ -netdev user,id=net0,net=10.0.0.0/24,host=10.0.0.2,dhcpstart=10.0.0.16,hostfwd=tcp::2222-:22 \ + -vga std \ -device ne2k_isa,iobase=0x300,irq=10,netdev=net0 pkill qemu-nbd |