diff --git a/config/boards/ayn-odin2.conf b/config/boards/ayn-odin2.conf index 4c15cf79215b..b1fb83e7d603 100644 --- a/config/boards/ayn-odin2.conf +++ b/config/boards/ayn-odin2.conf @@ -1,4 +1,4 @@ -# Generate kernel and rootfs image for Qcom ABL booting +# Generate kernel and rootfs image for Qcom ABL Custom booting declare -g BOARD_NAME="Ayn Odin2" declare -g BOARD_MAINTAINER="FantasyGmm" declare -g BOARDFAMILY="qcom-abl" @@ -6,13 +6,16 @@ declare -g KERNEL_TARGET="sm8550" declare -g KERNELPATCHDIR="arm64-sm8550" declare -g EXTRAWIFI="no" declare -g BOOTCONFIG="none" +declare -g BOOTFS_TYPE="fat" +declare -g BOOTSIZE="256" declare -g BOOTIMG_CMDLINE_EXTRA="clk_ignore_unused pd_ignore_unused panic=30 audit=0 allow_mismatched_32bit_el0 rw mem_sleep_default=s2idle" declare -g IMAGE_PARTITION_TABLE="gpt" -declare -g -a ABL_DTB_LIST=("qcs8550-ayn-odin2-hypdtbo") # Use the full firmware, complete linux-firmware plus Armbian's declare -g BOARD_FIRMWARE_INSTALL="-full" +declare -g DESKTOP_AUTOLOGIN="yes" + function post_family_config_branch_sm8550__edk2_kernel() { declare -g KERNELSOURCE='https://github.com/edk2-porting/linux-next' declare -g KERNEL_MAJOR_MINOR="6.7" # Major and minor versions of this kernel. @@ -27,7 +30,7 @@ function ayn-odin2_is_userspace_supported() { return 1 } -function post_family_tweaks__ayn-odin2_enable_services() { +function post_family_tweaks__enable_services() { if ! ayn-odin2_is_userspace_supported; then if [[ "${RELEASE}" != "" ]]; then display_alert "Missing userspace for ${BOARD}" "${RELEASE} does not have the userspace necessary to support the ${BOARD}" "warn" @@ -70,12 +73,14 @@ function post_family_tweaks__ayn-odin2_enable_services() { do_with_retries 3 chroot_sdcard_apt_get_install mesa-vulkan-drivers qbootctl qrtr-tools protection-domain-mapper tqftpserv # Kernel postinst script to update abl boot partition - install -Dm655 $SRC/packages/bsp/ayn-odin2/zz-update-abl-kernel $destination/etc/kernel/postinst.d/ + install -Dm655 $SRC/packages/bsp/ayn-odin2/zz-update-abl-kernel "${SDCARD}"/etc/kernel/postinst.d/ + + cp $SRC/packages/bsp/ayn-odin2/LinuxLoader.cfg "${SDCARD}"/boot/ return 0 } -function post_family_tweaks_bsp__ayn-odin2_bsp_firmware_in_initrd() { +function post_family_tweaks_bsp__firmware_in_initrd() { random_mac=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//') declare -g BOOTIMG_CMDLINE_EXTRA="${BOOTIMG_CMDLINE_EXTRA} bt_mac=${random_mac}" display_alert "Generate a random Bluetooth MAC address, Mac:${random_mac}" "info" @@ -102,3 +107,15 @@ function post_family_tweaks_bsp__ayn-odin2_bsp_firmware_in_initrd() { FIRMWARE_HOOK run_host_command_logged chmod -v +x "${file_added_to_bsp_destination}" } + +function pre_umount_final_image__update_ABL_settings() { + if [ -z "$BOOTFS_TYPE" ]; then + return 0 + fi + display_alert "Update ABL settings for " "${BOARD}" "info" + uuid_line=$(head -n 1 "${SDCARD}"/etc/fstab) + rootfs_image_uuid=$(echo "${uuid_line}" | awk '{print $1}' | awk -F '=' '{print $2}') + initrd_name=$(find "${SDCARD}/boot/" -type f -name "config-*" | sed 's/.*config-//') + sed -i "s/UUID_PLACEHOLDER/${rootfs_image_uuid}/g" "${MOUNT}"/boot/LinuxLoader.cfg + sed -i "s/INITRD_PLACEHOLDER/${initrd_name}/g" "${MOUNT}"/boot/LinuxLoader.cfg +} diff --git a/extensions/image-output-abl.sh b/extensions/image-output-abl.sh index b6a376478783..822158879691 100644 --- a/extensions/image-output-abl.sh +++ b/extensions/image-output-abl.sh @@ -5,6 +5,10 @@ function add_host_dependencies__abl_host_deps() { function post_build_image__900_convert_to_abl_img() { [[ -z $version ]] && exit_with_error "version is not set" + if [ ! -z "$BOOTFS_TYPE" ]; then + return 0 + fi + display_alert "Converting image $version to rootfs" "${EXTENSION}" "info" declare -g ROOTFS_IMAGE_FILE="${DESTIMG}/${version}.rootfs.img" rootfs_start_sector=$(gdisk -l ${DESTIMG}/${version}.img | grep rootfs | awk '{print $2}') diff --git a/packages/bsp/ayn-odin2/LinuxLoader.cfg b/packages/bsp/ayn-odin2/LinuxLoader.cfg new file mode 100755 index 000000000000..2d80f60db15f --- /dev/null +++ b/packages/bsp/ayn-odin2/LinuxLoader.cfg @@ -0,0 +1,62 @@ +# +# Configure the LinuxLoader settings +# + +[LinuxLoader] + +# Controls on-screen logging +# This setting can persist without config file or sdcard being present +Debug = false + +# Boot target. Can be one of the following: +# "default" (ABL default) +# "Linux" (direct Linux Image load) +# "EFI" +# "UEFI Shell" (will execute startup.nsh automatically if found on any FAT partition) +# "Mass Storage" (will mount the UFS LUN specified below as mass storage) +Target = "default" + +# Default UFS LUN to mount as mass storage +# Allowed values: 0, 1, 2, 3, 4, 5 +MassStorageLUN = 0 + +# Volume up boot target. Can be one of the following: +# "BDS Menu" (will enter the UEFI boot menu provided by Qualcomm, don't touch anything there unless you know what you are doing!) +# "UEFI Shell" (will execute startup.nsh automatically if found on any FAT partition) +# "recovery" +# "Linux" +DefaultVolUp = "Linux" + +# Setting this to *true* will enable USB Host mode in UEFI +# This might be useful if you want to play with UEFI. +# Note that you will need an externally powered type-C hub to connect USB devices. (at least for now) +UsbHostMode = false + +# Controls hypervisor UART enablement +# +# Setting *true* here will force enable the hypervisor UART +# Setting *false* here will force disable the hypervisor UART +# Removing this line will avoid changing the default behavior +# Please leave it to *false* unless you know what you are doing +HypUartEnable = false + +# Controls display hardware status during exit boot services +# +# The dispcc driver from mainline Linux kernel has a bug, which +# prevents the display hardware from initializing properly if +# the display hardware is not disabled before exiting boot services. +# +# Set this to *true* if you are trying to boot a mainline kernel. +DisableDisplayHW = true + +[Linux] +# Accept both gzipped and non-gzipped kernel images +Image = "Image" +initrd = "initrd.img-INITRD_PLACEHOLDER" +devicetree = "dtb/qcom/qcs8550-ayn-odin2-hypdtbo.dtb" +cmdline = "clk_ignore_unused pd_ignore_unused panic=30 audit=0 allow_mismatched_32bit_el0 rw mem_sleep_default=s2idle root=UUID=UUID_PLACEHOLDER" + +[EFI] +Image = "EFI/BOOT/BOOTAA64.EFI" +# Options to be passed to the EFI Application, could be left empty +Options = "earlycon=efifb,mem"