Merge branch 'build-on-aarch64-host' into 'master'

Build redox on aarch64 host

See merge request redox-os/redox!1345
This commit is contained in:
Jeremy Soller 2023-06-07 13:41:46 +00:00
commit 58243cb56b
6 changed files with 206 additions and 14 deletions

View file

@ -311,8 +311,7 @@ ubuntu()
echo "Updating system..." echo "Updating system..."
sudo "$2" update sudo "$2" update
echo "Installing required packages..." echo "Installing required packages..."
sudo "$2" install \ pkgs="autoconf \
autoconf \
autopoint \ autopoint \
bison \ bison \
build-essential \ build-essential \
@ -324,7 +323,6 @@ ubuntu()
genisoimage \ genisoimage \
git \ git \
gperf \ gperf \
libc6-dev-i386 \
libexpat-dev \ libexpat-dev \
libfuse-dev \ libfuse-dev \
libgmp-dev \ libgmp-dev \
@ -341,7 +339,6 @@ ubuntu()
scons \ scons \
pkg-config \ pkg-config \
po4a \ po4a \
syslinux-utils \
texinfo \ texinfo \
ninja-build \ ninja-build \
meson \ meson \
@ -354,7 +351,12 @@ ubuntu()
llvm \ llvm \
clang \ clang \
perl \ perl \
doxygen doxygen"
# Not availible for at least ARM hosts
case "$host_arch" in
x86*|i?86) pkgs="$pkgs libc6-dev-i386 syslinux-utils";;
esac
sudo "$2" install $pkgs
if [ "$1" == "qemu" ]; then if [ "$1" == "qemu" ]; then
if [ -z "$(which qemu-system-x86_64)" ]; then if [ -z "$(which qemu-system-x86_64)" ]; then
echo "Installing QEMU..." echo "Installing QEMU..."
@ -713,6 +715,7 @@ elif [ "$1" == "-s" ]; then
exit exit
fi fi
host_arch=$(uname -m)
emulator="qemu" emulator="qemu"
defpackman="apt-get" defpackman="apt-get"
dependenciesonly=false dependenciesonly=false

181
config/aarch64/server.toml Normal file
View file

@ -0,0 +1,181 @@
# Default server configuration
# General settings
[general]
# Filesystem size in MiB
filesystem_size = 256
# Do not prompt if settings are not defined
prompt = false
# Package settings
[packages]
bootloader = {}
bootstrap = {}
ca-certificates = {}
contain = {}
coreutils = {}
dash = {}
diffutils = {}
# FIXME: failed to build
# drivers = {}
# FIXME: failed to build
# escalated = {}
extrautils = {}
findutils = {}
initfs = {}
# FIXME: failed to build
# installer = {}
ion = {}
ipcd = {}
kernel = {}
netdb = {}
netstack = {}
netutils = {}
# FIXME: failed to build
# pkgutils = {}
ptyd = {}
redoxfs = {}
resist = {}
smith = {}
userutils = {}
uutils = {}
# User settings
[users.root]
password = "password"
uid = 0
gid = 0
name = "root"
home = "/root"
[users.user]
# Password is unset
password = ""
[[files]]
path = "/etc/init.d/00_base"
data = """
ipcd
ptyd
pcid /etc/pcid.d/
escalated
"""
[[files]]
path = "/etc/init.d/10_net"
data = """
smolnetd
dnsd
dhcpd -b
"""
[[files]]
path = "/etc/init.d/30_console"
data = """
getty display:2/activate
getty debug: -J
"""
[[files]]
path = "/etc/net/dns"
data = """
208.67.222.222
"""
[[files]]
path = "/etc/net/ip"
data = """
10.0.2.15
"""
[[files]]
path = "/etc/net/ip_router"
data = """
10.0.2.2
"""
[[files]]
path = "/etc/net/ip_subnet"
data = """
255.255.255.0
"""
[[files]]
path = "/etc/net/mac"
data = """
54-52-00-ab-cd-ef
"""
[[files]]
path = "/etc/pkg.d/50_redox"
data = "https://static.redox-os.org/pkg"
[[files]]
path = "/etc/redox-release"
data = "0.8.0"
[[files]]
path = "/etc/group"
data = """
root;0;root
user;1000;user
sudo;1;user
"""
[[files]]
path = "/etc/hostname"
data = """
redox
"""
[[files]]
path = "/usr/bin"
data = "../bin"
symlink = true
[[files]]
path = "/usr/games"
data = "../games"
symlink = true
[[files]]
path = "/usr/include"
data = "../include"
symlink = true
[[files]]
path = "/usr/lib"
data = "../lib"
symlink = true
[[files]]
path = "/usr/share"
data = "../share"
symlink = true
[[files]]
path = "/tmp"
data = ""
directory= true
# 0o1777
mode = 1023
[[files]]
path = "/dev/null"
data = "null:"
symlink = true
[[files]]
path = "/dev/random"
data = "rand:"
symlink = true
[[files]]
path = "/dev/urandom"
data = "rand:"
symlink = true
[[files]]
path = "/dev/zero"
data = "zero:"
symlink = true

View file

@ -1,8 +1,10 @@
-include .config -include .config
HOST_ARCH?=$(shell uname -m)
# Configuration # Configuration
## Architecture to build Redox for (aarch64, i686, or x86_64) ## Architecture to build Redox for (aarch64, i686, or x86_64). Defaults to a host one
ARCH?=x86_64 ARCH?=$(HOST_ARCH)
## Enable to use binary prefix (much faster) ## Enable to use binary prefix (much faster)
PREFIX_BINARY?=1 PREFIX_BINARY?=1
## Enable to use binary packages (much faster) ## Enable to use binary packages (much faster)
@ -21,15 +23,12 @@ PODMAN_BUILD?=0
CONTAINERFILE?=podman/redox-base-containerfile CONTAINERFILE?=podman/redox-base-containerfile
# Per host variables # Per host variables
# TODO: get host arch automatically
HOST_ARCH=x86_64
HOST_CARGO=env -u RUSTUP_TOOLCHAIN cargo HOST_CARGO=env -u RUSTUP_TOOLCHAIN cargo
UNAME := $(shell uname) UNAME := $(shell uname)
ifeq ($(UNAME),Darwin) ifeq ($(UNAME),Darwin)
FUMOUNT=umount FUMOUNT=umount
export NPROC=sysctl -n hw.ncpu export NPROC=sysctl -n hw.ncpu
export REDOX_MAKE=make export REDOX_MAKE=make
PREFIX_BINARY=0
VB_AUDIO=coreaudio VB_AUDIO=coreaudio
VBM=/Applications/VirtualBox.app/Contents/MacOS/VBoxManage VBM=/Applications/VirtualBox.app/Contents/MacOS/VBoxManage
HOST_TARGET ?= $(HOST_ARCH)-apple-darwin HOST_TARGET ?= $(HOST_ARCH)-apple-darwin
@ -38,7 +37,6 @@ else ifeq ($(UNAME),FreeBSD)
FUMOUNT=sudo umount FUMOUNT=sudo umount
export NPROC=sysctl -n hw.ncpu export NPROC=sysctl -n hw.ncpu
export REDOX_MAKE=gmake export REDOX_MAKE=gmake
PREFIX_BINARY=0
VB_AUDIO=pulse # To check, will probaly be OSS on most setups VB_AUDIO=pulse # To check, will probaly be OSS on most setups
VBM=VBoxManage VBM=VBoxManage
HOST_TARGET ?= $(HOST_ARCH)-unknown-freebsd HOST_TARGET ?= $(HOST_ARCH)-unknown-freebsd
@ -59,6 +57,13 @@ else
ALLOC_FILE=fallocate --posix --length "$(FILESYSTEM_SIZE)MiB" ALLOC_FILE=fallocate --posix --length "$(FILESYSTEM_SIZE)MiB"
endif endif
ifneq ($(UNAME),Linux)
PREFIX_BINARY=0
endif
ifneq ($(HOST_ARCH),x86_64)
PREFIX_BINARY=0
endif
# Automatic variables # Automatic variables
ROOT=$(CURDIR) ROOT=$(CURDIR)
export RUST_COMPILER_RT_ROOT=$(ROOT)/rust/src/llvm-project/compiler-rt export RUST_COMPILER_RT_ROOT=$(ROOT)/rust/src/llvm-project/compiler-rt

View file

@ -16,7 +16,6 @@ else ifeq ($(ARCH),x86_64)
QEMUFLAGS+=-smp 4 -m 2048 QEMUFLAGS+=-smp 4 -m 2048
else ifeq ($(ARCH),aarch64) else ifeq ($(ARCH),aarch64)
efi=yes efi=yes
kvm=no
live=yes live=yes
QEMU_ARCH=aarch64 QEMU_ARCH=aarch64
QEMU_MACHINE=virt QEMU_MACHINE=virt
@ -33,6 +32,10 @@ else
$(error Unsupported ARCH for QEMU "$(ARCH)")) $(error Unsupported ARCH for QEMU "$(ARCH)"))
endif endif
ifneq ($(ARCH),$(HOST_ARCH))
kvm=no
endif
ifeq ($(efi),yes) ifeq ($(efi),yes)
FIRMWARE=$(BUILD)/firmware.rom FIRMWARE=$(BUILD)/firmware.rom
QEMUFLAGS+=-bios $(BUILD)/firmware.rom QEMUFLAGS+=-bios $(BUILD)/firmware.rom

View file

@ -12,7 +12,7 @@ REPOS=(
rust=rust rust=rust
) )
for package in $(installer/target/release/redox_installer --list-packages -c config/x86_64/desktop.toml) for package in $(installer/target/release/redox_installer --list-packages -c config/$(uname -m)/desktop.toml)
do do
REPOS+=("${package}=cookbook/recipes/${package}/source") REPOS+=("${package}=cookbook/recipes/${package}/source")
done done

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Ensure arch and config are set as desired, we use these to find the build dir # Ensure arch and config are set as desired, we use these to find the build dir
export ARCH=x86_64 export ARCH=$(uname -m)
export CONFIG_NAME=desktop export CONFIG_NAME=desktop
# Make sure to unmount the image first # Make sure to unmount the image first