pocophone-f1.sh (2866B)
1 #!/usr/bin/env zsh 2 # Copyright (c) 2016-2021 Ivan J. <parazyd@dyne.org> 3 # This file is part of arm-sdk 4 # 5 # This source code is free software: you can redistribute it and/or modify 6 # it under the terms of the GNU General Public License as published by 7 # the Free Software Foundation, either version 3 of the License, or 8 # (at your option) any later version. 9 # 10 # This software is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU General Public License for more details. 14 # 15 # You should have received a copy of the GNU General Public License 16 # along with this source code. If not, see <http://www.gnu.org/licenses/>. 17 18 vars+=(device_name arch size parted_type parted_boot parted_root bootfs inittab) 19 vars+=(gitkernel gitbranch) 20 arrs+=(custmodules) 21 22 device_name="pocophone-f1" 23 arch="arm64" 24 size=1891 25 inittab=("T0:23:respawn:/sbin/agetty -L ttyMSM0 115200n8 vt100") 26 27 parted_type="dos" 28 bootfs="vfat" 29 rootfs="ext4" 30 dos_boot="fat32 2048s 264191s" 31 dos_root="$rootfs 264192s 100%" 32 33 extra_packages+=() 34 custmodules=() 35 36 gitkernel="https://gitlab.com/venji10/linux-beryllium" 37 gitbranch="beryllium-panel-ebbg" 38 39 prebuild() { 40 fn prebuild 41 req=(device_name strapdir) 42 ckreq || return 1 43 44 notice "Executing $device_name prebuild" 45 46 mkdir -p "$R/tmp/kernels/$device_name" 47 } 48 49 postbuild() { 50 fn postbuild 51 52 notice "Executing $device_name postbuild" 53 54 copy-root-overlay 55 56 pushd "$R/tmp/kernels/$device_name/${device_name}-linux" 57 58 cat arch/arm64/boot/Image.gz \ 59 arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium-ebbg.dtb \ 60 > Image.gz-dtb || { zerr; return 1; } 61 62 mkdir -p "$R/dist" 63 mkbootimg \ 64 --kernel Image.gz-dtb \ 65 --base 0x00000000 \ 66 --second_offset 0x00f00000 \ 67 --kernel_offset 0x00008000 \ 68 --ramdisk_offset 0x01000000 \ 69 --tags_offset 0x00000100 \ 70 --pagesize 4096 \ 71 --cmdline "root=/dev/mmcblk0p2 rootfstype=$rootfs rootwait rw audit=0" \ 72 -o $R/dist/pocophone-f1-boot.img || { zerr; return 1; } 73 74 popd 75 } 76 77 build_kernel_arm64() { 78 fn build_kernel_arm64 79 req=(R arch device_name gitkernel gitbranch strapdir) 80 ckreq || return 1 81 82 notice "Building $arch kernel" 83 84 prebuild || { zerr; return 1; } 85 86 get-kernel-sources || { zerr; return 1; } 87 88 pushd "$R/tmp/kernels/$device_name/${device_name}-linux" 89 make \ 90 $MAKEOPTS \ 91 ARCH=arm64 \ 92 CROSS_COMPILE=$compiler \ 93 beryllium_defconfig || { zerr; return 1; } 94 95 make \ 96 $MAKEOPTS \ 97 ARCH=arm64 \ 98 CROSS_COMPILE=$compiler \ 99 Image.gz modules qcom/sdm845-xiaomi-beryllium-ebbg.dtb || { zerr; return 1; } 100 101 sudo -E PATH="$PATH" make \ 102 $MAKEOPTS \ 103 ARCH=arm64 \ 104 CROSS_COMPILE=$compiler \ 105 INSTALL_MOD_PATH="$strapdir" \ 106 modules_install || { zerr; return 1; } 107 108 popd 109 110 postbuild || { zerr; return 1; } 111 }