Initial commit
This commit is contained in:
commit
59c681004b
|
@ -0,0 +1 @@
|
||||||
|
*[~%]
|
|
@ -0,0 +1 @@
|
||||||
|
source "$BR2_EXTERNAL_COMMANDER_PI16_PATH/package/x16emu/Config.in"
|
|
@ -0,0 +1,24 @@
|
||||||
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
|
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
distribute this software, either in source code form or as a compiled
|
||||||
|
binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
means.
|
||||||
|
|
||||||
|
In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
of this software dedicate any and all copyright interest in the
|
||||||
|
software to the public domain. We make this dedication for the benefit
|
||||||
|
of the public at large and to the detriment of our heirs and
|
||||||
|
successors. We intend this dedication to be an overt act of
|
||||||
|
relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
For more information, please refer to <https://unlicense.org/>
|
|
@ -0,0 +1,53 @@
|
||||||
|
# Commander Pi16
|
||||||
|
|
||||||
|
This is a collection of buildroot scripts and configuration files that allow
|
||||||
|
you to create your own [Commander X16](https://www.commanderx16.com/)
|
||||||
|
emulation box based on the Raspberry Pi.
|
||||||
|
|
||||||
|
What you will get **is not a baremetal emulator**: it is not a full Linux
|
||||||
|
distribution either but it still runs on top of the Linux kernel.
|
||||||
|
|
||||||
|
The boot time is about 25s on a Raspberry Pi 4 from the firmware splashscreen
|
||||||
|
to the CX16 ready prompt.
|
||||||
|
|
||||||
|
This is by no means a finished product: there is still a lot of work to do
|
||||||
|
in order to strip down the image to the bare minimum and to improve
|
||||||
|
performance, boot time and user experience.
|
||||||
|
|
||||||
|
|
||||||
|
## Building the bootable image
|
||||||
|
|
||||||
|
On the first line below, you might want to use the mirror at
|
||||||
|
`https://github.com/buildroot/buildroot` instead of the official git repo at
|
||||||
|
busybox.net .
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://git.busybox.net/buildroot
|
||||||
|
git clone $this_repo_location/commander-pi16
|
||||||
|
cd buildroot
|
||||||
|
git checkout 2021.02.3 # Check out the latest stable release
|
||||||
|
# In the next command you need to pick the defconfig for your rpi version
|
||||||
|
# from the table in the next section.
|
||||||
|
make BR2_EXTERNAL=../commander-pi16 cpi16_raspberrypi_defconfig
|
||||||
|
make menuconfig # Only if you want to customise your build
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
This will take a while, especially the first time. Once the build is completed
|
||||||
|
you will find a file called `sdcard.img` in `output/images`. Just flash it to
|
||||||
|
an sd card using your favourite method.
|
||||||
|
|
||||||
|
Before booting the rpi you will have to drop a ROM image compatible with the
|
||||||
|
current emulator version in the root of the FAT32 partition. The file must be
|
||||||
|
named `rom.bin`.
|
||||||
|
|
||||||
|
|
||||||
|
## Supported boards
|
||||||
|
|
||||||
|
| Board | defconfig file |
|
||||||
|
|--------------------------|----------------------------------------|
|
||||||
|
| Raspberry Pi B+ | cpi16_raspberrypi_defconfig |
|
||||||
|
| Raspberry Pi4 B+ | cpi16_raspberrypi4_64_defconfig |
|
||||||
|
|
||||||
|
Note: the Raspberry Pi B+ port is very slow, to the point of being barely
|
||||||
|
usable.
|
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -u
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Run x16emu on boot
|
||||||
|
if [ -e ${TARGET_DIR}/etc/inittab ]; then
|
||||||
|
grep -qE '^tty7::' ${TARGET_DIR}/etc/inittab || \
|
||||||
|
sed -i '/HDMI console/a\
|
||||||
|
tty7::respawn:/bin/start.sh # run x16emu' ${TARGET_DIR}/etc/inittab
|
||||||
|
fi
|
||||||
|
|
||||||
|
configtxt="${BINARIES_DIR}/rpi-firmware/config.txt"
|
||||||
|
|
||||||
|
for arg in "$@";
|
||||||
|
do
|
||||||
|
case "${arg}" in
|
||||||
|
--enable-audio)
|
||||||
|
# Enable analog audio
|
||||||
|
if ! grep -qE '^dtparam=audio=' "${configtxt}"; then
|
||||||
|
echo "Adding 'dtparam=audio=on' to config.txt."
|
||||||
|
echo "dtparam=audio=on" >> "${configtxt}"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
--overlay=*)
|
||||||
|
# Add overlays
|
||||||
|
ovlline="dtoverlay=${arg:10}"
|
||||||
|
if ! grep -qE '^${ovlline}' "${configtxt}"; then
|
||||||
|
echo "Adding '${ovlline}' to config.txt."
|
||||||
|
echo "${ovlline}" >> "${configtxt}"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
fatmnt=/mnt
|
||||||
|
x16emu=/bin/x16emu
|
||||||
|
x16emuargs=""
|
||||||
|
rootlabel=rootfs
|
||||||
|
|
||||||
|
workdir="${fatmnt}/x16"
|
||||||
|
romimage="${fatmnt}/rom.bin"
|
||||||
|
nvramimage="${fatmnt}/nvram.bin"
|
||||||
|
|
||||||
|
|
||||||
|
if ! mountpoint -q "${fatmnt}" ; then
|
||||||
|
rootdev=$(realpath /dev/disk/by-label/${rootlabel})
|
||||||
|
fatdev="${rootdev%2}1"
|
||||||
|
[ -d "${fatmnt}" ] || mkdir -p "${fatmnt}"
|
||||||
|
mount "${fatdev}" "${fatmnt}" || exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "${romimage}" ] ; then
|
||||||
|
mkdir -p "${workdir}"
|
||||||
|
(
|
||||||
|
cd "${workdir}"
|
||||||
|
"${x16emu}" -rom "${romimage}" -nvram "${nvramimage}" ${x16emuargs}
|
||||||
|
)
|
||||||
|
else
|
||||||
|
echo "Can't find rom.bin in the root directory of the sdcard."
|
||||||
|
while true ; do
|
||||||
|
sleep 60
|
||||||
|
done
|
||||||
|
fi
|
|
@ -0,0 +1,41 @@
|
||||||
|
BR2_aarch64=y
|
||||||
|
BR2_cortex_a72=y
|
||||||
|
BR2_ARM_FPU_VFPV4=y
|
||||||
|
BR2_SHARED_STATIC_LIBS=y
|
||||||
|
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
|
||||||
|
BR2_TOOLCHAIN_BUILDROOT_CXX=y
|
||||||
|
BR2_GCC_ENABLE_LTO=y
|
||||||
|
BR2_GCC_ENABLE_GRAPHITE=y
|
||||||
|
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
|
||||||
|
BR2_SYSTEM_DHCP="eth0"
|
||||||
|
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_COMMANDER_PI16_PATH)/board/commander-pi16/rootfs_overlay"
|
||||||
|
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi4-64/post-build.sh $(BR2_EXTERNAL_COMMANDER_PI16_PATH)/board/commander-pi16/post-build.sh"
|
||||||
|
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi4-64/post-image.sh"
|
||||||
|
BR2_ROOTFS_POST_SCRIPT_ARGS="--add-miniuart-bt-overlay --aarch64 --enable-audio --overlay=vc4-kms-v3d-pi4 --overlay=rpivid-v4l2"
|
||||||
|
BR2_LINUX_KERNEL=y
|
||||||
|
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
|
||||||
|
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,967d45b29ca2902f031b867809d72e3b3d623e7a)/linux-967d45b29ca2902f031b867809d72e3b3d623e7a.tar.gz"
|
||||||
|
BR2_LINUX_KERNEL_DEFCONFIG="bcm2711"
|
||||||
|
BR2_LINUX_KERNEL_DTS_SUPPORT=y
|
||||||
|
BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2711-rpi-4-b"
|
||||||
|
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
|
||||||
|
BR2_PACKAGE_ALSA_UTILS=y
|
||||||
|
BR2_PACKAGE_ALSA_UTILS_AMIXER=y
|
||||||
|
BR2_PACKAGE_MESA3D=y
|
||||||
|
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_KMSRO=y
|
||||||
|
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_V3D=y
|
||||||
|
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VC4=y
|
||||||
|
BR2_PACKAGE_MESA3D_OPENGL_ES=y
|
||||||
|
BR2_PACKAGE_SDL2_KMSDRM=y
|
||||||
|
BR2_PACKAGE_SDL2_OPENGLES=y
|
||||||
|
BR2_PACKAGE_RPI_FIRMWARE=y
|
||||||
|
BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4=y
|
||||||
|
BR2_PACKAGE_GIFLIB=y
|
||||||
|
BR2_TARGET_ROOTFS_EXT2=y
|
||||||
|
BR2_TARGET_ROOTFS_EXT2_4=y
|
||||||
|
BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
|
||||||
|
# BR2_TARGET_ROOTFS_TAR is not set
|
||||||
|
BR2_PACKAGE_HOST_DOSFSTOOLS=y
|
||||||
|
BR2_PACKAGE_HOST_GENIMAGE=y
|
||||||
|
BR2_PACKAGE_HOST_MTOOLS=y
|
||||||
|
BR2_PACKAGE_X16EMU=y
|
|
@ -0,0 +1,36 @@
|
||||||
|
BR2_arm=y
|
||||||
|
BR2_arm1176jzf_s=y
|
||||||
|
BR2_SHARED_STATIC_LIBS=y
|
||||||
|
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
|
||||||
|
BR2_TOOLCHAIN_BUILDROOT_CXX=y
|
||||||
|
BR2_GCC_ENABLE_LTO=y
|
||||||
|
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
|
||||||
|
BR2_SYSTEM_DHCP="eth0"
|
||||||
|
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_COMMANDER_PI16_PATH)/board/commander-pi16/rootfs_overlay"
|
||||||
|
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi/post-build.sh $(BR2_EXTERNAL_COMMANDER_PI16_PATH)/board/commander-pi16/post-build.sh"
|
||||||
|
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi/post-image.sh"
|
||||||
|
BR2_ROOTFS_POST_SCRIPT_ARGS="--enable-audio"
|
||||||
|
BR2_LINUX_KERNEL=y
|
||||||
|
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
|
||||||
|
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,967d45b29ca2902f031b867809d72e3b3d623e7a)/linux-967d45b29ca2902f031b867809d72e3b3d623e7a.tar.gz"
|
||||||
|
BR2_LINUX_KERNEL_DEFCONFIG="bcmrpi"
|
||||||
|
BR2_LINUX_KERNEL_DTS_SUPPORT=y
|
||||||
|
BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2708-rpi-b bcm2708-rpi-b-plus bcm2708-rpi-cm"
|
||||||
|
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
|
||||||
|
BR2_PACKAGE_ALSA_UTILS=y
|
||||||
|
BR2_PACKAGE_ALSA_UTILS_AMIXER=y
|
||||||
|
BR2_PACKAGE_ALSA_UTILS_APLAY=y
|
||||||
|
BR2_PACKAGE_ALSA_UTILS_SPEAKER_TEST=y
|
||||||
|
BR2_PACKAGE_MADPLAY=y
|
||||||
|
BR2_PACKAGE_SDL2_OPENGLES=y
|
||||||
|
BR2_PACKAGE_RPI_FIRMWARE=y
|
||||||
|
# BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS is not set
|
||||||
|
BR2_PACKAGE_RPI_USERLAND=y
|
||||||
|
BR2_TARGET_ROOTFS_EXT2=y
|
||||||
|
BR2_TARGET_ROOTFS_EXT2_4=y
|
||||||
|
BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
|
||||||
|
# BR2_TARGET_ROOTFS_TAR is not set
|
||||||
|
BR2_PACKAGE_HOST_DOSFSTOOLS=y
|
||||||
|
BR2_PACKAGE_HOST_GENIMAGE=y
|
||||||
|
BR2_PACKAGE_HOST_MTOOLS=y
|
||||||
|
BR2_PACKAGE_X16EMU=y
|
|
@ -0,0 +1,2 @@
|
||||||
|
name: COMMANDER_PI16
|
||||||
|
desc: Turn your Raspberry Pi into a Commander X16
|
|
@ -0,0 +1 @@
|
||||||
|
include $(sort $(wildcard $(BR2_EXTERNAL_COMMANDER_PI16_PATH)/package/*/*.mk))
|
|
@ -0,0 +1,11 @@
|
||||||
|
config BR2_PACKAGE_X16EMU
|
||||||
|
bool "x16emu"
|
||||||
|
depends on !BR2_STATIC_LIBS # sdl2
|
||||||
|
select BR2_PACKAGE_SDL2
|
||||||
|
help
|
||||||
|
Emulator for the Commander X16 computer system.
|
||||||
|
|
||||||
|
https://github.com/commanderx16/
|
||||||
|
|
||||||
|
comment "x16emu requires dynamic libraries"
|
||||||
|
depends on BR2_STATIC_LIBS
|
|
@ -0,0 +1,28 @@
|
||||||
|
################################################################################
|
||||||
|
#
|
||||||
|
# x16emu
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
X16EMU_VERSION = master
|
||||||
|
X16EMU_SITE = $(call github,commanderx16,x16-emulator,$(X16EMU_VERSION))
|
||||||
|
X16EMU_LICENSE = BSD-2-Clause
|
||||||
|
X16EMU_LICENSE_FILES = LICENSE
|
||||||
|
|
||||||
|
X16EMU_DEPENDENCIES = sdl2
|
||||||
|
|
||||||
|
X16EMU_CFLAGS = -std=c99 -O3 -g0
|
||||||
|
X16EMU_CFLAGS += -I$(@D)/src/extern/include -I$(@D)/src/extern/src
|
||||||
|
X16EMU_CFLAGS += `$(STAGING_DIR)/usr/bin/sdl2-config --cflags`
|
||||||
|
|
||||||
|
define X16EMU_BUILD_CMDS
|
||||||
|
$(TARGET_MAKE_ENV) $(MAKE) \
|
||||||
|
CC="$(TARGET_CC)" \
|
||||||
|
CFLAGS="$(TARGET_CFLAGS) $(X16EMU_CFLAGS)" -C $(@D)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define X16EMU_INSTALL_TARGET_CMDS
|
||||||
|
$(TARGET_MAKE_ENV) cp "$(@D)/x16emu" "$(TARGET_DIR)/bin/"
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(generic-package))
|
Loading…
Reference in New Issue