Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 84 additions & 1 deletion bootstrap.d/dev-qt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ sources:
version: '6.3.0'
regenerate:
# Get the submodules that we'll need as a host tool
- args: ['./init-repository', '-f', '--module-subset', 'qtbase,qtsvg,qtimageformats,qtshadertools,qtlanguageserver,qtdeclarative,qtwayland,qtmultimedia']
- args: ['./init-repository', '-f', '--module-subset', 'qtbase,qtsvg,qtimageformats,qtshadertools,qtlanguageserver,qtdeclarative,qtwayland,qtmultimedia,qtwebview,qtwebchannel,qtwebsockets,qtwebengine,qtpositioning,qtserialport']

tools:
# We do a limited superbuild with only the needed modules of Qt6 to satisfy host tooling.
- name: host-qt6
from_source: qt6
tools_required:
- host-cmake
- host-ninja
configure:
- args:
- 'cmake'
Expand All @@ -26,6 +27,9 @@ tools:
- '@THIS_SOURCE_DIR@'
compile:
- args: ['cmake', '--build', '.', '--parallel', '@PARALLELISM@']
environ:
# Chromium (aka qtwebengine) will OOM otherwise
NINJAJOBS: '6'
install:
- args: ['cmake', '--install', '.']

Expand Down Expand Up @@ -395,3 +399,82 @@ packages:
- args: ['ninja', 'install']
environ:
DESTDIR: '@THIS_COLLECT_DIR@'

- name: qtwebchannel6
architecture: '@OPTION:arch@'
metadata:
summary: The Qt6 webchannel library
description: This package provides the Qt6 webview library, containing support for integrating C++ and QML applications with HTML/JavaScript clients.
spdx: 'GPL-2.0-only GPL-3.0-only LGPL-3.0-only GFDL-1.3-only'
website: 'https://code.qt.io/cgit/qt/qtwebchannel.git/'
maintainer: "Dennis Bonke <[email protected]>"
categories: ['dev-qt']
source:
subdir: 'ports'
git: 'http://code.qt.io/qt/qtwebchannel.git'
tag: 'v6.3.0'
version: '6.3.0'
tools_required:
- system-gcc
- host-cmake
- host-qt6
pkgs_required:
- mlibc
- qtbase6
- qtdeclarative6
- qtwebsockets6
- libxkbcommon
- mesa
configure:
- args:
- 'cmake'
- '-GNinja'
- '-DQT_HOST_PATH=@BUILD_ROOT@/tools/host-qt6'
- '-DCMAKE_INSTALL_PREFIX=/usr'
- '-DCMAKE_TOOLCHAIN_FILE=@SOURCE_ROOT@/scripts/CMakeToolchain-@OPTION:[email protected]'
- '-DCMAKE_BUILD_TYPE=Debug'
- '@THIS_SOURCE_DIR@'
build:
- args: ['ninja']
- args: ['ninja', 'install']
environ:
DESTDIR: '@THIS_COLLECT_DIR@'

- name: qtwebsockets6
architecture: '@OPTION:arch@'
metadata:
summary: The Qt6 websockets library
description: This package provides the Qt6 websockets library, containing support for the WebSockets protocol in Qt6.
spdx: 'GPL-2.0-only GPL-3.0-only LGPL-3.0-only GFDL-1.3-only'
website: 'https://code.qt.io/cgit/qt/qtwebsockets.git/'
maintainer: "Dennis Bonke <[email protected]>"
categories: ['dev-qt']
source:
subdir: 'ports'
git: 'http://code.qt.io/qt/qtwebsockets.git'
tag: 'v6.3.0'
version: '6.3.0'
tools_required:
- system-gcc
- host-cmake
- host-qt6
pkgs_required:
- mlibc
- qtbase6
- qtdeclarative6
- libxkbcommon
- mesa
configure:
- args:
- 'cmake'
- '-GNinja'
- '-DQT_HOST_PATH=@BUILD_ROOT@/tools/host-qt6'
- '-DCMAKE_INSTALL_PREFIX=/usr'
- '-DCMAKE_TOOLCHAIN_FILE=@SOURCE_ROOT@/scripts/CMakeToolchain-@OPTION:[email protected]'
- '-DCMAKE_BUILD_TYPE=Debug'
- '@THIS_SOURCE_DIR@'
build:
- args: ['ninja']
- args: ['ninja', 'install']
environ:
DESTDIR: '@THIS_COLLECT_DIR@'
24 changes: 19 additions & 5 deletions bootstrap.d/dev-util.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ sources:
tag: 'v3.22.0'
version: '3.22.0'

- name: ninja
subdir: ports
git: 'https://github.com/ninja-build/ninja.git'
tag: 'v1.10.2'
version: '1.10.2'

- name: 'pkg-config'
subdir: 'ports'
git: 'https://gitlab.freedesktop.org/pkg-config/pkg-config.git'
Expand Down Expand Up @@ -35,6 +41,18 @@ tools:
- args: ['make', 'install']
- args: ['ln', '-sf', '@SOURCE_ROOT@/scripts/managarm.cmake', '@PREFIX@/share/cmake-3.22/Modules/Platform/']

- name: host-ninja
from_source: ninja
configure:
- args:
- 'cmake'
- '-DCMAKE_INSTALL_PREFIX=@PREFIX@'
- '@THIS_SOURCE_DIR@'
compile:
- args: ['make', '-j@PARALLELISM@']
install:
- args: ['make', 'install']

# We could run an external pkg-config; however, we need the aclocal files.
# The easiest way to ensure that they are available is to just install pkg-config.
- name: host-pkg-config
Expand Down Expand Up @@ -176,11 +194,7 @@ packages:
website: 'https://ninja-build.org/'
maintainer: "Dennis Bonke <[email protected]>"
categories: ['dev-util']
source:
subdir: ports
git: 'https://github.com/ninja-build/ninja.git'
tag: 'v1.10.2'
version: '1.10.2'
from_source: ninja
tools_required:
- system-gcc
- host-cmake
Expand Down
34 changes: 34 additions & 0 deletions bootstrap.d/sys-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,40 @@ packages:
environ:
DESTDIR: '@THIS_COLLECT_DIR@'

- name: pciutils
architecture: '@OPTION:arch@'
metadata:
summary: Various utilities dealing with the PCI bus
description: This package contains a set of programs for listing PCI devices, inspecting their status and setting their configuration registers.
spdx: 'GPL-2.0-only'
website: 'https://mj.ucw.cz/sw/pciutils/'
maintainer: "Dennis Bonke <[email protected]>"
categories: ['sys-apps']
source:
subdir: ports
git: 'https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git'
# Commit message says released as 3.8.0, no tag made.
branch: 'master'
commit: 'd224993d423bcd0e88d8eacc0464bc3a66972e95'
version: '3.8.0'
tools_required:
- system-gcc
pkgs_required:
- mlibc
- zlib
configure:
- args: ['cp', '-r', '@THIS_SOURCE_DIR@/.', '@THIS_BUILD_DIR@']
build:
- args: ['make', 'ZLIB=yes', 'DNS=no', 'LIBKMOD=no', 'HWDB=no', 'PREFIX=/usr', 'SHAREDIR=/usr/share/hwdata', 'SHARED=yes', 'CC=x86_64-managarm-gcc', 'CXX=x86_64-managarm-g++', '-j@PARALLELISM@']
environ:
CC: 'x86_64-managarm-gcc'
CXX: 'x86_64-managarm-g++'
- args: ['make', 'ZLIB=yes', 'DNS=no', 'LIBKMOD=no', 'HWDB=no', 'PREFIX=/usr', 'SHAREDIR=/usr/share/hwdata', 'SHARED=yes', 'CC=x86_64-managarm-gcc', 'CXX=x86_64-managarm-g++', 'DESTDIR=@THIS_COLLECT_DIR@', 'install', 'install-lib']
environ:
CC: 'x86_64-managarm-gcc'
CXX: 'x86_64-managarm-g++'
- args: ['chmod', '-v', '755', '@THIS_COLLECT_DIR@/usr/lib/libpci.so']

- name: sed
labels: [aarch64]
architecture: '@OPTION:arch@'
Expand Down
29 changes: 29 additions & 0 deletions patches/ninja/0001-Add-support-for-NINJAJOBS.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From 7dbf497370dac35a8e2dba6b64eb13989f1ab4fb Mon Sep 17 00:00:00 2001
From: Dennis Bonke <[email protected]>
Date: Fri, 29 Apr 2022 20:12:56 +0200
Subject: [PATCH] Add support for NINJAJOBS

Signed-off-by: Dennis Bonke <[email protected]>
---
src/ninja.cc | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/src/ninja.cc b/src/ninja.cc
index 471a023..5c1cb3f 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -227,6 +227,11 @@ void Usage(const BuildConfig& config) {

/// Choose a default value for the -j (parallelism) flag.
int GuessParallelism() {
+ int j = 0;
+ char* jobs = getenv( "NINJAJOBS" );
+ if ( jobs != NULL ) j = atoi( jobs );
+ if ( j > 0 ) return j;
Comment on lines +17 to +22
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we patch ninja instead of just using the -j flag? Patching ninja doesn't sound really appealing to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If ninja is invoked by a different build system or a script (for example, qtwebengine, which builds with cmake but then builds chromium with ninja), an user can't pass the -j flag. With this patch, we can also use the NINJAJOBS environment variable. The patch was sourced from BLFS.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using the build subcommand of cmake, you can pass arguments to make/ninja like so: cmake build -- -jN

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I didn't know that. In that case it's possible to drop the patch, tho I don't mind keeping it either.

+
switch (int processors = GetProcessorCount()) {
case 0:
case 1:
--
2.36.0

147 changes: 147 additions & 0 deletions patches/pciutils/0001-Add-initial-Managarm-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
From f6c4152a19b2430b491ff9b0c0e16a2b368ca60d Mon Sep 17 00:00:00 2001
From: Dennis Bonke <[email protected]>
Date: Wed, 27 Apr 2022 23:11:14 +0200
Subject: [PATCH] Add initial Managarm support

Signed-off-by: Dennis Bonke <[email protected]>
---
lib/filter.c | 8 ++++----
lib/i386-io-linux.h | 25 +++++++++++++++++++++++++
lib/i386-ports.c | 20 ++++++++++++++++++++
lib/sysdep.h | 6 +++---
4 files changed, 52 insertions(+), 7 deletions(-)

diff --git a/lib/filter.c b/lib/filter.c
index b881b6b..294c69b 100644
--- a/lib/filter.c
+++ b/lib/filter.c
@@ -304,20 +304,20 @@ pci_filter_match_v30(struct pci_filter_v30 *f, struct pci_dev *d)

STATIC_ALIAS(void pci_filter_init(struct pci_access *a, struct pci_filter *f), pci_filter_init_v38(a, f));
SYMBOL_VERSION(pci_filter_init_v30, pci_filter_init@LIBPCI_3.0);
-SYMBOL_VERSION(pci_filter_init_v38, pci_filter_init@LIBPCI_3.3);
+//SYMBOL_VERSION(pci_filter_init_v38, pci_filter_init@LIBPCI_3.3);
Comment on lines +22 to +23
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this done?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got strange linker errors related to this, so I removed it. If requested, we could investigate it and fix those instead.

SYMBOL_VERSION(pci_filter_init_v38, pci_filter_init@@LIBPCI_3.8);

STATIC_ALIAS(char *pci_filter_parse_slot(struct pci_filter *f, char *str), pci_filter_parse_slot_v38(f, str));
SYMBOL_VERSION(pci_filter_parse_slot_v30, pci_filter_parse_slot@LIBPCI_3.0);
-SYMBOL_VERSION(pci_filter_parse_slot_v38, pci_filter_parse_slot@LIBPCI_3.3);
+//SYMBOL_VERSION(pci_filter_parse_slot_v38, pci_filter_parse_slot@LIBPCI_3.3);
SYMBOL_VERSION(pci_filter_parse_slot_v38, pci_filter_parse_slot@@LIBPCI_3.8);

STATIC_ALIAS(char *pci_filter_parse_id(struct pci_filter *f, char *str), pci_filter_parse_id_v38(f, str));
SYMBOL_VERSION(pci_filter_parse_id_v30, pci_filter_parse_id@LIBPCI_3.0);
-SYMBOL_VERSION(pci_filter_parse_id_v38, pci_filter_parse_id@LIBPCI_3.3);
+//SYMBOL_VERSION(pci_filter_parse_id_v38, pci_filter_parse_id@LIBPCI_3.3);
SYMBOL_VERSION(pci_filter_parse_id_v38, pci_filter_parse_id@@LIBPCI_3.8);

STATIC_ALIAS(int pci_filter_match(struct pci_filter *f, struct pci_dev *d), pci_filter_match_v38(f, d));
SYMBOL_VERSION(pci_filter_match_v30, pci_filter_match@LIBPCI_3.0);
-SYMBOL_VERSION(pci_filter_match_v38, pci_filter_match@LIBPCI_3.3);
+//SYMBOL_VERSION(pci_filter_match_v38, pci_filter_match@LIBPCI_3.3);
SYMBOL_VERSION(pci_filter_match_v38, pci_filter_match@@LIBPCI_3.8);
diff --git a/lib/i386-io-linux.h b/lib/i386-io-linux.h
index 731e8e3..6c22ed7 100644
--- a/lib/i386-io-linux.h
+++ b/lib/i386-io-linux.h
@@ -6,6 +6,29 @@
* Can be freely distributed and used under the terms of the GNU GPL.
*/

+#ifdef __managarm__
+
+static int
+intel_setup_io(struct pci_access *a UNUSED)
+{
+ return 0;
+}
+
+static inline void
+intel_cleanup_io(struct pci_access *a UNUSED)
+{
+}
+
+static inline void intel_io_lock(void)
+{
+}
+
+static inline void intel_io_unlock(void)
+{
+}
+
+#else
+
#include <sys/io.h>

static int
@@ -27,3 +50,5 @@ static inline void intel_io_lock(void)
static inline void intel_io_unlock(void)
{
}
+
+#endif
diff --git a/lib/i386-ports.c b/lib/i386-ports.c
index 2e64fe4..ca20192 100644
--- a/lib/i386-ports.c
+++ b/lib/i386-ports.c
@@ -32,6 +32,26 @@
#error Do not know how to access I/O ports on this OS.
#endif

+#ifdef __managarm__
+static void outb(unsigned char value, unsigned short int port) {}
+
+static void outw(unsigned short int value, unsigned short int port) {}
+
+static void outl(unsigned int value, unsigned short int port) {}
+
+static unsigned char inb(unsigned short int port) {
+ return 0;
+}
+
+static unsigned short int inw(unsigned short int port) {
+ return 0;
+}
+
+static unsigned int inl(unsigned short int port) {
+ return 0;
+}
+#endif
Comment on lines +91 to +109
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not look correct. We should not silently return wrong values (?).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed we shouldn't, but at the time of creating this patch the libc wrapper functions didn't exist yet and I was too lazy to patch them in properly. With the correct mlibc PR merged, we might be able to drop this part of the patch completely.

+
static int conf12_io_enabled = -1; /* -1=haven't tried, 0=failed, 1=succeeded */

static int
diff --git a/lib/sysdep.h b/lib/sysdep.h
index bdeb34a..a4f0a76 100644
--- a/lib/sysdep.h
+++ b/lib/sysdep.h
@@ -29,7 +29,7 @@ typedef u16 word;
#endif
#endif

-#ifdef PCI_HAVE_LINUX_BYTEORDER_H
+#if defined PCI_HAVE_LINUX_BYTEORDER_H && !defined __managarm__

#include <asm/byteorder.h>
#define cpu_to_le16 __cpu_to_le16
@@ -39,7 +39,7 @@ typedef u16 word;

#else

-#ifdef PCI_OS_LINUX
+#if defined PCI_OS_LINUX && !defined __managarm__
Comment on lines +131 to +132
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this done?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly don't remember anymore, we might be able to just drop this part.

#include <endian.h>
#define BYTE_ORDER __BYTE_ORDER
#define BIG_ENDIAN __BIG_ENDIAN
@@ -74,7 +74,7 @@ typedef u16 word;
#endif
#endif

-#ifdef PCI_OS_SYLIXOS
+#if defined PCI_OS_SYLIXOS || defined __managarm__
#include <endian.h>
#endif

--
2.36.0