Михаил Капелько 9 months ago
parent
commit
29e6796ef1
2 changed files with 70 additions and 2 deletions
  1. +33
    -2
      platform-OpenWrt/README.md
  2. +37
    -0
      platform-OpenWrt/ogspkg/games/ogs-memory/Makefile

+ 33
- 2
platform-OpenWrt/README.md View File

@@ -2,11 +2,42 @@ Instructions for [TP-Link TL-MR3020 v1](https://openwrt.org/toh/tp-link/tl-mr302

Based on [OpenWrt Hello World guide](https://openwrt.org/docs/guide-developer/helloworld/start)

1. Use Linux host
You are supposed to be running **Ubuntu 22.04 LTS** with a home directory at `/home/vboxuser` (Update paths in the commands below and `ogspkg/games/memory/Makefile` if your home directory is different)

1. Install necessary dependencies:
```
apt install libtinfo5 gawk
```
1. Place this Memory game repository clone to `~/research-portable-memory`
1. Download the last supported [SDK 17.01.7](https://downloads.openwrt.org/releases/17.01.7/targets/ar71xx/generic/lede-sdk-17.01.7-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64.tar.xz)
1. Unpack it to `~/openwrt-sdk`:
```
tar -xf lede-sdk-17.01.7-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64.tar.xz
mv lede-sdk-17.01.7-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64 ~/openwrt-sdk
```
1.
1. ?? Set PATH https://openwrt.org/docs/guide-developer/helloworld/chapter1#adjusting_the_path_variable
1. Create `feeds.conf` pointing to `ogspkg`:
```
echo 'src-link ogspkg /home/vboxuser/research-portable-memory/platform-OpenWrt/ogspkg' > ~/openwrt-sdk/feeds.conf
```
1. Update feeds:
```
~/openwrt-sdk/scripts/feeds update ogspkg
~/openwrt-sdk/scripts/feeds install -a -p ogspkg
```
1. Run `make menuconfig` from `openwrt-sdk`
1. Make sure `Games -> ogs-memory` is selected as Module <M>, `Save` if necessary
1. Build the package:
```
cd ~/openwrt-sdk
make package/ogs-memory/compile
```
1. Transfer built `~/openwrt-sdk/bin/packages/ogspkg/ogs-memory*ipk` to `/tmp` on the device with OpenWrt
1. Install package to device's RAM:
```
opkg install /tmp/ogs-memory*ipk -d ram
```
1. Run `ogs-memory`:
```
LD_LIBRARY_PATH=/tmp/usr/lib /tmp/usr/bin/ogs-memory
```

+ 37
- 0
platform-OpenWrt/ogspkg/games/ogs-memory/Makefile View File

@@ -0,0 +1,37 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=ogs-memory
PKG_VERSION:=1.0
PKG_RELEASE:=1
SOURCE_DIR:=/home/vboxuser/research-portable-memory/language-C++

include $(INCLUDE_DIR)/package.mk

define Package/ogs-memory
SECTION:=games
CATEGORY:=Games
TITLE:=Memory
DEPENDS:=+libstdcpp
endef

define Package/ogs-memory/description
A simple "Memory" game in C++
endef

define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
cp -r $(SOURCE_DIR)/* $(PKG_BUILD_DIR)
$(Build/Patch)
endef

define Build/Compile
$(TARGET_CXX) $(TARGET_CXXFLAGS) -o $(PKG_BUILD_DIR)/test.o -c $(PKG_BUILD_DIR)/src/test.cpp
$(TARGET_CXX) $(TARGET_LDFLAGS) -o $(PKG_BUILD_DIR)/$1 $(PKG_BUILD_DIR)/test.o
endef

define Package/ogs-memory/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ogs-memory $(1)/usr/bin
endef

$(eval $(call BuildPackage,ogs-memory))

Loading…
Cancel
Save