From b186dc4c5bd94189af14fd40455df68045a45964 Mon Sep 17 00:00:00 2001 From: Martijn Braam Date: Mon, 22 Jun 2020 21:51:39 +0200 Subject: [PATCH] WIP --- Makefile | 12 ++++++------ initramfs/fbsplash.conf | 8 ++++++++ initramfs/init_functions.sh | 26 ++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 initramfs/fbsplash.conf diff --git a/Makefile b/Makefile index 78c7be8..d5dbd1d 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ all: pine64-pinephone.img.xz pine64-pinetab.img.xz pine64-pinephone.img: fat-pine64-pinephone.img u-boot-sunxi-with-spl.bin rm -f $@ - truncate --size 50M $@ + truncate --size 2048M $@ parted -s $@ mktable msdos parted -s $@ mkpart primary fat32 2048s 100% parted -s $@ set 1 boot on @@ -16,7 +16,7 @@ pine64-pinephone.img: fat-pine64-pinephone.img u-boot-sunxi-with-spl.bin fat-pine64-pinephone.img: initramfs-pine64-pinephone.gz kernel-sunxi.gz pine64-pinephone.scr dtbs/sunxi/sun50i-a64-pinephone.dtb @echo "MKFS $@" @rm -f $@ - @truncate --size 40M $@ + @truncate --size 2038M $@ @mkfs.fat -F32 $@ @mcopy -i $@ kernel-sunxi.gz ::Image.gz @@ -26,7 +26,7 @@ fat-pine64-pinephone.img: initramfs-pine64-pinephone.gz kernel-sunxi.gz pine64-p pine64-pinetab.img: fat-pine64-pinetab.img u-boot-sunxi-with-spl.bin rm -f $@ - truncate --size 50M $@ + truncate --size 2048M $@ parted -s $@ mktable msdos parted -s $@ mkpart primary fat32 2048s 100% parted -s $@ set 1 boot on @@ -36,7 +36,7 @@ pine64-pinetab.img: fat-pine64-pinetab.img u-boot-sunxi-with-spl.bin fat-pine64-pinetab.img: initramfs-pine64-pinetab.gz kernel-sunxi.gz pine64-pinetab.scr dtbs/sunxi/sun50i-a64-pinetab.dtb @echo "MKFS $@" @rm -f $@ - @truncate --size 40M $@ + @truncate --size 2038M $@ @mkfs.fat -F32 $@ @mcopy -i $@ kernel-sunxi.gz ::Image.gz @@ -46,7 +46,7 @@ fat-pine64-pinetab.img: initramfs-pine64-pinetab.gz kernel-sunxi.gz pine64-pinet pine64-pinebookpro.img: fat-pine64-pinebookpro.img u-boot-rk3399.bin rm -f $@ - truncate --size 50M $@ + truncate --size 2048M $@ parted -s $@ mktable msdos parted -s $@ mkpart primary fat32 32768s 100% parted -s $@ set 1 boot on @@ -56,7 +56,7 @@ pine64-pinebookpro.img: fat-pine64-pinebookpro.img u-boot-rk3399.bin fat-pine64-pinebookpro.img: initramfs-pine64-pinebookpro.gz kernel-rockchip.gz src/pine64-pinebookpro.conf dtbs/rockchip/rk3399-pinebook-pro.dtb @echo "MKFS $@" @rm -f $@ - @truncate --size 40M $@ + @truncate --size 2038M $@ @mkfs.fat -F32 $@ @mcopy -i $@ kernel-rockchip.gz ::Image.gz diff --git a/initramfs/fbsplash.conf b/initramfs/fbsplash.conf new file mode 100644 index 0000000..028e245 --- /dev/null +++ b/initramfs/fbsplash.conf @@ -0,0 +1,8 @@ +BAR_TOP=10 +BAR_LEFT=0 +BAR_WIDTH=720 +BAR_HEIGHT=20 + +BAR_R=255 +BAR_G=0 +BAR_B=0 diff --git a/initramfs/init_functions.sh b/initramfs/init_functions.sh index cd194d6..b74146a 100755 --- a/initramfs/init_functions.sh +++ b/initramfs/init_functions.sh @@ -137,6 +137,32 @@ start_serial_getty() { fi } +flash_sd_image() { + echo "Flashing $1" + mkfifo /progress + fbsplash -s /splash.ppm -c -i /fbsplash.conf -f /progress & + echo 00 >/progress + + +} + +check_and_fash_image() { + # If a file with a specific filename exists on the fat partition then flash it to eMMC + echo "Checking for flash.img.{xz,gz,}" + mkdir /sd + mount "$SD" /sd + if [ -e /sd/flash.img.xz ]; then + flash_sd_image /sd/flash.img.xz + fi + if [ -e /sd/flash.img.gz ]; then + flash_sd_image /sd/flash.img.gz + fi + if [ -e /sd/flash.img ]; then + flash_sd_image /sd/flash.img + fi + umount /sd +} + fatal_error() { clear