Added config files

This commit is contained in:
Gerben Jan Dijkman 2022-07-14 22:09:12 +02:00
parent bd83779624
commit fbb6b5232c
3 changed files with 107 additions and 3 deletions

View File

@ -0,0 +1,36 @@
#
# /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
<<your boot_uuid>> uuid_boot
<<your rood_uuid>> uuid_root
setenv bootargs loglevel=4 console=ttyS2,1500000 console=tty0 earlycon=uart8250,mmio32,0xff1a0000 consoleblank=0 boot=PARTUUID=${uuid_boot} root=PARTUUID=${uuid_root} rw rootwait quiet audit=0 bootsplash.bootfile=bootsplash-themes/manjaro/bootsplash
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

@ -0,0 +1,66 @@
#!/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 emerge the u-boot-tools package, by running the following command:"
echo " emerge dev-embedded/u-boot-tools"
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 emerge the u-boot-pinephone-pro package, by running the following command:"
echo " emerge dev-embedded/u-boot-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 "${ACTION} ${IMAGE_DESC} ${BOOT_SCR}..."
if [[ ${VERBOSE} = true ]]; then
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 "${ACTION} ${IMAGE_DESC} from ${BOOT_TXT} completed successfully."
else
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

View File

@ -31,6 +31,7 @@ BDEPEND="
sys-devel/flex sys-devel/flex
virtual/pkgconfig virtual/pkgconfig
sys-devel/crossdev sys-devel/crossdev
dev-embedded/u-boot-tools
" "
src_prepare() { src_prepare() {
@ -94,19 +95,20 @@ src_test() { :; }
src_install() { src_install() {
insinto /boot/ insinto /boot/
doins ${S}/u-boot.itb doins ${S}/u-boot.itb
insinto /boot/
doins ${S}/idbloader.img doins ${S}/idbloader.img
doins ${FILESDIR}/boot.txt
dobin ${FILESDIR}/ppp-uboot-mkscr
} }
pkg_postinst() { pkg_postinst() {
einfo "In order to get the U-Boot to work you will need a crosscompiler for arm-none-eabi you can do this by running: crossdev --target arm-none-eabi (if not done allready) and then re-emerge this packages" einfo "In order to get the U-Boot to work you will need a crosscompiler for arm-none-eabi you can do this by running: crossdev --target arm-none-eabi (if not done allready) and then re-emerge this packages"
einfo "This U-Boot is only to be used for the PinePhone Pro." einfo "This U-Boot is only to be used for the PinePhone Pro."
einfo "Edit the /boot/boot.txt file with your uuid's and then run ppp-uboot-mkscr"
einfo "After compiling a new Gentoo kernel, copy the resulting Image from /usr/src/linux/arch/arm64/boot/Image to the boot partition (replacing the existing Image)." einfo "After compiling a new Gentoo kernel, copy the resulting Image from /usr/src/linux/arch/arm64/boot/Image to the boot partition (replacing the existing Image)."
einfo "New version of U-Boot firmware can be flashed to your microSD card or eMMc module." einfo "New version of U-Boot firmware can be flashed to your microSD card or eMMc module."
einfo "You can do that by running:" einfo "You can do that by running:"
einfo "# dd if=/boot/idbloader.img of=/dev/mmcblkX seek=64 conv=notrunc,fsync" einfo "# dd if=/boot/idbloader.img of=/dev/mmcblkX seek=64 conv=notrunc,fsync"
einfo "# dd if=/boot/u-boot.itb of=/dev/mmcblkX seek=16384 conv=notrunc,fsync" einfo "# dd if=/boot/u-boot.itb of=/dev/mmcblkX seek=16384 conv=notrunc,fsync"
einfo "Due to the Boot Priority for the PPP it is HIGHLY recommended to not put U-Boot on the eMMc because there is no easy way to recover is something went wrong." einfo "Due to the Boot Priority for the PPP it is HIGHLY recommended to not put U-Boot on the eMMc because there is no easy way to recover is something went wrong."
einfo "If you want U-Boot tools installed you can emerge dev-embedded/u-boot-tools."
} }