Skip to content

Commit

Permalink
A script to build a gcw0 sdcard image
Browse files Browse the repository at this point in the history
* od_gcw0_defconfig adjusted to build the linux kernel.
* Kernel modules squashfs built as a post-image step.
* Adds od-imager host package.

Signed-off-by: Gleb Mazovetskiy <[email protected]>
  • Loading branch information
glebm committed Apr 5, 2020
1 parent 4b37c62 commit 1d0797f
Show file tree
Hide file tree
Showing 6 changed files with 258 additions and 0 deletions.
12 changes: 12 additions & 0 deletions board/opendingux/gcw0/build-linux-modules-squashfs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

set -e

# Build modules.squashfs
eval $(make -s printvars VARS=LINUX_DIR QUOTED_VARS=YES)
if [ -f "${LINUX_DIR}/create_modules_fs.sh" ]; then
"${LINUX_DIR}/create_modules_fs.sh"
cp "${LINUX_DIR}/modules.squashfs" "$1"
else
echo "modules.squashfs not built because ${LINUX_DIR}/create_modules_fs.sh is missing"
fi
172 changes: 172 additions & 0 deletions board/opendingux/gcw0/download_local_pack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
#!/usr/bin/env bash

set -euo pipefail

decode_uri_filename() {
while read; do
echo -e "${REPLY//%/\\x}"
done
}

dl() {
local -r url="$1"
local filename
if [[ $# -eq 2 ]]; then
filename="$2"
else
filename="$(basename "$url" | decode_uri_filename)"
fi

local -a curl_args=(-L --fail --remote-time -o "$filename" -#)
if [[ -f "$filename" ]]; then
# Only re-download if the remote file is newer than the local one
curl_args+=(-z "$filename")
fi
set -x
curl "${curl_args[@]}" "$url"
{ set +x; } 2>/dev/null
}

declare -r RGH_OD_REPO="https://raw.githubusercontent.com/retrogamehandheld/OpenDingux/master"
declare -r SEONG_RG350_REPO="https://raw.githubusercontent.com/SeongGino/RetroGame350-AppRepo/master"

mkdir -p dl/od_local_pack/
cd dl/od_local_pack/

# Most sources come from a list maintained here:
# https://github.com/SeongGino/RetroGame350-AppRepo

## Applications

# ODcalc | Calculator
dl https://github.com/Jakz/open-dingux-calculator/releases/latest/download/odcalc.opk

# FFPlay | Video player
dl "${RGH_OD_REPO}/Applications/FFPlay.opk"

# Oldplay | Music player
dl "${RGH_OD_REPO}/Applications/Oldplay.opk"

# Bard | E-book reader
dl "${RGH_OD_REPO}/Applications/Bard.opk"

# Glutexto | Text editor
dl "${RGH_OD_REPO}/Applications/Glutexto.opk"

# GMU
dl "${SEONG_RG350_REPO}/Applications/gmu-0.10.1-gcw0.opk"

# ST-SDL | Terminal
dl https://github.com/glebm/rs97_st-sdl/releases/latest/download/st-rg350.opk

# HWTest | Input tester
dl "${RGH_OD_REPO}/Applications/HWTest.opk"

# Built as part of the buildroot:
# * DinguxCommander

## Emulators
# Some renamed after download to default names used by SimpleMenu:
# https://github.com/fgl82/simplemenu/blob/8102ffd50615837837f0a5f97d7fc32758689e01/simplemenu/configs/RG-350/config/sections.cfg

# gambatte
dl https://github.com/bardeci/dot-matrix-simulator/releases/download/20200127/gambatte-multi-r572u4-20200127.opk \
gambatte-gcw0-r572u3-20190718-004431.opk

# fceux
dl "${SEONG_RG350_REPO}/Emulators/FCEUX_2019-11-15.opk" \
fceux.opk

# nestopia
dl https://rs97.bitgala.xyz/RG-350/localpack/extra_apps/nestopia-28b16e5.opk

# PocketSNES
dl "${SEONG_RG350_REPO}/Emulators/PocketSNES_2019-12-12.opk" \
PocketSNES.opk

# SMS Plus GX
dl https://gameblabla.nl/files/ipk/gcw0/smsplus_gcw0.opk

# Picodrive
rm -f picodrive.opk
dl https://gameblabla.nl/files/ipk/gcw0/picodrive_gcw0.opk \
picodrive.opk

# Genesis Plus GX
dl "${SEONG_RG350_REPO}/Emulators/GenesisPlusGX_2019-12-23.opk" \
GenplusGX.opk

# ReGBA
dl "${SEONG_RG350_REPO}/Emulators/ReGBA_2019-12-26.opk" \
Regba.opk

# Temper | NEC PC-Engine/TurboGrafx-16, CD System
dl https://gameblabla.nl/files/ipk/gcw0/temper_rs97_gcw0.opk \
temper1.24.opk

# SmallPCFX | NEC PC-FX
# TODO: https://github.com/gameblabla/pcfx-mednafen/

# Snes9x
rm -f Snes9x_*.opk
dl "${SEONG_RG350_REPO}/Emulators/Snes9x_2019-11-11.opk"

# SwanEmu | Bandai Wonderswan (B/W, Color)
dl https://gameblabla.nl/files/ipk/gcw0/swanemu_gcw0.opk

# NEO4All | SNK Neo-Geo CD
rm -f NEO4All*.opk
dl "${SEONG_RG350_REPO}/Emulators/NEO4All_2019-12-16.opk"

# NGPCEmu | SNK Neo-Geo Pocket (B/W, Color)
dl https://gameblabla.nl/files/ipk/gcw0/ngpcemu_gcw0.opk

# Retro8
dl https://github.com/Jakz/retro8/releases/download/0.1b/retro8_v1b_20200108.opk

# ScummVM
dl https://github.com/craigsc/scummvm-rg350/releases/download/v0.2/scummvm-rg350-01132020.opk

# DOSBox
dl "${SEONG_RG350_REPO}/Emulators/DOSBox_2019-11-11-launcher.opk"

# midpath | J2ME emulator
dl https://rs97.bitgala.xyz/RG-350/localpack/extra_apps/midpath_20170502_GCW0.opk

# Built as part of the buildroot:
# * pcsx4all

## Ports (require additional data)

# PRBoom+ | Doom
dl 'https://github.com/Ninoh-FOX/PrBoom-plus-for-RG350/releases/latest/download/prboom+.opk'

# EDuke32 | Duke Nukem 3D
dl "${RGH_OD_REPO}/Games%20%26%20Ports/EDuke32.opk"

# DevilutionX | Diablo
dl https://github.com/diasurgical/devilutionX/releases/latest/download/devilutionx-rg350.opk

## Games

# Arkanoid
dl "${RGH_OD_REPO}/Games%20%26%20Ports/Arkanoid.opk"

# Blockrage
dl "${RGH_OD_REPO}/Games%20%26%20Ports/Blockrage.opk"

# Mr. Drillux
dl https://github.com/jbanes/rs97-mrdrillux/releases/latest/download/mrdrillux.opk

# Cave Story
dl "${RGH_OD_REPO}/Games%20%26%20Ports/NXEngine.opk"

# Slitherlink
dl https://github.com/glebm/od-slitherlink/releases/latest/download/slitherlink-rg350.opk

# Built as part of the buildroot
# * BlockAttack
# * Hocoslamfly
# * Ghouls'n Ghosts Remix

cd -
48 changes: 48 additions & 0 deletions board/opendingux/gcw0/make_initial_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/sh

# Builds a full SD card image
#
# If you want the localpack apps included in the image, run this first:
# board/opendingux/gcw0/download_local_pack.sh

set -e

make world mininit ubiboot host-od-imager

# Data image (OPKs):
cd output/images
mkdir -p od-imager/apps/
rm -f od-imager/apps/*
if [ -d ../../dl/od_local_pack_gcw0/ ]; then
cp ../../dl/od_local_pack_gcw0/*.opk od-imager/apps/
fi
if [ -d opks ]; then
cp opks/*.opk od-imager/apps/
fi

# System image
cp mininit-syspart od-imager/
cat vmlinuz.bin gcw0.dtb > od-imager/vmlinuz.bin
cp modules.squashfs od-imager/
cp rootfs.squashfs od-imager/
# Fallbacks are empty as this is the initial image.
echo -n > od-imager/vmlinuz.bak
echo -n > od-imager/modules.squashfs.bak

# Bootloader
cp ubiboot/ubiboot-v20_mddr_512mb.bin od-imager/ubiboot.bin
cd -

# Assemble partitions and the final image
cd output/images/od-imager/
./create_mbr.sh
./create_system_image.sh
./create_data_image.sh
./assemble_images.sh
cd -

echo
echo 'SD card image created in:'
echo output/images/od-imager/images/sd_image.bin
echo Size:
du -sh output/images/od-imager/images/sd_image.bin
1 change: 1 addition & 0 deletions board/opendingux/package/od-imager/od-imager.hash
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sha256 9e2022812c2faf13d9cc71ea517af393ae8539770957e0de3921c50ebef880ef od-imager-8d01931.tar.gz
15 changes: 15 additions & 0 deletions board/opendingux/package/od-imager/od-imager.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#############################################################
#
# od-imager
#
#############################################################

OD_IMAGER_VERSION = 8d01931
OD_IMAGER_SITE = $(call github,glebm,imager,$(OD_IMAGER_VERSION))

define HOST_OD_IMAGER_INSTALL_CMDS
mkdir -p $(BINARIES_DIR)/od-imager
cp $(@D)/*.* $(BINARIES_DIR)/od-imager
endef

$(eval $(host-generic-package))
10 changes: 10 additions & 0 deletions configs/od_gcw0_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,19 @@ BR2_ROOTFS_DEVICE_TABLE="board/opendingux/device_table.txt"
BR2_ROOTFS_MERGED_USR=y
BR2_SYSTEM_ENABLE_NLS=y
BR2_TARGET_TZ_INFO=y
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/OpenDingux/linux/archive/jz-5.3-gcw0.tar.gz"
BR2_LINUX_KERNEL_DEFCONFIG="gcw0"
BR2_LINUX_KERNEL_VMLINUZ_BIN=y
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="ingenic/gcw0"
BR2_TARGET_UBIBOOT=y
BR2_TARGET_UBIBOOT_BOARDNAME="gcw0"
BR2_ROOTFS_USERS_TABLES="board/opendingux/users.txt"
BR2_ROOTFS_OVERLAY="board/opendingux/gcw0/overlay"
BR2_ROOTFS_POST_BUILD_SCRIPT="board/opendingux/gcw0/cleanup-rootfs.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/opendingux/gcw0/build-linux-modules-squashfs.sh"
BR2_PACKAGE_BUSYBOX_CONFIG="board/opendingux/busybox.config"
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
BR2_PACKAGE_ALSA_UTILS=y
Expand Down

0 comments on commit 1d0797f

Please sign in to comment.