Added extra

This commit is contained in:
Gerben Jan Dijkman
2022-02-01 15:38:12 +01:00
parent ae5d5fe8ea
commit 23becccac8
9 changed files with 35 additions and 187 deletions

View File

@@ -1,37 +0,0 @@
#
# /boot/boot.txt
# After modifying, run "ppp-uboot-mkscr" to re-generate the U-Boot boot script.
#
#
# This is the description of the GPIO lines used in this boot script:
#
# GPIO #105 is GPIO3_B1, or RK3399 ball C27, which controls the vibrator motor
# GPIO #154 is GPIO4_D2, or RK3399 ball AH3, which controls the red part of the multicolor LED
# GPIO #157 is GPIO4_D5, or RK3399 ball AJ3, which controls the green part of the multicolor LED
# GPIO #158 is GPIO4_D6, or RK3399 ball AG4, which controls the blue part of the multicolor LED
#
gpio set 105
gpio set 154
# Set root partition to the second partition of boot device
part uuid ${devtype} ${devnum}:1 uuid_boot
part uuid ${devtype} ${devnum}:2 uuid_root
setenv bootargs loglevel=4 console=tty0 console=${console} earlycon=uart8250,mmio32,0xff1a0000 consoleblank=0 boot=PARTUUID=${uuid_boot} root=PARTUUID=${uuid_root} rw rootwait quiet audit=0
if load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} /Image; then
gpio clear 105
if load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} /dtbs/${fdtfile}; then
if load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /initramfs-linux.img; then
gpio set 157
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
else
gpio set 158
booti ${kernel_addr_r} - ${fdt_addr_r};
fi;
fi;
fi
# EOF

View File

@@ -1,60 +0,0 @@
#!/bin/bash
#
# /usr/bin/ppp-uboot-flash
# Utility that flashes selected U-Boot image to the boot device.
#
# Check that we're running as root
if [[ ${EUID} != 0 ]]; then
echo "Flashing U-Boot image not possible, please execute this utility as root."
exit 1
fi
# Get the device that the root resides on, and remove "/dev/" from the device name
ROOT_DEV=`findmnt / -o source -n | cut -d "[" -f 1 | cut -d "/" -f 3`
# Get the full real name of the root device, which is usually "/dev/mmcblk0"
ROOT_DEV_NAME="/dev/"`echo /sys/block/*/${ROOT_DEV} | cut -d "/" -f 4`
# Verify that the determined root device is available, just in case
if [[ ! -r ${ROOT_DEV_NAME} ]]; then
echo "Flashing U-Boot not possible, device ${ROOT_DEV_NAME} not found. No changes made to U-Boot."
exit 1
fi
# Get the U-Boot component names and check that they exist
IDBLOADER_IMG="/boot/idbloader.img"
U_BOOT_ITB="/boot/u-boot.itb"
for COMPONENT in ${IDBLOADER_IMG} ${U_BOOT_ITB}; do
if [[ ! -r ${COMPONENT} ]]; then
echo "Flashing U-Boot not possible, file ${COMPONENT} not found. No changes made to U-Boot."
exit 1
fi
done
# Flash the first of the selected U-Boot components to the determined root device
echo -n "Flashing U-Boot components..."
dd if=${IDBLOADER_IMG} of=${ROOT_DEV_NAME} seek=64 conv=notrunc,fsync > /dev/null 2>&1
STATUS_IMG=$?
STATUS_ITB=0
# Now flash the second U-Boot component, but only if the first one flashed successfully
if [[ ${STATUS_IMG} = 0 ]]; then
dd if=${U_BOOT_ITB} of=${ROOT_DEV_NAME} seek=16384 conv=notrunc,fsync > /dev/null 2>&1
STATUS_ITB=$?
fi
# At the end, display the final status message of the U-Boot flashing
if [[ ${STATUS_IMG} = 0 && ${STATUS_ITB} = 0 ]]; then
echo " done."
echo "Required U-Boot components flashed to ${ROOT_DEV_NAME} successfully."
echo "Please reboot your phone for the changes to take effect."
else
echo " failed."
echo "Flashing U-Boot components to ${ROOT_DEV_NAME} failed due to unknown reason."
echo "Please try flashing the U-Boot again, or your phone may no longer boot properly."
exit 1
fi
# EOF

View File

@@ -1,68 +0,0 @@
#!/bin/bash
#
# /usr/bin/ppp-uboot-mkscr
# Utility that generates the U-Boot boot script.
#
# Source and destination file paths
BOOT_TXT="/boot/boot.txt"
BOOT_SCR="/boot/boot.scr"
# Boot script description
IMAGE_DESC="U-Boot boot script"
# Determine the performed action
if [[ ! -r ${BOOT_SCR} ]]; then
ACTION="Generating"
else
ACTION="Re-generating"
fi
# Check that we're running as root
if [[ ${EUID} != 0 ]]; then
echo "${ACTION} ${IMAGE_DESC} not possible, please execute this utility as root."
exit 1
fi
# Make sure that the required utility is available
if [[ ! -x /usr/bin/mkimage ]]; then
echo "${ACTION} ${IMAGE_DESC} not possible, mkimage utility not found."
echo "Please install the uboot-tools package, by running the following command:"
echo " emerge dev-embedded/uboot-pinephone-pro"
exit 1
fi
# Check that the source file exists
if [[ ! -r ${BOOT_TXT} ]]; then
echo "${ACTION} ${IMAGE_DESC} not possible, file ${BOOT_TXT} not found."
echo "Please reinstall the uboot-pinephone package, by running the following command:"
echo " emerge dev-embedded/uboot-pinephone-pro"
exit 1
fi
# Is this a quiet execution?
VERBOSE=true
while getopts "q" SWITCH; do
if [[ ${SWITCH} = "q" ]]; then
VERBOSE=false
fi
done
# Generate the U-Boot boot script
echo -n "${ACTION} ${IMAGE_DESC} ${BOOT_SCR}..."
if [[ ${VERBOSE} = true ]]; then
echo
mkimage -A arm -O linux -T script -C none -n "${IMAGE_DESC}" -d ${BOOT_TXT} ${BOOT_SCR}
else
mkimage -A arm -O linux -T script -C none -n "${IMAGE_DESC}" -d ${BOOT_TXT} ${BOOT_SCR} > /dev/null 2>&1
if [[ $? = 0 ]]; then
echo " done."
else
echo " failed."
echo "${ACTION} ${IMAGE_DESC} from ${BOOT_TXT} failed due to unknown reason."
echo "Please try generating the boot script again, or your phone may no longer boot properly."
fi
fi
# EOF