Add doltool and script to convert linux kernel to .dol executable
This commit is contained in:
parent
9e6b9c8726
commit
46a1ed07f6
2 changed files with 40 additions and 2 deletions
28
makedol.sh
Executable file
28
makedol.sh
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
# copied from https://themkat.net/2022/12/19/gamecube_linux_sd_boot.html, which itself copied it from the now offline gc-linux wiki
|
||||
# edited slightly to make it more readable and convenient to use
|
||||
|
||||
KSRC=${KSRC:-.}
|
||||
target=${1:-zImage}
|
||||
ofile=zImage
|
||||
|
||||
[ -r ${KSRC}/arch/powerpc/boot/${target} ] || {
|
||||
echo "Can't find target image ${KSRC}/arch/powerpc/boot/${target}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
cp ${KSRC}/arch/powerpc/boot/${target} ${ofile}
|
||||
|
||||
CROSS=powerpc-linux-gnu-
|
||||
|
||||
echo "+ building DOL"
|
||||
load=$(${CROSS}readelf -l "$ofile" | perl -lane'printf"%08x\n",hex($F[3])+0x80000000 if /LOAD/;')
|
||||
echo " LOAD: $load"
|
||||
entry=$(${CROSS}readelf -l "$ofile" | perl -lane'printf"%08x\n",hex($F[2])+0x80000000 if /Entry point/;')
|
||||
echo " EP : $entry"
|
||||
|
||||
${CROSS}objcopy -O binary -R .comment -R .shstrtab -R .symtab -R .strtab -R .gnu.attributes ${ofile} ${ofile}.bin
|
||||
doltool -c ${ofile}.bin $load $entry
|
||||
doltool -i ${ofile}.dol
|
||||
echo ""
|
Loading…
Add table
Add a link
Reference in a new issue