Merge pull request #12 from networkfusion/buildsystem

Buildsystem
This commit is contained in:
networkfusion 2016-12-13 20:45:17 +00:00 committed by GitHub
commit bf57d64b53
8 changed files with 383 additions and 114 deletions

2
.gitignore vendored
View File

@ -15,3 +15,5 @@
*~
*.VC.db*
*properties.json
/.vs
/.vscode

163
README.md
View File

@ -1,36 +1,19 @@
# alt64
# Altra64
Alternative Everdrive64 menu
Kuroneko!
:\ /; _
; \___/ ; ; ;
,:-"' `"-:. / ;
_ /,---. ,---.\ _ _; /
_:>(( | ) ( | ))<:_ ,-""_,"
\````` `````/""""",-""
'-.._ v _..-' )
/ ___ ____,.. \
/ / | | | ( \. \
ctr / / | | | | \ \
`" `" `" `"
nyannyannyannyannyannyannyannyannyannyannyannyannyannyannyannyannyan
`alt64` is an open source menu for [Everdrive64](http://krikzz.com/). It was
`Altra64` is an open source menu for [Everdrive64](http://krikzz.com/) and is based on a fork of alt64 which was
originally written by saturnu, and released on the
[Everdrive64 forum](http://krikzz.com/forum/index.php?topic=816.0).
## Building
If you want to build the menu, you need an n64 toolchain. We'll use the
toolchain recommended by libdragon, with some updated versions.
If you want to build the menu, you need an n64 toolchain. When using windows 10 or Ubuntu, installation is totally automated through a script.
### Dependencies
* [libdragon](https://github.com/parasyte/libdragon)
### Dependencies (installed automatically)
* Windows 10 (Aniversary Update or above) / Ubuntu 16.04 (or above)
* [libdragon](https://github.com/DragonMinded/libdragon)
* [libmikmod-n64](https://github.com/parasyte/libmikmod-n64)
* [libmad-n64](https://github.com/parasyte/libmad-n64)
* [libyaml](http://pyyaml.org/wiki/LibYAML)
@ -39,101 +22,53 @@ toolchain recommended by libdragon, with some updated versions.
*You may skip this step if it's already installed.*
Clone the `libdragon` repo and create a directory for the build.
Clone this `Altra64` repo to a directory of your choice.
```bash
$ git clone https://github.com/parasyte/libdragon.git
$ mkdir libdragon/build_gcc
$ cp libdragon/tools/build libdragon/build_gcc
$ cd libdragon/build_gcc
On Windows 10, browse to the tools directory and double click on ```setup-wsfl.cmd```.
On Ubuntu, browse to the tools directory and run the command ```$ chmod +x ./setup-linux.sh;source ./setup-linux.sh```
### Build `Altra64`
To build the Rom
from the projects root directory,
On Windows 10 run
```
Modify the `build` script to set your installation path. Here is the default:
```bash
# EDIT THIS LINE TO CHANGE YOUR INSTALL PATH!
export INSTALL_PATH=/usr/local/mips64-elf
> build
```
Build it! This can take an hour or more.
```bash
$ ./build
on linux
```
### Configure your Environment
Add the following environment variable to your `~/.bash_profile` or `~/.bashrc`
Be sure to use the same path that you configured in the build script!
```bash
export N64_INST=/usr/local/mips64-elf
```
### Build `libdragon`
Make sure you are in the `libdragon` top-level directory, and make sure `libpng`
is installed:
```bash
$ make && make install
$ make tools && make tools-install
```
### Build `libmikmod`
Clone `libmikmod-n64` and build:
```bash
$ git clone https://github.com/parasyte/libmikmod-n64.git
$ cd libmikmod-n64
$ make
$ make install
```
### Build `libmad-n64`
Clone `libmad-n64` and build, be sure to set the path according to your
toolchain installation path:
```bash
$ git clone https://github.com/parasyte/libmad-n64.git
$ cd libmad-n64
$ export PATH=$PATH:$(N64_INST)/bin
$ CFLAGS="-march=vr4300 -mtune=vr4300 -mno-extern-sdata" \
LDFLAGS="-L$(N64_INST)/lib" LIBS="-lc -lnosys" \
./configure --host=mips64-elf --disable-shared \
--prefix=$(N64_INST) --enable-speed --enable-fpm=mips
$ make
$ make install
```
### Build `libyaml`
Download libyaml 0.1.6 and build, be sure to set the path according to your
toolchain installation path:
```bash
$ hg clone https://bitbucket.org/xi/libyaml
$ cd libyaml
$ hg update 0.1.6
$ ./bootstrap
$ export PATH=$PATH:$(N64_INST)/bin
$ CFLAGS="-std=gnu99 -march=vr4300 -mtune=vr4300" \
LDFLAGS="-L$(N64_INST)/lib -Tn64ld.x" \
LIBS="-ldragon -lc -ldragonsys -lnosys" \
./configure --host=mips64-elf --prefix=$(N64_INST)
$ make
$ make install
```
### Build `alt64`
Finally, we can clone `alt64` and build it!
```bash
$ git clone https://github.com/parasyte/alt64.git
$ make
```
If it all worked, you will find `OS64.v64` in the `Altra64` bin directory.
If it all worked, you will find `OS64.v64` in the `alt64` top-level directory.
### Debug Build `Altra64`
To build the debug version of the Rom
from the projects root directory,
On Windows 10 run
```
> build debug
```
on linux
```
$ make debug
```
If it all worked, you will find `OS64.v64` in the `Altra64` bin directory.
### Clean `Altra64`
Finally, we can clean the build objects from the project
from the projects root directory,
On Windows 10 run
```
> build clean
```
on linux
```
$ make clean
```
Enjoy!

18
build.cmd Normal file
View File

@ -0,0 +1,18 @@
@echo off
set "SystemPath=%SystemRoot%\\System32"
IF EXIST %WINDIR%\\sysnative\\reg.exe (
set "SystemPath=%SystemRoot%\Sysnative"
echo. "32-bit process..."
)
set env="/usr/local/libdragon"
IF %1.==. (
echo. "no parameter"
%SystemPath%\\bash --verbose -c "export N64_INST=%env%; make"
) ELSE (
echo. "parameter: %1"
%SystemPath%\\bash --verbose -c "export N64_INST=%env%; make %1"
)
:pause

0
tools/upload.sh → tools/deploy-sd.sh Executable file → Normal file
View File

120
tools/extract-firmware.cmd Normal file
View File

@ -0,0 +1,120 @@
@echo off
cd ..
set "fs=%cd%\res\filesystem\firmware"
set "lfs=%fs%"
set "drive=%lfs:~0,1%"
set lfs=%lfs:~2%
set "lfs=%lfs:\=/%"
if %drive%==A set "drive=a"
if %drive%==B set "drive=b"
if %drive%==C set "drive=c"
if %drive%==D set "drive=d"
if %drive%==E set "drive=e"
if %drive%==F set "drive=f"
if %drive%==G set "drive=g"
if %drive%==H set "drive=h"
if %drive%==I set "drive=i"
if %drive%==J set "drive=j"
if %drive%==K set "drive=k"
if %drive%==L set "drive=l"
if %drive%==M set "drive=m"
if %drive%==N set "drive=n"
if %drive%==O set "drive=o"
if %drive%==P set "drive=p"
if %drive%==Q set "drive=q"
if %drive%==R set "drive=r"
if %drive%==S set "drive=s"
if %drive%==T set "drive=t"
if %drive%==U set "drive=u"
if %drive%==V set "drive=v"
if %drive%==W set "drive=w"
if %drive%==X set "drive=x"
if %drive%==Y set "drive=y"
if %drive%==Z set "drive=z"
set "lfs=/mnt/%drive%%lfs%"
echo "Windows dir is %fs%"
echo "Linux dir is %lfs%"
:: del old firmware dir in ../res/filesystem
RD /S /Q "%fs%"
:: mk firmware dir in ../res/filesystem
MKDIR "%fs%"
SET "rom=%1"
IF %1.==. (
SET /P rom="Please enter full path to OS64.v64 V2.12:"
)
set "drive=%rom:~0,1%"
set rom=%rom:~2%
set "rom=%rom:\=/%"
if %drive%==A set "drive=a"
if %drive%==B set "drive=b"
if %drive%==C set "drive=c"
if %drive%==D set "drive=d"
if %drive%==E set "drive=e"
if %drive%==F set "drive=f"
if %drive%==G set "drive=g"
if %drive%==H set "drive=h"
if %drive%==I set "drive=i"
if %drive%==J set "drive=j"
if %drive%==K set "drive=k"
if %drive%==L set "drive=l"
if %drive%==M set "drive=m"
if %drive%==N set "drive=n"
if %drive%==O set "drive=o"
if %drive%==P set "drive=p"
if %drive%==Q set "drive=q"
if %drive%==R set "drive=r"
if %drive%==S set "drive=s"
if %drive%==T set "drive=t"
if %drive%==U set "drive=u"
if %drive%==V set "drive=v"
if %drive%==W set "drive=w"
if %drive%==X set "drive=x"
if %drive%==Y set "drive=y"
if %drive%==Z set "drive=z"
set "rom=/mnt/%drive%%rom%"
echo "Linux rom dir is %rom%"
::echo. "This script is not yet ready and will now exit."
::GOTO exit
@echo ON
:: OS64.V64 - Version 2.12 firmware offsets:
:: cart offset (hex) offset (dec) length
:: v2_old 0x25070 151664 61552
:: v2 0x15930 88368 63276
:: v2.5 0x340F0 213232 69911
:: v3 0x45210 283152 71187
:: Count = lengh / blocksize
:: Seek = offset converted to decimal / blocksize
:: ED rev 2_old
bash --verbose -c "dd skip=9479 count=3847 if=%rom% of=%lfs%/firmware_v2_old.bin bs=16"
:: ED rev 2.0 (default should return 0x214)
bash --verbose -c "dd skip=5523 count=3954 if=%rom% of=%lfs%/firmware_v2.bin bs=16"
:: ED rev 2.5 (default should return 0x250)
bash --verbose -c "dd skip=13327 count=4369 if=%rom% of=%lfs%/firmware_v2_5.bin bs=16"
:: ED rev 3 (default should return 0x300)
bash --verbose -c "dd skip=17697 count=4449 if=%rom% of=%lfs%/firmware_v3.bin bs=16"
pause
:exit

51
tools/reset-wsfl.cmd Normal file
View File

@ -0,0 +1,51 @@
::::::::::::::::::::::::::::::::::::::::::::
:: Elevate.cmd - Version 2
:: Automatically check & get admin rights
::::::::::::::::::::::::::::::::::::::::::::
@echo off
CLS
ECHO.
ECHO =============================
ECHO Running Admin shell
ECHO =============================
:init
setlocal DisableDelayedExpansion
set "batchPath=%~0"
for %%k in (%0) do set batchName=%%~nk
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
setlocal EnableDelayedExpansion
:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
:getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
ECHO.
ECHO **************************************
ECHO Invoking UAC for Privilege Escalation
ECHO **************************************
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
ECHO args = "ELEV " >> "%vbsGetPrivileges%"
ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
ECHO Next >> "%vbsGetPrivileges%"
ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
"%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
exit /B
:gotPrivileges
setlocal & pushd .
cd /d %~dp0
if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
::::::::::::::::::::::::::::
::START
::::::::::::::::::::::::::::
@echo on
lxrun /uninstall /full
pause

87
tools/setup-linux.sh Normal file
View File

@ -0,0 +1,87 @@
#!/bin/bash
# Download and install latest updates for the system [sudo req.]
apt-get update
apt-get -y upgrade
# Install essential packages [sudo req.]
apt-get -y install build-essential git texinfo libc6 libgmp-dev libmpfr-dev libmpc-dev libpng-dev zlib1g-dev libtool autoconf
# change to the users root directory
cd ~/
# add a system variable and make it perminent
# echo 'N64_INST=/usr/local/libdragon' >> /etc/environment
# echo 'export N64_INST=/usr/local/libdragon' >> ~/.bashrc
export N64_INST=/usr/local/libdragon
# source ~/.bashrc
# Pull the latest libdragon source code and make a build directory
git clone https://github.com/dragonminded/libdragon.git
# fix issues with the build scripts
sed -i -- 's|${N64_INST:-/usr/local}|/usr/local/libdragon|g' libdragon/tools/build
sed -i -- 's|--with-newlib|--with-newlib --with-system-zlib|g' libdragon/tools/build
sed -i -- 's| -lpng|\nLDLIBS = -lpng|g' libdragon/tools/mksprite/Makefile
sed -i -- 's| -Werror| -w|g' libdragon/tools/mksprite/Makefile
# make a build folder for libdragon
mkdir libdragon/build_gcc
cp libdragon/tools/build libdragon/build_gcc
# run the build script (this will take a while! and if not sudo, will ask for password mid flow!)
cd libdragon/build_gcc
./build
cd ..
# run the install script [sudo req]
make
make install
make tools
make tools-install
cd ..
# install libmikmod
git clone https://github.com/parasyte/libmikmod-n64.git
cd libmikmod-n64
mkdir build
make
make install
cd ..
# install libmad-64
git clone https://github.com/parasyte/libmad-n64.git
cd libmad-n64
#$(N64_INST) converterd to $N64_INST below otherwise it will not run on WSFL
export PATH=$PATH:$N64_INST/bin
CFLAGS="-march=vr4300 -mtune=vr4300 -mno-extern-sdata" \
LDFLAGS="-L$N64_INST/lib" LIBS="-lc -lnosys" \
./configure --host=mips64-elf --disable-shared \
--prefix=$N64_INST --enable-speed --enable-fpm=mips
make
make install
cd ..
# install libyaml
git clone https://github.com/yaml/libyaml
cd libyaml
./bootstrap
#$(N64_INST) converterd to $N64_INST below otherwise it will not run on WSFL
export PATH=$PATH:$N64_INST/bin
CFLAGS="-std=gnu99 -march=vr4300 -mtune=vr4300" \
LDFLAGS="-L$N64_INST/lib -Tn64ld.x" \
LIBS="-ldragon -lc -ldragonsys -lnosys" \
./configure --host=mips64-elf --prefix=$N64_INST
make
make install
cd ..
# Install menu code (perhaps this script should be called from it instead?
# git clone https://github.com/networkfusion/alt64.git
# cd alt64
# make
# Perform cleanup
apt-get -y autoremove
apt-get autoclean

56
tools/setup-wsfl.cmd Normal file
View File

@ -0,0 +1,56 @@
::::::::::::::::::::::::::::::::::::::::::::
:: Elevate.cmd - Version 2
:: Automatically check & get admin rights
::::::::::::::::::::::::::::::::::::::::::::
@echo off
CLS
ECHO.
ECHO =============================
ECHO Running Admin shell
ECHO =============================
:init
setlocal DisableDelayedExpansion
set "batchPath=%~0"
for %%k in (%0) do set batchName=%%~nk
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
setlocal EnableDelayedExpansion
:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
:getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
ECHO.
ECHO **************************************
ECHO Invoking UAC for Privilege Escalation
ECHO **************************************
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
ECHO args = "ELEV " >> "%vbsGetPrivileges%"
ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
ECHO Next >> "%vbsGetPrivileges%"
ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
"%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
exit /B
:gotPrivileges
setlocal & pushd .
cd /d %~dp0
if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
::::::::::::::::::::::::::::
::START
::::::::::::::::::::::::::::
@echo on
lxrun /install /y
bash -c "echo 'export N64_INST=/usr/local/libdragon' >> ~/.bashrc; source ~/.bashrc"
bash -c "chmod +x ./setup-linux.sh"
bash --verbose -c "source ./setup-linux.sh"
::bash
pause