2018-02-26 12:47:29 +00:00
|
|
|
#!/bin/sh
|
2018-06-13 11:28:38 +00:00
|
|
|
ROCKBOX_SRC=$HOME/rockbox
|
|
|
|
BUILD=$ROCKBOX_SRC/build
|
|
|
|
ISO=$HOME/iso
|
|
|
|
ROOTFS=$HOME/rootfs
|
2018-02-26 12:47:29 +00:00
|
|
|
|
|
|
|
[ -z "$UPT_DIR" ] && UPT_DIR=`pwd`
|
|
|
|
cd $HOME
|
|
|
|
|
|
|
|
# get sources
|
|
|
|
echo
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo "!!! STEP 0: Get sources !!!"
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo
|
2018-06-13 11:28:38 +00:00
|
|
|
[ -d "$ROCKBOX_SRC" ] || git clone ttp://gerrit.rockbox.org/p/rockbox
|
2018-02-26 12:47:29 +00:00
|
|
|
|
2018-06-13 11:28:38 +00:00
|
|
|
cd $ROCKBOX_SRC
|
2018-02-26 12:47:29 +00:00
|
|
|
|
|
|
|
# build bootloader
|
|
|
|
echo
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo "!!! STEP 1: Build bootloader !!!"
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo
|
|
|
|
|
2018-06-13 11:28:38 +00:00
|
|
|
[ -d "$BUILD" ] && rm -rf $BUILD
|
2018-02-26 12:47:29 +00:00
|
|
|
git pull && \
|
2018-06-13 11:28:38 +00:00
|
|
|
mkdir $BUILD && cd $BUILD && \
|
2018-02-26 12:47:29 +00:00
|
|
|
../tools/configure --target=240 --type=b && \
|
|
|
|
make clean && \
|
|
|
|
make && \
|
|
|
|
cd $HOME
|
|
|
|
|
|
|
|
# Extract update file (ISO9660 image) content
|
|
|
|
# NOTE: Update process on device loop mount ISO image. Default behavior of mount
|
|
|
|
# is to map all names to lowercase. Because of this forcing lowercase
|
|
|
|
# mapping is needed when extracting
|
|
|
|
echo
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo "!!! STEP 2: Extract upt file !!!"
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo
|
2018-06-13 11:28:38 +00:00
|
|
|
[ -d "$ISO" ] && rm -rf $ISO
|
|
|
|
mkdir $ISO && \
|
|
|
|
xorriso -osirrox on -ecma119_map lowercase -indev $UPT_DIR/update.upt -extract / $ISO
|
2018-02-26 12:47:29 +00:00
|
|
|
|
|
|
|
# Extract rootfs files. Preserve permissions (although this are wrong!)
|
|
|
|
echo
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo "!!! STEP 3: Extract system.ubi !!!"
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo
|
2018-06-13 11:28:38 +00:00
|
|
|
ubireader_extract_files -k -o $ROOTFS $ISO/system.ubi
|
2018-02-26 12:47:29 +00:00
|
|
|
|
|
|
|
# Copy rockbox bootloader
|
|
|
|
echo
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo "!!! STEP 4: Copy bootloader !!!"
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo
|
2018-06-14 09:02:18 +00:00
|
|
|
cp $BUILD/bootloader.rocker $ROOTFS/usr/bin/rb_bootloader
|
2018-02-26 12:47:29 +00:00
|
|
|
|
|
|
|
# Overwrite default player starting script with one running our bootloader
|
|
|
|
echo
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo "!!! STEP 5: Modify startup script !!!"
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo
|
2018-06-13 11:28:38 +00:00
|
|
|
cp $ROCKBOX_SRC/tools/agptek_rocker//hiby_player.sh $ROOTFS/usr/bin/hiby_player.sh && \
|
|
|
|
chmod 755 $ROOTFS/usr/bin/hiby_player.sh
|
2018-02-26 12:47:29 +00:00
|
|
|
|
|
|
|
# Rebuild ubifs
|
|
|
|
echo
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo "!!! STEP 6: Rebuild system.ubi !!!"
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo
|
2018-06-13 11:28:38 +00:00
|
|
|
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
|
2018-02-26 12:47:29 +00:00
|
|
|
|
|
|
|
# Fixup update.txt file with correct md5
|
|
|
|
echo
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo "!!! STEP 7: Fixup update.txt !!!"
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo
|
2018-06-13 11:28:38 +00:00
|
|
|
python $ROCKBOX_SRC/tools/agptek_rocker/update_update.py $ISO/update.txt
|
2018-02-26 12:47:29 +00:00
|
|
|
|
|
|
|
# Rebuild .upt file
|
|
|
|
echo
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo "!!! STEP 8: Rebuild upt file !!!"
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo
|
2018-06-13 11:28:38 +00:00
|
|
|
xorriso -as mkisofs -volid 'CDROM' --norock -output $UPT_DIR/update_rb.upt $ISO
|
2018-02-26 12:47:29 +00:00
|
|
|
|
|
|
|
# Build rockbox.zip
|
|
|
|
echo
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo "!!! STEP 9: Build rockbox application !!!"
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo
|
2018-06-13 11:28:38 +00:00
|
|
|
cd $BUILD && \
|
2018-02-26 12:47:29 +00:00
|
|
|
../tools/configure --target=240 --type=n && \
|
|
|
|
make clean && \
|
|
|
|
make && \
|
|
|
|
make zip && \
|
|
|
|
cp rockbox.zip $UPT_DIR/
|
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
echo
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo "!!! STEP 10: Cleanup !!!"
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo
|
2018-06-13 11:28:38 +00:00
|
|
|
rm -rf $BUILD
|
|
|
|
rm -rf $ISO
|
|
|
|
rm -rf $ROOTFS
|
2018-02-26 12:47:29 +00:00
|
|
|
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo "! Building finished !"
|
|
|
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
|
|
echo
|
|
|
|
echo "You should find update_rb.upt and rockbox.zip in output directory"
|
|
|
|
echo
|
|
|
|
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"
|
2018-06-13 11:28:38 +00:00
|
|
|
echo
|