Agptek Rocker: Update tools to alter .upt update images

Change all references to official rockbox repository

Change-Id: I22d305bc6c6f89b8737b2bc15378bfd7fe10621e
This commit is contained in:
Marcin Bukat 2018-06-13 13:28:38 +02:00
parent f727b0787a
commit 419219e06d
3 changed files with 48 additions and 30 deletions

View file

@ -32,11 +32,10 @@ RUN apt-get update && \
# Clone rockbox repository
RUN cd /home/rb && \
git clone https://github.com/wodz/rockbox-wodz.git
git clone http://gerrit.rockbox.org/p/rockbox
# Build cross toolchain (It takes quite long)
RUN cd /home/rb/rockbox-wodz && \
git checkout agptek-rocker && \
RUN cd /home/rb/rockbox && \
./tools/rockboxdev.sh --target=y
# Install tools for unpacking ubifs
@ -46,5 +45,5 @@ RUN cd /home/rb && \
python setup.py install
# Copy build script
RUN cp /home/rb/rockbox-wodz/tools/agptek_rocker/bootloader_install.sh /usr/local/bin && \
RUN cp /home/rb/rockbox/tools/agptek_rocker/bootloader_install.sh /usr/local/bin && \
chmod 755 /usr/local/bin/bootloader_install.sh

View file

@ -1,6 +1,21 @@
Update file with .upt extension is actually ISO9660 image. Inside
there are:
1) uboot.bin - uBoot image
2) uimage.bin - linux kernel image packed in legacy uboot format
3) system.ubi - UBIFS rootfs image
4) update.txt - text file describing update image content
5) version.txt - text file describing version of update image
Steps needed to patch update.upt with rockbox bootloader are explained in
bootloader_install.sh shell script. Process is quite involved and some
custom tools are needed.
below. Process is quite involved and some custom tools are needed.
bootloader_install.sh scipt is design to automate the process.
1) First content of ISO9660 .upt file needs to be unpacked
2) system.ubi UBIFS image needs to be unpacked
3) Rockbox bootloader is copied to unpacked rootfs
4) Recreate UBIFS with altered content
5) Update update.txt file with correct CRC of altered system.ubi
6) Recreate ISO9660 .upt file
For convenience Dockerfile is provided which prepares custom image based
@ -9,7 +24,7 @@ images.
Basically image extends standard debian image by:
1) Installing developer packages from stock debian
2) Cloning https://github.com/wodz/rockbox-wodz.git
2) Cloning rockbox repository http://gerrit.rockbox.org/p/rockbox
3) Building custom cross toolchain
4) Cloning and installing tools to work with UBIFS
@ -31,7 +46,8 @@ docker run -it -v /path/to/dir/with/update.upt:/upt \
Files in this directory:
README - this file
README - this file
bootloader_install.sh - shell script documenting process of patching
agptek rocker update images

View file

@ -1,4 +1,8 @@
#!/bin/sh
ROCKBOX_SRC=$HOME/rockbox
BUILD=$ROCKBOX_SRC/build
ISO=$HOME/iso
ROOTFS=$HOME/rootfs
[ -z "$UPT_DIR" ] && UPT_DIR=`pwd`
cd $HOME
@ -9,9 +13,9 @@ echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!!! STEP 0: Get sources !!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo
[ -d "$HOME/rockbox-wodz" ] || git clone https://github.com/wodz/rockbox-wodz.git
[ -d "$ROCKBOX_SRC" ] || git clone ttp://gerrit.rockbox.org/p/rockbox
cd $HOME/rockbox-wodz
cd $ROCKBOX_SRC
# build bootloader
echo
@ -20,10 +24,9 @@ echo "!!! STEP 1: Build bootloader !!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo
[ -d "$HOME/rockbox-wodz/build" ] && rm -rf $HOME/rockbox-wodz/build
git checkout agptek-rocker && \
[ -d "$BUILD" ] && rm -rf $BUILD
git pull && \
mkdir $HOME/rockbox-wodz/build && cd $HOME/rockbox-wodz/build && \
mkdir $BUILD && cd $BUILD && \
../tools/configure --target=240 --type=b && \
make clean && \
make && \
@ -38,9 +41,9 @@ echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!!! STEP 2: Extract upt file !!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo
[ -d "$HOME/iso" ] && rm -rf $HOME/iso
mkdir $HOME/iso && \
xorriso -osirrox on -ecma119_map lowercase -indev $UPT_DIR/update.upt -extract / $HOME/iso
[ -d "$ISO" ] && rm -rf $ISO
mkdir $ISO && \
xorriso -osirrox on -ecma119_map lowercase -indev $UPT_DIR/update.upt -extract / $ISO
# Extract rootfs files. Preserve permissions (although this are wrong!)
echo
@ -48,7 +51,7 @@ echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!!! STEP 3: Extract system.ubi !!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo
ubireader_extract_files -k -o $HOME/rootfs $HOME/iso/system.ubi
ubireader_extract_files -k -o $ROOTFS $ISO/system.ubi
# Copy rockbox bootloader
echo
@ -56,8 +59,8 @@ echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!!! STEP 4: Copy bootloader !!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo
cp $HOME/rockbox-wodz/build/bootloader.elf $HOME/rootfs/usr/bin/rb_bootloader && \
mipsel-rockbox-linux-gnu-strip --strip-unneeded $HOME/rootfs/usr/bin/rb_bootloader
cp $BUILD/bootloader.elf $ROOTFS/usr/bin/rb_bootloader && \
mipsel-rockbox-linux-gnu-strip --strip-unneeded $ROOTFS/usr/bin/rb_bootloader
# Overwrite default player starting script with one running our bootloader
echo
@ -65,8 +68,8 @@ echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!!! STEP 5: Modify startup script !!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo
cp $HOME/rockbox-wodz/tools/agptek_rocker//hiby_player.sh $HOME/rootfs/usr/bin/hiby_player.sh && \
chmod 755 $HOME/rootfs/usr/bin/hiby_player.sh
cp $ROCKBOX_SRC/tools/agptek_rocker//hiby_player.sh $ROOTFS/usr/bin/hiby_player.sh && \
chmod 755 $ROOTFS/usr/bin/hiby_player.sh
# Rebuild ubifs
echo
@ -74,8 +77,8 @@ echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!!! STEP 6: Rebuild system.ubi !!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo
mkfs.ubifs --min-io-size=2048 --leb-size=126976 --max-leb-cnt=1024 -o $HOME/system_rb.ubi -r $HOME/rootfs && \
mv $HOME/system_rb.ubi $HOME/iso/system.ubi
mkfs.ubifs --min-io-size=2048 --leb-size=126976 --max-leb-cnt=1024 -o $HOME/system_rb.ubi -r $ROOTFS && \
mv $HOME/system_rb.ubi $ISO/system.ubi
# Fixup update.txt file with correct md5
echo
@ -83,7 +86,7 @@ echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!!! STEP 7: Fixup update.txt !!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo
python $HOME/rockbox-wodz/tools/agptek_rocker/update_update.py $HOME/iso/update.txt
python $ROCKBOX_SRC/tools/agptek_rocker/update_update.py $ISO/update.txt
# Rebuild .upt file
echo
@ -91,7 +94,7 @@ echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!!! STEP 8: Rebuild upt file !!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo
xorriso -as mkisofs -volid 'CDROM' --norock -output $UPT_DIR/update_rb.upt $HOME/iso
xorriso -as mkisofs -volid 'CDROM' --norock -output $UPT_DIR/update_rb.upt $ISO
# Build rockbox.zip
echo
@ -99,7 +102,7 @@ echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!!! STEP 9: Build rockbox application !!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo
cd $HOME/rockbox-wodz/build && \
cd $BUILD && \
../tools/configure --target=240 --type=n && \
make clean && \
make && \
@ -112,9 +115,9 @@ echo "!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!!! STEP 10: Cleanup !!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!"
echo
rm -rf $HOME/rockbox-wodz/build
rm -rf $HOME/iso
rm -rf $HOME/rootfs
rm -rf $BUILD
rm -rf $ISO
rm -rf $ROOTFS
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "! Building finished !"
@ -126,4 +129,4 @@ echo "1) Unzip rockbox.zip file in the root directory of SD card"
echo "2) Copy update_rb.upt to the root directory of SD card"
echo "3) Rename update_rb.upt to update.upt in SD card"
echo "4) Select update firmware on device"
echo
echo