Skip to content

Commit 1d0797f

Browse files
committed
A script to build a gcw0 sdcard image
* 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 <glex.spb@gmail.com>
1 parent 4b37c62 commit 1d0797f

File tree

6 files changed

+258
-0
lines changed

6 files changed

+258
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
# Build modules.squashfs
6+
eval $(make -s printvars VARS=LINUX_DIR QUOTED_VARS=YES)
7+
if [ -f "${LINUX_DIR}/create_modules_fs.sh" ]; then
8+
"${LINUX_DIR}/create_modules_fs.sh"
9+
cp "${LINUX_DIR}/modules.squashfs" "$1"
10+
else
11+
echo "modules.squashfs not built because ${LINUX_DIR}/create_modules_fs.sh is missing"
12+
fi
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
decode_uri_filename() {
6+
while read; do
7+
echo -e "${REPLY//%/\\x}"
8+
done
9+
}
10+
11+
dl() {
12+
local -r url="$1"
13+
local filename
14+
if [[ $# -eq 2 ]]; then
15+
filename="$2"
16+
else
17+
filename="$(basename "$url" | decode_uri_filename)"
18+
fi
19+
20+
local -a curl_args=(-L --fail --remote-time -o "$filename" -#)
21+
if [[ -f "$filename" ]]; then
22+
# Only re-download if the remote file is newer than the local one
23+
curl_args+=(-z "$filename")
24+
fi
25+
set -x
26+
curl "${curl_args[@]}" "$url"
27+
{ set +x; } 2>/dev/null
28+
}
29+
30+
declare -r RGH_OD_REPO="https://raw.githubusercontent.com/retrogamehandheld/OpenDingux/master"
31+
declare -r SEONG_RG350_REPO="https://raw.githubusercontent.com/SeongGino/RetroGame350-AppRepo/master"
32+
33+
mkdir -p dl/od_local_pack/
34+
cd dl/od_local_pack/
35+
36+
# Most sources come from a list maintained here:
37+
# https://github.com/SeongGino/RetroGame350-AppRepo
38+
39+
## Applications
40+
41+
# ODcalc | Calculator
42+
dl https://github.com/Jakz/open-dingux-calculator/releases/latest/download/odcalc.opk
43+
44+
# FFPlay | Video player
45+
dl "${RGH_OD_REPO}/Applications/FFPlay.opk"
46+
47+
# Oldplay | Music player
48+
dl "${RGH_OD_REPO}/Applications/Oldplay.opk"
49+
50+
# Bard | E-book reader
51+
dl "${RGH_OD_REPO}/Applications/Bard.opk"
52+
53+
# Glutexto | Text editor
54+
dl "${RGH_OD_REPO}/Applications/Glutexto.opk"
55+
56+
# GMU
57+
dl "${SEONG_RG350_REPO}/Applications/gmu-0.10.1-gcw0.opk"
58+
59+
# ST-SDL | Terminal
60+
dl https://github.com/glebm/rs97_st-sdl/releases/latest/download/st-rg350.opk
61+
62+
# HWTest | Input tester
63+
dl "${RGH_OD_REPO}/Applications/HWTest.opk"
64+
65+
# Built as part of the buildroot:
66+
# * DinguxCommander
67+
68+
## Emulators
69+
# Some renamed after download to default names used by SimpleMenu:
70+
# https://github.com/fgl82/simplemenu/blob/8102ffd50615837837f0a5f97d7fc32758689e01/simplemenu/configs/RG-350/config/sections.cfg
71+
72+
# gambatte
73+
dl https://github.com/bardeci/dot-matrix-simulator/releases/download/20200127/gambatte-multi-r572u4-20200127.opk \
74+
gambatte-gcw0-r572u3-20190718-004431.opk
75+
76+
# fceux
77+
dl "${SEONG_RG350_REPO}/Emulators/FCEUX_2019-11-15.opk" \
78+
fceux.opk
79+
80+
# nestopia
81+
dl https://rs97.bitgala.xyz/RG-350/localpack/extra_apps/nestopia-28b16e5.opk
82+
83+
# PocketSNES
84+
dl "${SEONG_RG350_REPO}/Emulators/PocketSNES_2019-12-12.opk" \
85+
PocketSNES.opk
86+
87+
# SMS Plus GX
88+
dl https://gameblabla.nl/files/ipk/gcw0/smsplus_gcw0.opk
89+
90+
# Picodrive
91+
rm -f picodrive.opk
92+
dl https://gameblabla.nl/files/ipk/gcw0/picodrive_gcw0.opk \
93+
picodrive.opk
94+
95+
# Genesis Plus GX
96+
dl "${SEONG_RG350_REPO}/Emulators/GenesisPlusGX_2019-12-23.opk" \
97+
GenplusGX.opk
98+
99+
# ReGBA
100+
dl "${SEONG_RG350_REPO}/Emulators/ReGBA_2019-12-26.opk" \
101+
Regba.opk
102+
103+
# Temper | NEC PC-Engine/TurboGrafx-16, CD System
104+
dl https://gameblabla.nl/files/ipk/gcw0/temper_rs97_gcw0.opk \
105+
temper1.24.opk
106+
107+
# SmallPCFX | NEC PC-FX
108+
# TODO: https://github.com/gameblabla/pcfx-mednafen/
109+
110+
# Snes9x
111+
rm -f Snes9x_*.opk
112+
dl "${SEONG_RG350_REPO}/Emulators/Snes9x_2019-11-11.opk"
113+
114+
# SwanEmu | Bandai Wonderswan (B/W, Color)
115+
dl https://gameblabla.nl/files/ipk/gcw0/swanemu_gcw0.opk
116+
117+
# NEO4All | SNK Neo-Geo CD
118+
rm -f NEO4All*.opk
119+
dl "${SEONG_RG350_REPO}/Emulators/NEO4All_2019-12-16.opk"
120+
121+
# NGPCEmu | SNK Neo-Geo Pocket (B/W, Color)
122+
dl https://gameblabla.nl/files/ipk/gcw0/ngpcemu_gcw0.opk
123+
124+
# Retro8
125+
dl https://github.com/Jakz/retro8/releases/download/0.1b/retro8_v1b_20200108.opk
126+
127+
# ScummVM
128+
dl https://github.com/craigsc/scummvm-rg350/releases/download/v0.2/scummvm-rg350-01132020.opk
129+
130+
# DOSBox
131+
dl "${SEONG_RG350_REPO}/Emulators/DOSBox_2019-11-11-launcher.opk"
132+
133+
# midpath | J2ME emulator
134+
dl https://rs97.bitgala.xyz/RG-350/localpack/extra_apps/midpath_20170502_GCW0.opk
135+
136+
# Built as part of the buildroot:
137+
# * pcsx4all
138+
139+
## Ports (require additional data)
140+
141+
# PRBoom+ | Doom
142+
dl 'https://github.com/Ninoh-FOX/PrBoom-plus-for-RG350/releases/latest/download/prboom+.opk'
143+
144+
# EDuke32 | Duke Nukem 3D
145+
dl "${RGH_OD_REPO}/Games%20%26%20Ports/EDuke32.opk"
146+
147+
# DevilutionX | Diablo
148+
dl https://github.com/diasurgical/devilutionX/releases/latest/download/devilutionx-rg350.opk
149+
150+
## Games
151+
152+
# Arkanoid
153+
dl "${RGH_OD_REPO}/Games%20%26%20Ports/Arkanoid.opk"
154+
155+
# Blockrage
156+
dl "${RGH_OD_REPO}/Games%20%26%20Ports/Blockrage.opk"
157+
158+
# Mr. Drillux
159+
dl https://github.com/jbanes/rs97-mrdrillux/releases/latest/download/mrdrillux.opk
160+
161+
# Cave Story
162+
dl "${RGH_OD_REPO}/Games%20%26%20Ports/NXEngine.opk"
163+
164+
# Slitherlink
165+
dl https://github.com/glebm/od-slitherlink/releases/latest/download/slitherlink-rg350.opk
166+
167+
# Built as part of the buildroot
168+
# * BlockAttack
169+
# * Hocoslamfly
170+
# * Ghouls'n Ghosts Remix
171+
172+
cd -
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/sh
2+
3+
# Builds a full SD card image
4+
#
5+
# If you want the localpack apps included in the image, run this first:
6+
# board/opendingux/gcw0/download_local_pack.sh
7+
8+
set -e
9+
10+
make world mininit ubiboot host-od-imager
11+
12+
# Data image (OPKs):
13+
cd output/images
14+
mkdir -p od-imager/apps/
15+
rm -f od-imager/apps/*
16+
if [ -d ../../dl/od_local_pack_gcw0/ ]; then
17+
cp ../../dl/od_local_pack_gcw0/*.opk od-imager/apps/
18+
fi
19+
if [ -d opks ]; then
20+
cp opks/*.opk od-imager/apps/
21+
fi
22+
23+
# System image
24+
cp mininit-syspart od-imager/
25+
cat vmlinuz.bin gcw0.dtb > od-imager/vmlinuz.bin
26+
cp modules.squashfs od-imager/
27+
cp rootfs.squashfs od-imager/
28+
# Fallbacks are empty as this is the initial image.
29+
echo -n > od-imager/vmlinuz.bak
30+
echo -n > od-imager/modules.squashfs.bak
31+
32+
# Bootloader
33+
cp ubiboot/ubiboot-v20_mddr_512mb.bin od-imager/ubiboot.bin
34+
cd -
35+
36+
# Assemble partitions and the final image
37+
cd output/images/od-imager/
38+
./create_mbr.sh
39+
./create_system_image.sh
40+
./create_data_image.sh
41+
./assemble_images.sh
42+
cd -
43+
44+
echo
45+
echo 'SD card image created in:'
46+
echo output/images/od-imager/images/sd_image.bin
47+
echo Size:
48+
du -sh output/images/od-imager/images/sd_image.bin
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sha256 9e2022812c2faf13d9cc71ea517af393ae8539770957e0de3921c50ebef880ef od-imager-8d01931.tar.gz
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#############################################################
2+
#
3+
# od-imager
4+
#
5+
#############################################################
6+
7+
OD_IMAGER_VERSION = 8d01931
8+
OD_IMAGER_SITE = $(call github,glebm,imager,$(OD_IMAGER_VERSION))
9+
10+
define HOST_OD_IMAGER_INSTALL_CMDS
11+
mkdir -p $(BINARIES_DIR)/od-imager
12+
cp $(@D)/*.* $(BINARIES_DIR)/od-imager
13+
endef
14+
15+
$(eval $(host-generic-package))

configs/od_gcw0_defconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,19 @@ BR2_ROOTFS_DEVICE_TABLE="board/opendingux/device_table.txt"
2020
BR2_ROOTFS_MERGED_USR=y
2121
BR2_SYSTEM_ENABLE_NLS=y
2222
BR2_TARGET_TZ_INFO=y
23+
BR2_LINUX_KERNEL=y
24+
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
25+
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/OpenDingux/linux/archive/jz-5.3-gcw0.tar.gz"
26+
BR2_LINUX_KERNEL_DEFCONFIG="gcw0"
27+
BR2_LINUX_KERNEL_VMLINUZ_BIN=y
28+
BR2_LINUX_KERNEL_DTS_SUPPORT=y
29+
BR2_LINUX_KERNEL_INTREE_DTS_NAME="ingenic/gcw0"
30+
BR2_TARGET_UBIBOOT=y
31+
BR2_TARGET_UBIBOOT_BOARDNAME="gcw0"
2332
BR2_ROOTFS_USERS_TABLES="board/opendingux/users.txt"
2433
BR2_ROOTFS_OVERLAY="board/opendingux/gcw0/overlay"
2534
BR2_ROOTFS_POST_BUILD_SCRIPT="board/opendingux/gcw0/cleanup-rootfs.sh"
35+
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/opendingux/gcw0/build-linux-modules-squashfs.sh"
2636
BR2_PACKAGE_BUSYBOX_CONFIG="board/opendingux/busybox.config"
2737
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
2838
BR2_PACKAGE_ALSA_UTILS=y

0 commit comments

Comments
 (0)