├── configs ├── optee ├── distrofix ├── edk2 ├── crust ├── amlogic-gxl ├── ums-emmc ├── buildroot ├── amlogic-g12a ├── amlogic-g12b ├── atf ├── edk2-platforms ├── allwinner-h3 ├── allwinner ├── nfs ├── allwinner-h5 ├── rockchip-rk3328 ├── rockchip-rk3399 ├── amlogic ├── rockchip ├── mbruefi ├── roc-rk3328-cc ├── roc-rk3399-pc ├── spiflash ├── aml-s805x-ac ├── firefly-rk3399 ├── p212 ├── roc-rk3328-cc-v2 ├── aml-a311d-cc ├── aml-s905d3-cc ├── aml-s905d3-cm ├── aml-s905x-cc ├── aml-s805x-ac-min ├── aml-s805x-ac-v2 ├── aml-s905x-cc-v2 ├── aml-s905d-pc ├── aml-s905d3-cc-next ├── aml-s905x-cc-min ├── aml-s905x-cc-net ├── aml-a311d-cc-v01 ├── aml-s905d-pc-min ├── aml-s905x-cc-v2-min ├── aml-s905x-cc-v2-net ├── roc-rk3399-pc-spiflash ├── aml-a311d-cm-v01 ├── aml-s905d3-cc-v01 ├── roc-rk3328-cc-ums-emmc ├── roc-rk3399-pc-ums-emmc ├── aml-a311d-cc-spi ├── aml-s805x-ac-spi ├── aml-s905x-cc-mbruefi ├── roc-rk3328-cc-v2-spiflash ├── aml-a311d-cc-nfs ├── aml-s905d3-cc-spi ├── aml-s905d3-cm-spi ├── aml-s805x-ac-v2-spi ├── aml-s905d-pc-spiflash ├── aml-s905d3-cc-nfs ├── aml-s905x-cc-v2-spi ├── aml-a311d-cc-v01-nfs ├── aml-s905d3-cc-next-spiflash ├── aml-s905x-cc-ums-emmc ├── aml-s905d3-cc-v01-nfs ├── aml-s912-pc ├── all-h3-cc-h5 ├── aml-a311d-cc-v01-spiflash ├── all-h3-cc-h3 ├── aml-a311d-cm-v01-spiflash ├── aml-s905d3-cc-v01-spiflash ├── build ├── all-h3-cc-h5-ums-emmc ├── all-h3-cc-h5-headend ├── aml-s905x-cc-system └── roc-rk3399-pc_optee ├── vendor ├── amlogic │ ├── nfs.sfdisk │ ├── mbruefi.sfdisk │ ├── spiflash │ │ ├── part.sfdisk │ │ ├── finalize.sh │ │ └── u-boot.cmd │ ├── nfs.sh │ ├── mbruefi.sh │ ├── mbruefiloader.sh │ ├── gxlimg.sh │ ├── encrypt.sh │ └── distrofix.sh ├── allwinner │ └── ums-emmc │ │ └── finalize.sh ├── rockchip │ ├── spiflash │ │ ├── part.sfdisk │ │ ├── rk3328-spiflash.dtbo │ │ ├── rk3399-spiflash.dtbo │ │ ├── rk3328-spiflash.dts │ │ ├── rk3399-spiflash.dts │ │ ├── finalize.sh │ │ └── u-boot.cmd │ ├── bin │ │ └── boot_merger │ └── ums-emmc │ │ └── finalize.sh └── libre-computer │ └── u-boot_configs ├── lib ├── ums-emmc.sh ├── atf.sh ├── crust.sh ├── br2.sh ├── nfs.sh ├── mbruefi.sh ├── spiflash.sh ├── optee.sh ├── edk2.sh ├── git.sh ├── u-boot.sh └── gcc.sh ├── tools └── space.sh ├── setup.sh ├── readme.md └── LICENSE /configs/optee: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /configs/distrofix: -------------------------------------------------------------------------------- 1 | LBS_DISTROFIX_SCRIPT=$LBS_VENDOR_PATH/$VENDOR_PATH/distrofix.sh 2 | -------------------------------------------------------------------------------- /configs/edk2: -------------------------------------------------------------------------------- 1 | EDK2_GIT_URL='https://github.com/tianocore/edk2.git' 2 | EDK2_GIT_BRANCH=master -------------------------------------------------------------------------------- /configs/crust: -------------------------------------------------------------------------------- 1 | CRUST_GIT_URL='https://github.com/crust-firmware/crust.git' 2 | CRUST_GIT_BRANCH=master -------------------------------------------------------------------------------- /vendor/amlogic/nfs.sfdisk: -------------------------------------------------------------------------------- 1 | label: dos 2 | unit: sectors 3 | sector-size: 512 4 | 5 | start=2048, type=ef 6 | -------------------------------------------------------------------------------- /configs/amlogic-gxl: -------------------------------------------------------------------------------- 1 | . configs/amlogic 2 | 3 | ATF_PLAT=gxl 4 | ATF_TARGET=bl31 5 | ATF_OUTPUT_FILE=bl31.bin 6 | -------------------------------------------------------------------------------- /configs/ums-emmc: -------------------------------------------------------------------------------- 1 | LBS_UMS_EMMC=1 2 | LBS_UMS_EMMC_LOAD=$LBS_VENDOR_PATH/$VENDOR_PATH/ums-emmc/finalize.sh 3 | 4 | -------------------------------------------------------------------------------- /vendor/amlogic/mbruefi.sfdisk: -------------------------------------------------------------------------------- 1 | label: dos 2 | unit: sectors 3 | sector-size: 512 4 | 5 | start=2048, type=ef 6 | -------------------------------------------------------------------------------- /configs/buildroot: -------------------------------------------------------------------------------- 1 | BR2_GIT_URL='https://github.com/libre-computer-project/libretech-buildroot.git' 2 | LBS_BR2=1 3 | -------------------------------------------------------------------------------- /vendor/amlogic/spiflash/part.sfdisk: -------------------------------------------------------------------------------- 1 | label: dos 2 | unit: sectors 3 | sector-size: 512 4 | 5 | start=8192, type=ef 6 | -------------------------------------------------------------------------------- /configs/amlogic-g12a: -------------------------------------------------------------------------------- 1 | . configs/amlogic 2 | 3 | #ATF_PLAT=g12a 4 | #ATF_TARGET=bl31 5 | #ATF_OUTPUT_FILE=bl31.bin 6 | 7 | -------------------------------------------------------------------------------- /configs/amlogic-g12b: -------------------------------------------------------------------------------- 1 | . configs/amlogic 2 | 3 | #ATF_PLAT=g12b 4 | #ATF_TARGET=bl31 5 | #ATF_OUTPUT_FILE=bl31.bin 6 | 7 | -------------------------------------------------------------------------------- /configs/atf: -------------------------------------------------------------------------------- 1 | ATF_GIT_URL='https://github.com/libre-computer-project/arm-trusted-firmware.git' 2 | ATF_GIT_BRANCH=master 3 | -------------------------------------------------------------------------------- /configs/edk2-platforms: -------------------------------------------------------------------------------- 1 | EDK2PLAT_GIT_URL='https://github.com/tianocore/edk2-platforms.git' 2 | EDK2PLAT_GIT_BRANCH=master -------------------------------------------------------------------------------- /configs/allwinner-h3: -------------------------------------------------------------------------------- 1 | . configs/allwinner 2 | 3 | LBS_ATF=0 4 | 5 | . configs/crust 6 | 7 | LBS_ARCH=armhf 8 | LBS_CC=arm-none-eabi- -------------------------------------------------------------------------------- /vendor/allwinner/ums-emmc/finalize.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cp $LBS_UBOOT_PATH/u-boot-sunxi-with-spl.bin $LBS_OUT_PATH/$LBS_TARGET 4 | -------------------------------------------------------------------------------- /vendor/rockchip/spiflash/part.sfdisk: -------------------------------------------------------------------------------- 1 | label: dos 2 | unit: sectors 3 | sector-size: 512 4 | 5 | /dev/mmcblk0p1 : start=8192, type=ef 6 | -------------------------------------------------------------------------------- /vendor/rockchip/bin/boot_merger: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libre-computer-project/libretech-builder-simple/HEAD/vendor/rockchip/bin/boot_merger -------------------------------------------------------------------------------- /configs/allwinner: -------------------------------------------------------------------------------- 1 | VENDOR_PATH=allwinner 2 | 3 | LBS_UBOOT_BIN_FINAL_PATH="$LBS_UBOOT_PATH/u-boot-sunxi-with-spl.bin" 4 | 5 | LBS_BOOT_SECTOR=16 6 | -------------------------------------------------------------------------------- /configs/nfs: -------------------------------------------------------------------------------- 1 | LBS_NFS=1 2 | LBS_NFS_LOAD=$LBS_VENDOR_PATH/$VENDOR_PATH/nfs.sh 3 | LBS_NFS_SFDISK=$LBS_VENDOR_PATH/$VENDOR_PATH/nfs.sfdisk 4 | LBS_NFS_DISK_SIZE=3M 5 | -------------------------------------------------------------------------------- /vendor/rockchip/spiflash/rk3328-spiflash.dtbo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libre-computer-project/libretech-builder-simple/HEAD/vendor/rockchip/spiflash/rk3328-spiflash.dtbo -------------------------------------------------------------------------------- /vendor/rockchip/spiflash/rk3399-spiflash.dtbo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libre-computer-project/libretech-builder-simple/HEAD/vendor/rockchip/spiflash/rk3399-spiflash.dtbo -------------------------------------------------------------------------------- /lib/ums-emmc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LBS_UMS_EMMC_build(){ 4 | if [ ! -d "$LBS_OUT_PATH" ]; then 5 | mkdir -p "$LBS_OUT_PATH" 6 | fi 7 | . "$LBS_UMS_EMMC_LOAD" 8 | } 9 | -------------------------------------------------------------------------------- /configs/allwinner-h5: -------------------------------------------------------------------------------- 1 | . configs/allwinner 2 | 3 | . configs/atf 4 | 5 | ATF_PLAT=sun50i_a64 6 | ATF_TARGET=bl31 7 | ATF_OUTPUT_FILE=bl31.bin 8 | 9 | LBS_ATF=1 10 | 11 | . configs/crust 12 | 13 | LBS_ARCH=arm64 14 | LBS_CC=aarch64-elf- -------------------------------------------------------------------------------- /configs/rockchip-rk3328: -------------------------------------------------------------------------------- 1 | . configs/rockchip 2 | 3 | ATF_PLAT=rk3328 4 | ATF_TARGET=bl31 5 | ATF_OUTPUT_FILE=bl31/bl31.elf 6 | 7 | SPI_FLASH_OVERLAY=rk3328-spiflash.dtbo 8 | SPI_OF_NODE=/spi@ff190000 9 | SPI_DRIVER=rockchip_rk3288_spi 10 | -------------------------------------------------------------------------------- /configs/rockchip-rk3399: -------------------------------------------------------------------------------- 1 | . configs/rockchip 2 | 3 | ATF_PLAT=rk3399 4 | ATF_TARGET=bl31 5 | ATF_OUTPUT_FILE=bl31/bl31.elf 6 | 7 | SPI_FLASH_OVERLAY=rk3399-spiflash.dtbo 8 | SPI_OF_NODE=/spi@ff1d0000 9 | SPI_DRIVER=rockchip_rk3288_spi 10 | -------------------------------------------------------------------------------- /configs/amlogic: -------------------------------------------------------------------------------- 1 | VENDOR_PATH=amlogic 2 | 3 | LBS_UBOOT_BIN_FINAL_PATH="$LBS_UBOOT_PATH/u-boot-amlogic.bin" 4 | 5 | LBS_ARCH=arm64 6 | LBS_CC=aarch64-elf- 7 | 8 | LBS_ATF=0 9 | 10 | . configs/atf 11 | 12 | LBS_CRUST=0 13 | 14 | LBS_BOOT_SECTOR=1 15 | -------------------------------------------------------------------------------- /configs/rockchip: -------------------------------------------------------------------------------- 1 | VENDOR_PATH=rockchip 2 | 3 | LBS_UBOOT_BIN_FINAL_PATH="$LBS_UBOOT_PATH/u-boot-rockchip.bin" 4 | 5 | LBS_ARCH=arm64 6 | LBS_CC=aarch64-elf- 7 | 8 | LBS_ATF=1 9 | 10 | . configs/atf 11 | 12 | LBS_CRUST=0 13 | 14 | LBS_BOOT_SECTOR=64 15 | -------------------------------------------------------------------------------- /configs/mbruefi: -------------------------------------------------------------------------------- 1 | LBS_MBRUEFI=1 2 | LBS_MBRUEFI_LOAD=$LBS_VENDOR_PATH/$VENDOR_PATH/mbruefi.sh 3 | LBS_MBRUEFI_SFDISK=$LBS_VENDOR_PATH/$VENDOR_PATH/mbruefi.sfdisk 4 | LBS_MBRUEFI_SCRIPT=$LBS_VENDOR_PATH/$VENDOR_PATH/mbruefiloader.sh 5 | LBS_MBRUEFI_DISK_SIZE=128M 6 | . configs/distrofix 7 | -------------------------------------------------------------------------------- /configs/roc-rk3328-cc: -------------------------------------------------------------------------------- 1 | BOARD_NAME=roc-rk3328-cc 2 | 3 | . configs/rockchip-rk3328 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.07/lc-roc-rk3328-cc 9 | UBOOT_TARGET=roc-cc-rk3328_defconfig 10 | -------------------------------------------------------------------------------- /configs/roc-rk3399-pc: -------------------------------------------------------------------------------- 1 | BOARD_NAME=roc-rk3399-pc 2 | 3 | . configs/rockchip-rk3399 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.07/lc-roc-rk3399-pc 9 | UBOOT_TARGET=roc-pc-rk3399_defconfig 10 | -------------------------------------------------------------------------------- /configs/spiflash: -------------------------------------------------------------------------------- 1 | LBS_SPIFLASH=1 2 | LBS_SPIFLASH_LOAD=$LBS_VENDOR_PATH/$VENDOR_PATH/spiflash/finalize.sh 3 | LBS_SPIFLASH_SFDISK=$LBS_VENDOR_PATH/$VENDOR_PATH/spiflash/part.sfdisk 4 | LBS_SPIFLASH_SCRIPT=$LBS_VENDOR_PATH/$VENDOR_PATH/spiflash/u-boot.cmd 5 | LBS_SPIFLASH_DISK_SIZE=20M 6 | -------------------------------------------------------------------------------- /configs/aml-s805x-ac: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s805x-ac 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2025.07/lc-master 9 | UBOOT_TARGET=libretech-ac_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | -------------------------------------------------------------------------------- /configs/firefly-rk3399: -------------------------------------------------------------------------------- 1 | BOARD_NAME=firefly-rk3399_defconfig 2 | 3 | . configs/rockchip-rk3399 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=u-boot/v2022.07/master 9 | UBOOT_TARGET=firefly-rk3399_defconfig 10 | -------------------------------------------------------------------------------- /configs/p212: -------------------------------------------------------------------------------- 1 | BOARD_NAME=p212 2 | 3 | . configs/atf 4 | 5 | . configs/amlogic-gxl 6 | 7 | LBS_OPTEE=0 8 | 9 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 10 | UBOOT_BRANCH=u-boot/v2022.07/master 11 | UBOOT_TARGET=p212_defconfig 12 | 13 | AML_ENCRYPT=gxl -------------------------------------------------------------------------------- /configs/roc-rk3328-cc-v2: -------------------------------------------------------------------------------- 1 | BOARD_NAME=roc-rk3328-cc-v2 2 | 3 | . configs/rockchip-rk3328 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.07/lc-roc-rk3328-cc-v2 9 | UBOOT_TARGET=roc-cc-v2-rk3328_defconfig 10 | -------------------------------------------------------------------------------- /configs/aml-a311d-cc: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-a311d-cc 2 | 3 | . configs/amlogic-g12b 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2025.07/lc-master 9 | UBOOT_TARGET=aml-a311d-cc_defconfig 10 | 11 | AML_ENCRYPT=g12b 12 | -------------------------------------------------------------------------------- /configs/aml-s905d3-cc: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905d3-cc 2 | 3 | . configs/amlogic-g12a 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2025.07/lc-master 9 | UBOOT_TARGET=aml-s905d3-cc_defconfig 10 | 11 | AML_ENCRYPT=g12a 12 | -------------------------------------------------------------------------------- /configs/aml-s905d3-cm: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905d3-cm 2 | 3 | . configs/amlogic-g12a 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2025.07/lc-master 9 | UBOOT_TARGET=aml-s905d3-cm_defconfig 10 | 11 | AML_ENCRYPT=g12a 12 | -------------------------------------------------------------------------------- /configs/aml-s905x-cc: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905x-cc 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2025.07/lc-master 9 | UBOOT_TARGET=libretech-cc_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | 13 | -------------------------------------------------------------------------------- /vendor/amlogic/nfs.sh: -------------------------------------------------------------------------------- 1 | sudo mkfs.vfat ${loop_dev}p1 2 | local loop_mnt="$(mktemp -d)" 3 | sudo mount ${loop_dev}p1 "$loop_mnt" 4 | sudo mkdir -p "$loop_mnt/EFI/BOOT" "$loop_mnt/dtb" 5 | sudo umount "$loop_mnt" 6 | sudo dd if="$LBS_UBOOT_BIN_FINAL_PATH" of="$loop_dev" conv=fsync,notrunc bs=512 seek=1 7 | -------------------------------------------------------------------------------- /configs/aml-s805x-ac-min: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s805x-ac 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.04/aml-s805x-ac 9 | UBOOT_TARGET=libretech-ac_min_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | -------------------------------------------------------------------------------- /configs/aml-s805x-ac-v2: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s805x-ac-v2 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2025.07/lc-master 9 | UBOOT_TARGET=aml-s805x-ac-v2_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | -------------------------------------------------------------------------------- /configs/aml-s905x-cc-v2: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905x-cc-v2 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2025.07/lc-master 9 | UBOOT_TARGET=libretech-cc_v2_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | -------------------------------------------------------------------------------- /configs/aml-s905d-pc: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905d-pc 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.04/aml-s905d-pc 9 | UBOOT_TARGET=libretech-s905d-pc_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | 13 | -------------------------------------------------------------------------------- /configs/aml-s905d3-cc-next: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905d3-cc 2 | 3 | . configs/amlogic-g12a 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2024.10/lc-aml-s905d3-cc 9 | UBOOT_TARGET=aml-s905d3-cc_defconfig 10 | 11 | AML_ENCRYPT=g12a 12 | -------------------------------------------------------------------------------- /configs/aml-s905x-cc-min: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905x-cc 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.04/aml-s905x-cc 9 | UBOOT_TARGET=libretech-cc_min_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | 13 | -------------------------------------------------------------------------------- /configs/aml-s905x-cc-net: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905x-cc 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.04/aml-s905x-cc-net 9 | UBOOT_TARGET=libretech-cc_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | 13 | -------------------------------------------------------------------------------- /configs/aml-a311d-cc-v01: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-a311d-cc-v01 2 | 3 | . configs/amlogic-g12b 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.07/lc-aml-a311d-cc-v01 9 | UBOOT_TARGET=libretech-a311d-cc_defconfig 10 | 11 | AML_ENCRYPT=g12b 12 | -------------------------------------------------------------------------------- /configs/aml-s905d-pc-min: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905d-pc 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.04/aml-s905d-pc 9 | UBOOT_TARGET=libretech-s905d-pc_min_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | 13 | -------------------------------------------------------------------------------- /configs/aml-s905x-cc-v2-min: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905x-cc-v2 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.04/aml-s905x-cc-v2 9 | UBOOT_TARGET=libretech-cc_v2_min_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | -------------------------------------------------------------------------------- /configs/aml-s905x-cc-v2-net: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905x-cc-v2 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.04/aml-s905x-cc-v2-net 9 | UBOOT_TARGET=libretech-cc_v2_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | -------------------------------------------------------------------------------- /configs/roc-rk3399-pc-spiflash: -------------------------------------------------------------------------------- 1 | BOARD_NAME=roc-rk3399-pc 2 | 3 | . configs/rockchip-rk3399 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.07/lc-roc-rk3399-pc 9 | UBOOT_TARGET=roc-pc-rk3399_defconfig 10 | 11 | . configs/spiflash 12 | -------------------------------------------------------------------------------- /configs/aml-a311d-cm-v01: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-a311d-cm-v01 2 | 3 | . configs/amlogic-g12b 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2024.07/aml-a311d-cm-v01 9 | UBOOT_TARGET=libretech_aml_a311d_cm_v01_defconfig 10 | 11 | AML_ENCRYPT=g12b 12 | -------------------------------------------------------------------------------- /configs/aml-s905d3-cc-v01: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905d3-cc-v01 2 | 3 | . configs/amlogic-g12a 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.07/lc-aml-s905d3-cc-v01 9 | UBOOT_TARGET=libretech-s905d3-cc_defconfig 10 | 11 | AML_ENCRYPT=g12a 12 | -------------------------------------------------------------------------------- /configs/roc-rk3328-cc-ums-emmc: -------------------------------------------------------------------------------- 1 | BOARD_NAME=roc-rk3328-cc 2 | 3 | . configs/rockchip-rk3328 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2024.07/lc-roc-rk3328-cc-ums-emmc 9 | UBOOT_TARGET=roc-cc-rk3328_defconfig 10 | 11 | . configs/ums-emmc 12 | -------------------------------------------------------------------------------- /configs/roc-rk3399-pc-ums-emmc: -------------------------------------------------------------------------------- 1 | BOARD_NAME=roc-rk3399-pc 2 | 3 | . configs/rockchip-rk3399 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.07/lc-roc-rk3399-pc-ums-emmc 9 | UBOOT_TARGET=roc-pc-rk3399_defconfig 10 | 11 | . configs/ums-emmc 12 | -------------------------------------------------------------------------------- /configs/aml-a311d-cc-spi: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-a311d-cc 2 | 3 | . configs/amlogic-g12b 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2025.07/lc-master 9 | UBOOT_TARGET=aml-a311d-cc_spi_defconfig 10 | 11 | AML_ENCRYPT=g12b 12 | 13 | . configs/spiflash 14 | -------------------------------------------------------------------------------- /configs/aml-s805x-ac-spi: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s805x-ac 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2025.07/lc-master 9 | UBOOT_TARGET=libretech-ac_spi_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | 13 | . configs/spiflash 14 | -------------------------------------------------------------------------------- /configs/aml-s905x-cc-mbruefi: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905x-cc 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=u-boot/v2022.07/aml-s905x-cc 9 | UBOOT_TARGET=libretech-cc_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | 13 | . configs/mbruefi -------------------------------------------------------------------------------- /configs/roc-rk3328-cc-v2-spiflash: -------------------------------------------------------------------------------- 1 | BOARD_NAME=roc-rk3328-cc-v2 2 | 3 | . configs/rockchip-rk3328 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.07/lc-roc-rk3328-cc-v2 9 | UBOOT_TARGET=roc-cc-v2-rk3328_defconfig 10 | 11 | . configs/spiflash 12 | -------------------------------------------------------------------------------- /configs/aml-a311d-cc-nfs: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-a311d-cc 2 | 3 | . configs/amlogic-g12b 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.07/lc-aml-a311d-cc 9 | UBOOT_TARGET=libretech-a311d-cc_defconfig 10 | 11 | AML_ENCRYPT=g12b 12 | 13 | . configs/nfs 14 | -------------------------------------------------------------------------------- /configs/aml-s905d3-cc-spi: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905d3-cc 2 | 3 | . configs/amlogic-g12a 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2025.07/lc-master 9 | UBOOT_TARGET=aml-s905d3-cc_spi_defconfig 10 | 11 | AML_ENCRYPT=g12a 12 | 13 | . configs/spiflash 14 | -------------------------------------------------------------------------------- /configs/aml-s905d3-cm-spi: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905d3-cm 2 | 3 | . configs/amlogic-g12a 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2025.07/lc-master 9 | UBOOT_TARGET=aml-s905d3-cm_spi_defconfig 10 | 11 | AML_ENCRYPT=g12a 12 | 13 | . configs/spiflash 14 | -------------------------------------------------------------------------------- /configs/aml-s805x-ac-v2-spi: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s805x-ac-v2 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2025.07/lc-master 9 | UBOOT_TARGET=aml-s805x-ac-v2_spi_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | 13 | . configs/spiflash 14 | -------------------------------------------------------------------------------- /configs/aml-s905d-pc-spiflash: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905d-pc 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.04/aml-s905d-pc 9 | UBOOT_TARGET=libretech-s905d-pc_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | 13 | . configs/spiflash 14 | -------------------------------------------------------------------------------- /configs/aml-s905d3-cc-nfs: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905d3-cc 2 | 3 | . configs/amlogic-g12a 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.07/lc-aml-s905d3-cc 9 | UBOOT_TARGET=libretech-s905d3-cc_defconfig 10 | 11 | AML_ENCRYPT=g12a 12 | 13 | . configs/nfs 14 | -------------------------------------------------------------------------------- /configs/aml-s905x-cc-v2-spi: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905x-cc-v2 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2025.07/lc-master 9 | UBOOT_TARGET=libretech-cc_v2_spi_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | 13 | . configs/spiflash 14 | -------------------------------------------------------------------------------- /configs/aml-a311d-cc-v01-nfs: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-a311d-cc-v01 2 | 3 | . configs/amlogic-g12b 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.07/lc-aml-a311d-cc-v01 9 | UBOOT_TARGET=libretech-a311d-cc_defconfig 10 | 11 | AML_ENCRYPT=g12b 12 | 13 | . configs/nfs 14 | -------------------------------------------------------------------------------- /configs/aml-s905d3-cc-next-spiflash: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905d3-cc 2 | 3 | . configs/amlogic-g12a 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2024.10/lc-aml-s905d3-cc 9 | UBOOT_TARGET=aml-s905d3-cc_defconfig 10 | 11 | AML_ENCRYPT=g12a 12 | 13 | . configs/spiflash 14 | -------------------------------------------------------------------------------- /configs/aml-s905x-cc-ums-emmc: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905x-cc 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.07/lc-aml-s905x-cc-ums-emmc 9 | UBOOT_TARGET=libretech-cc_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | 13 | . configs/ums-emmc 14 | -------------------------------------------------------------------------------- /configs/aml-s905d3-cc-v01-nfs: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905d3-cc-v01 2 | 3 | . configs/amlogic-g12a 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.07/lc-aml-s905d3-cc-v01 9 | UBOOT_TARGET=libretech-s905d3-cc_defconfig 10 | 11 | AML_ENCRYPT=g12a 12 | 13 | . configs/nfs 14 | -------------------------------------------------------------------------------- /configs/aml-s912-pc: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s912-pc 2 | 3 | . configs/atf 4 | 5 | . configs/amlogic-gxl 6 | 7 | LBS_OPTEE=0 8 | 9 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 10 | UBOOT_BRANCH=u-boot/v2022.04/aml-s912-pc 11 | UBOOT_TARGET=libretech-s912-pc_defconfig 12 | 13 | AML_GXLIMG=1 14 | 15 | . configs/spiflash -------------------------------------------------------------------------------- /configs/all-h3-cc-h5: -------------------------------------------------------------------------------- 1 | BOARD_NAME=all-h3-cc-h5 2 | 3 | . configs/allwinner-h5 4 | 5 | LBS_CRUST=1 6 | CRUST_TARGET=libretech_all_h3_cc_h5_defconfig 7 | 8 | LBS_OPTEE=0 9 | 10 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 11 | UBOOT_BRANCH=v2023.07/lc-all-h3-cc-h5 12 | UBOOT_TARGET=libretech_all_h3_cc_h5_defconfig 13 | -------------------------------------------------------------------------------- /configs/aml-a311d-cc-v01-spiflash: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-a311d-cc-v01 2 | 3 | . configs/amlogic-g12b 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.07/lc-aml-a311d-cc-v01 9 | UBOOT_TARGET=libretech-a311d-cc_defconfig 10 | 11 | AML_ENCRYPT=g12b 12 | 13 | . configs/spiflash 14 | -------------------------------------------------------------------------------- /configs/all-h3-cc-h3: -------------------------------------------------------------------------------- 1 | BOARD_NAME=all-h3-cc-h3 2 | 3 | . configs/allwinner-h3 4 | 5 | LBS_CRUST=1 6 | CRUST_TARGET=libretech_all_h3_cc_h3_defconfig 7 | 8 | LBS_OPTEE=0 9 | 10 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 11 | UBOOT_BRANCH=u-boot/v2022.07/all-h3-cc-h5 12 | UBOOT_TARGET=libretech_all_h3_cc_h3_defconfig 13 | -------------------------------------------------------------------------------- /configs/aml-a311d-cm-v01-spiflash: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-a311d-cm-v01 2 | 3 | . configs/amlogic-g12b 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2024.07/aml-a311d-cm-v01 9 | UBOOT_TARGET=libretech_aml_a311d_cm_v01_defconfig 10 | 11 | AML_ENCRYPT=g12b 12 | 13 | . configs/spiflash 14 | -------------------------------------------------------------------------------- /configs/aml-s905d3-cc-v01-spiflash: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905d3-cc-v01 2 | 3 | . configs/amlogic-g12a 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.07/lc-aml-s905d3-cc-v01 9 | UBOOT_TARGET=libretech-s905d3-cc_defconfig 10 | 11 | AML_ENCRYPT=g12a 12 | 13 | . configs/spiflash 14 | -------------------------------------------------------------------------------- /configs/build: -------------------------------------------------------------------------------- 1 | LBS_GCC_PATH=gcc 2 | LBS_GIT_REMOTE_DEFAULT=origin 3 | LBS_ATF_PATH=atf 4 | LBS_CRUST_PATH=crust 5 | LBS_EDK2_PATH=edk2 6 | LBS_EDK2BASE_PATH=$LBS_EDK2_PATH/edk2 7 | LBS_EDK2PLAT_PATH=$LBS_EDK2_PATH/edk2-platforms 8 | LBS_OPTEE_PATH=optee 9 | LBS_UBOOT_PATH=u-boot 10 | LBS_VENDOR_PATH=vendor 11 | LBS_BR2_PATH=br2 12 | LBS_OUT_PATH=out 13 | -------------------------------------------------------------------------------- /vendor/rockchip/spiflash/rk3328-spiflash.dts: -------------------------------------------------------------------------------- 1 | /dts-v1/; 2 | /plugin/; 3 | 4 | / { 5 | compatible = "rockchip,rk3328"; 6 | 7 | fragment@0 { 8 | target = <&spi0>; 9 | __overlay__ { 10 | status = "okay"; 11 | spiflash@0 { 12 | compatible = "jedec,spi-nor"; 13 | reg = <0>; 14 | spi-max-frequency = <50000000>; 15 | }; 16 | }; 17 | }; 18 | }; 19 | -------------------------------------------------------------------------------- /vendor/rockchip/spiflash/rk3399-spiflash.dts: -------------------------------------------------------------------------------- 1 | /dts-v1/; 2 | /plugin/; 3 | 4 | / { 5 | compatible = "rockchip,rk3399"; 6 | 7 | fragment@0 { 8 | target = <&spi0>; 9 | __overlay__ { 10 | status = "okay"; 11 | spiflash@0 { 12 | compatible = "jedec,spi-nor"; 13 | reg = <0>; 14 | spi-max-frequency = <50000000>; 15 | }; 16 | }; 17 | }; 18 | }; 19 | -------------------------------------------------------------------------------- /configs/all-h3-cc-h5-ums-emmc: -------------------------------------------------------------------------------- 1 | BOARD_NAME=all-h3-cc-h5 2 | 3 | . configs/allwinner-h5 4 | 5 | LBS_CRUST=1 6 | CRUST_TARGET=libretech_all_h3_cc_h5_defconfig 7 | 8 | LBS_OPTEE=0 9 | 10 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 11 | UBOOT_BRANCH=v2024.07/lc-all-h3-cc-h5-ums-emmc 12 | UBOOT_TARGET=libretech_all_h3_cc_h5_defconfig 13 | 14 | . configs/ums-emmc 15 | -------------------------------------------------------------------------------- /configs/all-h3-cc-h5-headend: -------------------------------------------------------------------------------- 1 | BOARD_NAME=all-h3-cc-h5 2 | 3 | . configs/allwinner-h5 4 | 5 | LBS_ATF_LOGLEVEL=10 6 | 7 | LBS_CRUST=1 8 | CRUST_TARGET=libretech_all_h3_cc_h5_headend_defconfig 9 | 10 | LBS_OPTEE=0 11 | 12 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 13 | UBOOT_BRANCH=v2023.07/lc-all-h3-cc-h5 14 | UBOOT_TARGET=libretech_all_h3_cc_h5_headend_defconfig 15 | -------------------------------------------------------------------------------- /configs/aml-s905x-cc-system: -------------------------------------------------------------------------------- 1 | BOARD_NAME=aml-s905x-cc 2 | 3 | . configs/amlogic-gxl 4 | 5 | LBS_OPTEE=0 6 | 7 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 8 | UBOOT_BRANCH=v2023.04/aml-s905x-cc 9 | UBOOT_TARGET=libretech-cc_defconfig 10 | 11 | AML_ENCRYPT=gxl 12 | 13 | BR2_GIT_BRANCH='2023.02.x/amlogic' 14 | BR2_TARGET=aml-s905x-cc_defconfig 15 | 16 | . configs/buildroot 17 | -------------------------------------------------------------------------------- /tools/space.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -z "$1" ]; then 4 | echo "$0 file" >&2 5 | exit 1 6 | fi 7 | 8 | target=$1 9 | 10 | state=0 11 | last=0 12 | set -o noglob 13 | for i in $(hexdump out/aml-a311d-cc | grep "*" -A 1 -B 1 | cut -f 1 -d " "); do 14 | if [ "$i" = "*" ]; then 15 | state=1 16 | elif [ $state -eq 1 ]; then 17 | echo "0x$last 0x$i $((0x$last >> 10))K $((0x$i - 0x$last))" 18 | state=0 19 | else 20 | last=$i 21 | fi 22 | done 23 | -------------------------------------------------------------------------------- /lib/atf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LBS_ATF_get(){ 4 | if [ -d "$LBS_ATF_PATH" ]; then 5 | LBS_GIT_switchBranch "$LBS_ATF_PATH" "$ATF_GIT_BRANCH" 6 | else 7 | git clone --single-branch --depth 1 -b "$ATF_GIT_BRANCH" "$ATF_GIT_URL" "$LBS_ATF_PATH" 8 | fi 9 | } 10 | 11 | LBS_ATF_build(){ 12 | CROSS_COMPILE=$LBS_CC make -C "$LBS_ATF_PATH" distclean 13 | CROSS_COMPILE=$LBS_CC make -C "$LBS_ATF_PATH" -j$(nproc) PLAT=$ATF_PLAT DEBUG=0 LOG_LEVEL=${LBS_ATF_LOGLEVEL:-20} $ATF_TARGET 14 | } 15 | -------------------------------------------------------------------------------- /lib/crust.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LBS_CRUST_get(){ 4 | if [ -d "$LBS_CRUST_PATH" ]; then 5 | LBS_GIT_switchBranch "$LBS_CRUST_PATH" "$CRUST_GIT_BRANCH" 6 | else 7 | git clone --single-branch --depth 1 -b "$CRUST_GIT_BRANCH" "$CRUST_GIT_URL" "$LBS_CRUST_PATH" 8 | fi 9 | } 10 | 11 | LBS_CRUST_build(){ 12 | CROSS_COMPILE=or1k-elf- make -C "$LBS_CRUST_PATH" distclean 13 | CROSS_COMPILE=or1k-elf- make -C "$LBS_CRUST_PATH" $CRUST_TARGET 14 | CROSS_COMPILE=or1k-elf- make -C "$LBS_CRUST_PATH" -j$(nproc) scp 15 | } 16 | -------------------------------------------------------------------------------- /configs/roc-rk3399-pc_optee: -------------------------------------------------------------------------------- 1 | BOARD_NAME=roc-rk3399-pc 2 | 3 | . configs/atf 4 | 5 | ATF_PLAT=rk3399 6 | ATF_TARGET=bl31 7 | ATF_OUTPUT_FILE=bl31/bl31.elf 8 | 9 | LBS_OPTEE=1 10 | 11 | . configs/edk2 12 | 13 | . configs/edk2-platforms 14 | 15 | . configs/optee 16 | 17 | OPTEE_PLAT=rockchip-rk3399 18 | OPTEE_PLATELF_DIR=rockchip 19 | 20 | UBOOT_URL='https://github.com/libre-computer-project/libretech-u-boot.git' 21 | UBOOT_BRANCH=u-boot/v2022.04/roc-rk3399-pc 22 | UBOOT_TARGET=roc-pc-rk3399_optee_defconfig 23 | 24 | . configs/rockchip 25 | 26 | . configs/spiflash 27 | -------------------------------------------------------------------------------- /vendor/amlogic/mbruefi.sh: -------------------------------------------------------------------------------- 1 | sudo mkfs.vfat -F 32 ${loop_dev}p1 2 | local loop_mnt="$(mktemp -d)" 3 | sudo mount ${loop_dev}p1 "$loop_mnt" 4 | sudo cp "$LBS_UBOOT_BIN_FINAL_PATH" "$loop_mnt/u-boot.bin" 5 | sudo cp "$LBS_MBRUEFI_SCRIPT" "$loop_mnt/" 6 | sudo cp "$LBS_DISTROFIX_SCRIPT" "$loop_mnt/" 7 | 8 | df $loop_mnt 9 | sudo umount "$loop_mnt" 10 | sudo dd if="$LBS_UBOOT_BIN_FINAL_PATH" of="$loop_dev" conv=fsync,notrunc bs=512 seek=1 11 | #sudo dd if="$sd" of="$loop_dev" conv=fsync,notrunc bs=446 count=1 12 | #sudo dd if="$sd" of="$loop_dev" conv=fsync,notrunc bs=512 skip=1 seek=1 13 | -------------------------------------------------------------------------------- /vendor/amlogic/spiflash/finalize.sh: -------------------------------------------------------------------------------- 1 | sudo mkfs.vfat ${loop_dev}p1 2 | 3 | local loop_mnt="$(mktemp -d)" 4 | sudo mount ${loop_dev}p1 "$loop_mnt" 5 | 6 | #u-boot binary 7 | sudo cp "$LBS_UBOOT_BIN_FINAL_PATH" "$loop_mnt/u-boot.bin" 8 | sha1sum $LBS_UBOOT_BIN_FINAL_PATH | cut -d " " -f 1 | xxd -r -p | sudo tee "$loop_mnt/u-boot.bin.sha1sum" > /dev/null 9 | 10 | #u-boot script 11 | sudo u-boot/tools/mkimage -A arm -T script -d "$LBS_SPIFLASH_SCRIPT" "$loop_mnt/boot.scr" 12 | 13 | df $loop_mnt 14 | sudo umount "$loop_mnt" 15 | 16 | sudo dd if="$LBS_UBOOT_BIN_FINAL_PATH" of="$loop_dev" conv=fsync,notrunc bs=512 seek=1 17 | -------------------------------------------------------------------------------- /lib/br2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LBS_BR2_OUTPUT_PATH="$LBS_BR2_PATH/output/images" 4 | 5 | LBS_BR2_get(){ 6 | if [ -d "$LBS_BR2_PATH" ]; then 7 | LBS_GIT_switchBranch "$LBS_BR2_PATH" "$BR2_GIT_BRANCH" 8 | else 9 | git clone --single-branch --depth 1 -b "$BR2_GIT_BRANCH" "$BR2_GIT_URL" "$LBS_BR2_PATH" 10 | fi 11 | } 12 | 13 | LBS_BR2_build(){ 14 | #make -C "$LBS_BR2_PATH" clean 15 | make -C "$LBS_BR2_PATH" $BR2_TARGET 16 | mkdir -p "$LBS_BR2_OUTPUT_PATH" 17 | cp "$LBS_UBOOT_BIN_FINAL_PATH" "$LBS_BR2_OUTPUT_PATH/u-boot.bin" 18 | make -C "$LBS_BR2_PATH" 19 | cp "$LBS_BR2_OUTPUT_PATH/sdcard.img" "$LBS_OUT_PATH/$LBS_TARGET" 20 | } 21 | -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if which apt; then 4 | sudo apt install build-essential flex bison python3-setuptools swig python3-dev libssl-dev u-boot-tools python3-pyelftools git libncurses-dev xxd libgnutls28-dev \ 5 | gcc-arm-linux-gnueabihf gcc-arm-none-eabi gcc-or1k-elf gcc-aarch64-linux-gnu efitools 6 | elif which yum; then 7 | sudo yum groupinstall 'Development Tools' 8 | sudo yum install python3-setuptools swig python3-devel openssl-devel uboot-tools python3-pyelftools git ncurses-devel 9 | else 10 | echo "Package manager not supported. Please install build tools, python3-setuptools, python3-dev, python3-pyelftools, openssl-dev, u-boot-tools, swig, and git." 11 | exit 1 12 | fi 13 | -------------------------------------------------------------------------------- /lib/nfs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LBS_NFS_build(){ 4 | if [ ! -d "$LBS_OUT_PATH" ]; then 5 | mkdir -p "$LBS_OUT_PATH" 6 | fi 7 | truncate -s $LBS_NFS_DISK_SIZE "$LBS_OUT_PATH/$LBS_TARGET" 8 | local loop_dev=$(sudo losetup --show -f "$LBS_OUT_PATH/$LBS_TARGET") 9 | sudo fdisk $loop_dev <&2 7 | exit 1 8 | fi 9 | 10 | SCRIPT_DIR=$(dirname "$(readlink -f "$0")") 11 | LOADER="$SCRIPT_DIR/u-boot.bin" 12 | if [ ! -f "$LOADER" ]; then 13 | echo "MBR UEFI Bootloader file not found!" >&2 14 | exit 1 15 | fi 16 | 17 | TARGET="/dev/$1" 18 | if [ ! -b "$TARGET" ]; then 19 | echo "$TARGET is not a block device!" >&2 20 | exit 1 21 | fi 22 | 23 | #TODO check starting sector of first partition 24 | 25 | if [ "$USER" = "root" ]; then 26 | dd if="$SCRIPT_DIR/u-boot.bin" of="$TARGET" conv=fsync,notrunc bs=512 seek=1 27 | else 28 | sudo dd if="$SCRIPT_DIR/u-boot.bin" of="$TARGET" conv=fsync,notrunc bs=512 seek=1 29 | fi -------------------------------------------------------------------------------- /lib/mbruefi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LBS_MBRUEFI_build(){ 4 | if [ ! -d "$LBS_OUT_PATH" ]; then 5 | mkdir -p "$LBS_OUT_PATH" 6 | fi 7 | truncate -s $LBS_MBRUEFI_DISK_SIZE "$LBS_OUT_PATH/$LBS_TARGET" 8 | local loop_dev=$(sudo losetup --show -f "$LBS_OUT_PATH/$LBS_TARGET") 9 | sudo fdisk $loop_dev < /dev/null 9 | sudo cp $(dirname $BASH_SOURCE[0])/$SPI_FLASH_OVERLAY "$loop_mnt" 10 | 11 | #u-boot script 12 | local uboot_script=$(mktemp) 13 | cat "$LBS_SPIFLASH_SCRIPT" | sed "s/%SPI_FLASH_OVERLAY%/$SPI_FLASH_OVERLAY/" | sed "s/%SPI_OF_NODE%/${SPI_OF_NODE//\//\\\/}/" | sed "s/%SPI_DRIVER%/$SPI_DRIVER/" | dd of=$uboot_script 14 | sudo u-boot/tools/mkimage -A arm -T script -d "$uboot_script" "$loop_mnt/boot.scr" 15 | rm $uboot_script 16 | 17 | 18 | df $loop_mnt 19 | sudo umount "$loop_mnt" 20 | 21 | sudo dd if="$LBS_UBOOT_BIN_FINAL_PATH" of="$loop_dev" conv=fsync,notrunc bs=512 seek=64 22 | -------------------------------------------------------------------------------- /vendor/rockchip/ums-emmc/finalize.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | case "$BOARD_NAME" in 4 | roc-rk3328-*) 5 | RK_BOOT_MERGER_NAME=RK320C 6 | ;; 7 | roc-rk3399-*) 8 | RK_BOOT_MERGER_NAME=RK330C 9 | ;; 10 | *) 11 | 12 | ;; 13 | esac 14 | 15 | cp $LBS_UBOOT_PATH/spl/u-boot-spl.bin $LBS_UBOOT_PATH/u-boot-spl-itb.bin 16 | truncate -s 512K $LBS_UBOOT_PATH/u-boot-spl-itb.bin 17 | cat $LBS_UBOOT_PATH/u-boot.itb >> $LBS_UBOOT_PATH/u-boot-spl-itb.bin 18 | 19 | RK_BOOT_MERGER_INI=$(mktemp --suffix=.ini) 20 | cat < $RK_BOOT_MERGER_INI 21 | [CHIP_NAME] 22 | NAME=$RK_BOOT_MERGER_NAME 23 | [VERSION] 24 | MAJOR=1 25 | MINOR=30 26 | [CODE471_OPTION] 27 | NUM=1 28 | Path1=$LBS_UBOOT_PATH/tpl/u-boot-tpl.bin 29 | Sleep=1 30 | [CODE472_OPTION] 31 | NUM=1 32 | Path1=$LBS_UBOOT_PATH/u-boot-spl-itb.bin 33 | [LOADER_OPTION] 34 | NUM=2 35 | LOADER1=FlashData 36 | LOADER2=FlashBoot 37 | FlashData=$LBS_UBOOT_PATH/tpl/u-boot-tpl.bin 38 | FlashBoot=$LBS_UBOOT_PATH/u-boot-spl-itb.bin 39 | [OUTPUT] 40 | PATH=$LBS_OUT_PATH/$LBS_TARGET 41 | EOF 42 | 43 | $LBS_VENDOR_PATH/$VENDOR_PATH/bin/boot_merger "$RK_BOOT_MERGER_INI" 44 | rm $RK_BOOT_MERGER_INI 45 | -------------------------------------------------------------------------------- /lib/edk2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LBS_EDK2_get(){ 4 | mkdir -p "$LBS_EDK2_PATH" 5 | if [ -d "$LBS_EDK2BASE_PATH" ]; then 6 | LBS_GIT_switchBranch "$LBS_EDK2BASE_PATH" "$EDK2_GIT_BRANCH" 7 | else 8 | git clone --single-branch --depth 1 -b "$EDK2_GIT_BRANCH" "$EDK2_GIT_URL" "$LBS_EDK2BASE_PATH" 9 | fi 10 | if [ -d "$LBS_EDK2PLAT_PATH" ]; then 11 | LBS_GIT_switchBranch "$LBS_EDK2PLAT_PATH" "$EDK2PLAT_GIT_BRANCH" 12 | else 13 | git clone --single-branch --depth 1 -b "$EDK2PLAT_GIT_BRANCH" "$EDK2PLAT_GIT_URL" "$LBS_EDK2PLAT_PATH" 14 | fi 15 | git -C "$LBS_EDK2BASE_PATH" submodule init 16 | git -C "$LBS_EDK2BASE_PATH" submodule update --init --recursive --single-branch --depth 1 17 | } 18 | 19 | LBS_EDK2_build(){ 20 | LBS_EDK2BASE_PATH_ABS="$(readlink -f $LBS_EDK2BASE_PATH)" 21 | LBS_EDK2PLAT_PATH_ABS="$(readlink -f $LBS_EDK2PLAT_PATH)" 22 | cd "$LBS_EDK2_PATH" 23 | export WORKSPACE="$PWD" 24 | export PACKAGES_PATH="$LBS_EDK2BASE_PATH_ABS:$LBS_EDK2PLAT_PATH_ABS" 25 | export ACTIVE_PLATFORM="Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc" 26 | export GCC5_AARCH64_PREFIX=aarch64-linux-gnu- 27 | . "$LBS_EDK2BASE_PATH_ABS/edksetup.sh" 28 | make -C "$LBS_EDK2BASE_PATH_ABS/BaseTools" 29 | build -p $ACTIVE_PLATFORM -b RELEASE -a AARCH64 -t GCC5 -n `nproc` 30 | cd "$OLDPWD" 31 | } 32 | -------------------------------------------------------------------------------- /lib/git.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LBS_GIT_switchBranch(){ 4 | local path_tar="$1" 5 | local branch_tar="$2" 6 | local branch_cur=$(git -C "$path_tar" branch --show-current) 7 | if [ "$branch_cur" = "" ]; then 8 | echo "$FUNCNAME not switching due to bisect." 9 | elif [ "$branch_cur" != "$branch_tar" ]; then 10 | #check for modified tracked 11 | local files_unc=$(git -C "$path_tar" status -s | grep -v '^??') 12 | if [ ! -z "$files_unc" ]; then 13 | echo "$FUNCNAME cannot switch branch when there are uncommited files." 14 | return 1 15 | fi 16 | local branch_exist=$(git -C "$path_tar" branch --list "$branch_tar") 17 | if [ -z "$branch_exist" ]; then 18 | if [ -z "$LBS_GIT_REMOTE_OVERRIDE" ]; then 19 | git -C "$path_tar" fetch --depth=1 "$LBS_GIT_REMOTE_DEFAULT" "$branch_tar" 20 | else 21 | for lbs_git_remote_override in $LBS_GIT_REMOTE_OVERRIDE; do 22 | if [ "$lbs_git_remote_override" = "$path_tar" ]; then 23 | local git_remote_var="${path_tar//-/}_GIT_REMOTE" 24 | declare -n git_remote=${git_remote_var^^} 25 | if ! git -C "$path_tar" remote show "$git_remote"; then 26 | local git_url_var="${path_tar//-/}_GIT_URL" 27 | declare -n git_url=${git_url_var^^} 28 | git -C "$path_tar" remote add "$git_remote" "$git_url" 29 | fi 30 | git -C "$path_tar" fetch --depth=1 "$git_remote" "$branch_tar" 31 | fi 32 | done 33 | fi 34 | git -C "$path_tar" checkout -b "$branch_tar" FETCH_HEAD 35 | else 36 | git -C "$path_tar" checkout "$branch_tar" 37 | fi 38 | fi 39 | } 40 | -------------------------------------------------------------------------------- /vendor/amlogic/gxlimg.sh: -------------------------------------------------------------------------------- 1 | LBS_VENDOR_finalize(){ 2 | LBS_VENDOR_GXLIMG_get 3 | LBS_VENDOR_GXLIMG_sign 4 | } 5 | 6 | LBS_VENDOR_AMLOGIC_PATH="$LBS_VENDOR_PATH/$VENDOR_PATH/blx" 7 | LBS_VENDOR_GXLIMG_PATH="$LBS_VENDOR_PATH/$VENDOR_PATH/gxlimg" 8 | 9 | LBS_VENDOR_GXLIMG_get(){ 10 | if [ ! -d "$LBS_VENDOR_AMLOGIC_PATH" ]; then 11 | git clone --depth=1 --single-branch "https://github.com/libre-computer-project/libretech-amlogic-blx.git" "$LBS_VENDOR_AMLOGIC_PATH" 12 | fi 13 | if [ ! -d "$LBS_VENDOR_GXLIMG_PATH" ]; then 14 | git clone --depth=1 --single-branch "https://github.com/repk/gxlimg.git" "$LBS_VENDOR_GXLIMG_PATH" 15 | make -C "$LBS_VENDOR_GXLIMG_PATH" 16 | fi 17 | } 18 | 19 | LBS_VENDOR_GXLIMG_sign(){ 20 | $LBS_VENDOR_GXLIMG_PATH/gxlimg -t bl2 -s "$blx_path"/$BOARD_NAME/bl2_new.bin "$blx_path"/$BOARD_NAME/bl2.bin.enc 21 | $LBS_VENDOR_GXLIMG_PATH/gxlimg -t bl3x -c "$blx_path"/$BOARD_NAME/bl30_new.bin "$blx_path"/$BOARD_NAME/bl30.bin.enc 22 | #$LBS_VENDOR_GXLIMG_PATH/gxlimg -t bl3x -c "$blx_path"/$BOARD_NAME/bl31.img "$blx_path"/$BOARD_NAME/bl31.img.enc 23 | $LBS_VENDOR_GXLIMG_PATH/gxlimg -t bl3x -c "$BL31" "$blx_path"/$BOARD_NAME/bl31.img.enc 24 | $LBS_VENDOR_GXLIMG_PATH/gxlimg -t bl3x -c "$LBS_UBOOT_PATH"/u-boot.bin "$LBS_UBOOT_PATH"/u-boot.bin.enc 25 | #$LBS_VENDOR_GXLIMG_PATH/gxlimg -t fip --bl2 "$blx_path"/$BOARD_NAME/bl2.bin.enc --bl30 "$blx_path"/$BOARD_NAME/bl30.bin.enc --bl31 "$blx_path"/$BOARD_NAME/bl31.img.enc --bl33 "$LBS_UBOOT_PATH"/u-boot.bin.enc "$LBS_UBOOT_PATH"/u-boot-amlogic.bin 26 | $LBS_VENDOR_GXLIMG_PATH/gxlimg -t fip --bl2 "$blx_path"/$BOARD_NAME/bl2.bin.enc --bl30 "$blx_path"/$BOARD_NAME/bl30.bin.enc --bl31 "$blx_path"/$BOARD_NAME/bl31.img.enc --bl33 "$LBS_UBOOT_PATH"/u-boot.bin.enc "$LBS_UBOOT_BIN_FINAL_PATH" 27 | dd if="$LBS_UBOOT_BIN_FINAL_PATH" of="$LBS_UBOOT_PATH/u-boot-amlogic.usb.bl2" bs=49152 count=1 28 | dd if="$LBS_UBOOT_BIN_FINAL_PATH" of="$LBS_UBOOT_PATH/u-boot-amlogic.usb.tpl" skip=49152 bs=1 29 | 30 | } 31 | -------------------------------------------------------------------------------- /lib/u-boot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LBS_UBOOT_get(){ 4 | if [ -d "$LBS_UBOOT_PATH" ]; then 5 | LBS_GIT_switchBranch "$LBS_UBOOT_PATH" "$UBOOT_BRANCH" 6 | else 7 | git clone --single-branch --depth 1 -b "$UBOOT_BRANCH" "$UBOOT_URL" "$LBS_UBOOT_PATH" 8 | fi 9 | } 10 | 11 | LBS_UBOOT_checkConfig(){ 12 | echo $PWD 13 | if [ ! -z "$LBS_UBOOT_CFGCHECK" ]; then 14 | while read -r line; do 15 | grep "^$line" $1 16 | done < vendor/libre-computer/u-boot_configs 17 | fi 18 | } 19 | 20 | LBS_UBOOT_build(){ 21 | if [ "$LBS_ATF" -eq 1 ]; then 22 | BL31="$(readlink -f $LBS_ATF_PATH)"/build/$ATF_PLAT/release/$ATF_OUTPUT_FILE 23 | if [ ! -f "$BL31" ]; then 24 | echo "$FUNCNAME BL31 missing?" 25 | exit 1 26 | fi 27 | export BL31 28 | fi 29 | if [ "$LBS_CRUST" -eq 1 ]; then 30 | SCP="$(readlink -f "$LBS_CRUST_PATH")"/build/scp/scp.bin 31 | if [ ! -f "$SCP" ]; then 32 | echo "$FUNCNAME SCP missing?" 33 | exit 1 34 | fi 35 | export SCP 36 | fi 37 | if [ "$LBS_OPTEE" -eq 1 ]; then 38 | TEE="$(readlink -f "$LBS_OPTEE_PATH")"/out/arm-plat-$OPTEE_PLATELF_DIR/core/tee.elf 39 | if [ ! -f "$TEE" ]; then 40 | echo "$FUNCNAME TEE missing?" 41 | exit 1 42 | fi 43 | export TEE 44 | fi 45 | CROSS_COMPILE=$LBS_CC make -C "$LBS_UBOOT_PATH" distclean 46 | CROSS_COMPILE=$LBS_CC make -C "$LBS_UBOOT_PATH" -j$(nproc) $UBOOT_TARGET 47 | if [ ! -z "$LBS_UBOOT_MENUCONFIG" ]; then 48 | while true; do 49 | CROSS_COMPILE=$LBS_CC make -C "$LBS_UBOOT_PATH" -j$(nproc) menuconfig 50 | read -n 1 -p "$FUNCNAME save config to defconfig? (y/N)" save 51 | if [ "${save,,}" = y ]; then 52 | CROSS_COMPILE=$LBS_CC make -C "$LBS_UBOOT_PATH" -j$(nproc) savedefconfig 53 | mv "$LBS_UBOOT_PATH"/defconfig "$LBS_UBOOT_PATH"/configs/$UBOOT_TARGET 54 | fi 55 | read -n 1 -p "$FUNCNAME again?" again 56 | if [ "${again,,}" != "y" ]; then 57 | break; 58 | fi 59 | done 60 | fi 61 | LBS_UBOOT_checkConfig "$LBS_UBOOT_PATH"/.config 62 | CROSS_COMPILE=$LBS_CC make -C "$LBS_UBOOT_PATH" -j$(nproc) 63 | } 64 | -------------------------------------------------------------------------------- /vendor/amlogic/spiflash/u-boot.cmd: -------------------------------------------------------------------------------- 1 | env set stop "while true; do sleep 1; done" 2 | env set firmware "u-boot.bin" 3 | 4 | if test $devtype = "usb_mass_storage"; then 5 | env set devtype usb 6 | fi 7 | 8 | env print 9 | 10 | fdt addr $fdtcontroladdr 11 | if fdt list /soc/bus@ffd00000/spi@14000; then 12 | if bind /soc/bus@ffd00000/spi@14000 meson_spifc; then 13 | echo "SPIFC driver bound" 14 | else 15 | echo "ERROR: SPIFC driver bind failed!" 16 | run stop 17 | exit 18 | fi 19 | fi 20 | 21 | if sf probe; then 22 | echo "SPI NOR found" 23 | else 24 | echo "ERROR: SPI NOR not found!" 25 | run stop 26 | exit 27 | fi 28 | 29 | if load $devtype $devnum $ramdisk_addr_r ${firmware}.sha1sum; then 30 | echo "Firmware checksum loaded" 31 | else 32 | echo "ERROR: Firmware checksum load failed!" 33 | run stop 34 | exit 35 | fi 36 | 37 | if load $devtype $devnum $kernel_addr_r $firmware; then 38 | echo "Firmware loaded" 39 | else 40 | echo "ERROR: Firmware load failed!" 41 | run stop 42 | exit 43 | fi 44 | 45 | if hash -v sha1 $kernel_addr_r $filesize *$ramdisk_addr_r; then 46 | echo "Checksum verified" 47 | else 48 | hash sha1 $kernel_addr_r $filesize *$kernel_addr_r 49 | if cmp.l $kernel_addr_r $ramdisk_addr_r 5; then 50 | echo "Checksum verified" 51 | else 52 | echo "ERROR: Checksum failed!" 53 | run stop 54 | exit 55 | fi 56 | fi 57 | 58 | if sf update $kernel_addr_r 0 $filesize; then 59 | echo "Firmware updated" 60 | else 61 | echo "ERROR: Firmware update failed!" 62 | run stop 63 | exit 64 | fi 65 | 66 | if sf read $kernel_addr_r 0 $filesize; then 67 | echo "Firmware read" 68 | else 69 | echo "ERROR: Firmware read failed!" 70 | run stop 71 | exit 72 | fi 73 | 74 | if hash -v sha1 $kernel_addr_r $filesize *$ramdisk_addr_r; then 75 | echo "Firmware checksum match" 76 | else 77 | hash sha1 $kernel_addr_r $filesize *$kernel_addr_r 78 | if cmp.l $kernel_addr_r $ramdisk_addr_r 5; then 79 | echo "Checksum verified" 80 | else 81 | echo "ERROR: Firmware checksum do not match!" 82 | run stop 83 | exit 84 | fi 85 | fi 86 | 87 | echo Flash Completed 88 | run stop 89 | poweroff 90 | -------------------------------------------------------------------------------- /lib/gcc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LBS_GCC_download(){ 4 | if [ ! -d "$LBS_GCC_PATH" ]; then 5 | mkdir -p "$LBS_GCC_PATH" 6 | fi 7 | cd "$LBS_GCC_PATH" 8 | if [ ! -d "gcc-linaro-7.5.0-2019.12-x86_64_aarch64-elf" ]; then 9 | wget "https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-elf/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-elf.tar.xz" 10 | tar -xf gcc-linaro-7.5.0-2019.12-x86_64_aarch64-elf.tar.xz 11 | fi 12 | if [ ! -d "gcc-arm-none-eabi-7-2018-q2-update" ]; then 13 | wget --content-disposition "https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2?revision=bc2c96c0-14b5-4bb4-9f18-bceb4050fee7?product=GNU%20Arm%20Embedded%20Toolchain,64-bit,,Linux,7-2018-q2-update" 14 | tar -xf gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2 15 | fi 16 | if [ ! -d "gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu" ]; then 17 | wget "https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz" 18 | tar -xf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz 19 | fi 20 | if [ "$LBS_CRUST" -eq 1 ]; then 21 | if [ ! -d "or1k-linux-musl-cross" ]; then 22 | wget "http://musl.cc/or1k-linux-musl-cross.tgz" 23 | tar -xf or1k-linux-musl-cross.tgz 24 | fi 25 | fi 26 | if [ "$LBS_OPTEE" -eq 1 ]; then 27 | if [ ! -d "gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf" ]; then 28 | wget "https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/arm-linux-gnueabihf/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz" 29 | tar -xf gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz 30 | fi 31 | fi 32 | cd "$OLDPWD" 33 | } 34 | 35 | LBS_GCC_exportPATH(){ 36 | cd "$LBS_GCC_PATH" 37 | if [ "$LBS_ARCH" = "arm64" ]; then 38 | export PATH=$PWD/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-elf/bin:$PATH 39 | export PATH=$PWD/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin:$PATH 40 | fi 41 | export PATH=$PWD/gcc-arm-none-eabi-7-2018-q2-update/bin:$PATH 42 | if [ "$LBS_CRUST" -eq 1 ]; then 43 | export PATH=$PWD/or1k-linux-musl-cross/bin:$PATH 44 | fi 45 | if [ "$LBS_OPTEE" -eq 1 ]; then 46 | export PATH=$PWD/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf/bin:$PATH 47 | fi 48 | cd "$OLDPWD" 49 | } 50 | -------------------------------------------------------------------------------- /vendor/rockchip/spiflash/u-boot.cmd: -------------------------------------------------------------------------------- 1 | env set stop "while true; do sleep 1; done" 2 | env set firmware "u-boot-rockchip-spi.bin" 3 | env set spi_flash_overlay "%SPI_FLASH_OVERLAY%" 4 | env set spi_of_node "%SPI_OF_NODE%" 5 | env set spi_driver "%SPI_DRIVER%" 6 | 7 | if test $devtype = "usb_mass_storage"; then 8 | env set devtype usb 9 | fi 10 | 11 | env print 12 | 13 | fdt addr $fdtcontroladdr 14 | if fdt list $spi_of_node; then 15 | if load $devtype $devnum $kernel_addr_r $spi_flash_overlay; then 16 | fdt apply $kernel_addr_r 17 | echo "SPI FLASH overlay applied" 18 | else 19 | echo "ERROR: SPI FLASH overlay failed!" 20 | run stop 21 | exit 22 | fi 23 | if bind $spi_of_node $spi_driver; then 24 | echo "SPI driver bound" 25 | else 26 | echo "ERROR: SPI driver bind failed!" 27 | run stop 28 | exit 29 | fi 30 | fi 31 | 32 | if sf probe; then 33 | echo "SPI NOR found" 34 | else 35 | echo "ERROR: SPI NOR not found!" 36 | run stop 37 | exit 38 | fi 39 | 40 | if load $devtype $devnum $ramdisk_addr_r ${firmware}.sha1sum; then 41 | echo "Firmware checksum loaded" 42 | else 43 | echo "ERROR: Firmware checksum load failed!" 44 | run stop 45 | exit 46 | fi 47 | 48 | if load $devtype $devnum $kernel_addr_r $firmware; then 49 | echo "Firmware loaded" 50 | else 51 | echo "ERROR: Firmware load failed!" 52 | run stop 53 | exit 54 | fi 55 | 56 | if hash -v sha1 $kernel_addr_r $filesize *$ramdisk_addr_r; then 57 | echo "Checksum verified" 58 | else 59 | hash sha1 $kernel_addr_r $filesize *$kernel_addr_r 60 | if cmp.l $kernel_addr_r $ramdisk_addr_r 5; then 61 | echo "Checksum verified" 62 | else 63 | echo "ERROR: Checksum failed!" 64 | run stop 65 | exit 66 | fi 67 | fi 68 | 69 | if sf update $kernel_addr_r 0 $filesize; then 70 | echo "Firmware updated" 71 | else 72 | echo "ERROR: Firmware update failed!" 73 | run stop 74 | exit 75 | fi 76 | 77 | if sf read $kernel_addr_r 0 $filesize; then 78 | echo "Firmware read" 79 | else 80 | echo "ERROR: Firmware read failed!" 81 | run stop 82 | exit 83 | fi 84 | 85 | if hash -v sha1 $kernel_addr_r $filesize *$ramdisk_addr_r; then 86 | echo "Firmware checksum match" 87 | else 88 | hash sha1 $kernel_addr_r $filesize *$kernel_addr_r 89 | if cmp.l $kernel_addr_r $ramdisk_addr_r 5; then 90 | echo "Checksum verified" 91 | else 92 | echo "ERROR: Firmware checksum do not match!" 93 | run stop 94 | exit 95 | fi 96 | fi 97 | 98 | echo Flash Completed 99 | run stop 100 | poweroff 101 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # libretech-builder-simple 2 | 3 | ## Purpose 4 | 5 | Builds bootloaders for Libre Computer boards. 6 | 7 | ## Prerequisites 8 | 9 | Linux machine or virtual machine 10 | 11 | ## Usage 12 | 13 | ``` 14 | #install pre-requisites via apt or yum 15 | sudo ./setup.sh 16 | 17 | git clone --single-branch --depth 1 https://github.com/libre-computer-project/libretech-builder-simple.git 18 | 19 | ./build.sh BOARD_TARGET 20 | ``` 21 | 22 | ## Board Targets 23 | 24 | * all-h3-cc-h3 25 | * all-h3-cc-h5 26 | * aml-s805x-ac 27 | * aml-s905x-cc 28 | * aml-s905x-cc-v2 29 | * aml-s905d-pc 30 | * roc-rk3328-cc 31 | * roc-rk3399-pc 32 | 33 | ## Bootloader Flashing 34 | 35 | Default output directory is out/ and is set by LBS_OUT_PATH in configs/build. 36 | 37 | Output bootloader needs to be written to the [bootloader offset disk sector](https://github.com/libre-computer-project/libretech-flash-tool/blob/master/lib/bootloader.sh#L5). 38 | 39 | `sudo dd if=out/BOARD_TARGET of=/dev/null bs=512 seek=BOOTLOADER_OFFSET` 40 | 41 | Replace "BOARD_TARGET", "null", "BOOTLOADER_OFFSET" with the proper file, block device, and bootloader offset respectively. **Be careful not to overwrite the wrong block device!** 42 | 43 | ### Bootloader Flashing to SPI 44 | 45 | For boards with SPI NOR, there is a separate board bootloader target ending with -spiflash. 46 | To flash SPI NOR, dump the output image to a MMC device and the board will boot and flash the SPI NOR. 47 | 48 | `sudo dd if=out/BOARD_TARGET-spiflash of=/dev/null bs=1M` 49 | 50 | ## Advanced Configuration 51 | 52 | ### u-boot 53 | ``` 54 | #To configure u-boot, set LBS_UBOOT_MENUCONFIG=1. 55 | LBS_UBOOT_MENUCONFIG=1 ./build.sh BOARD_TARGET 56 | ``` 57 | 58 | ### Amlogic 59 | 60 | Amlogic ATF is not open source so pre-compiled binaries for specific boards are [available in this repository](https://github.com/libre-computer-project/libretech-amlogic-blx.git). 61 | 62 | There is an open source implementation of BL31 available in the upstream ATF repository. It can be enabled by changing the `AML_ENCRYPT=gxl` to `AML_GXLIMG=1` in the board configuration file. 63 | 64 | ## More Information 65 | 66 | ### ARM Trusted Firmware 67 | [ARM Trusted Firmware Documentation](https://trustedfirmware-a.readthedocs.io/en/latest/plat/index.html) 68 | [ARM Trusted Firmware Design](https://trustedfirmware-a.readthedocs.io/en/latest/design/firmware-design.html) 69 | 70 | ### U-Boot 71 | [U-Boot Documentation](https://u-boot.readthedocs.io/en/latest/board/index.html) 72 | [U-Boot Usage](https://u-boot.readthedocs.io/en/latest/usage/index.html) 73 | 74 | ### OPTEE 75 | [StandAloneMM from EDK2 in OPTEE OS](https://optee.readthedocs.io/en/latest/building/efi_vars/stmm.html) 76 | 77 | -------------------------------------------------------------------------------- /vendor/amlogic/encrypt.sh: -------------------------------------------------------------------------------- 1 | LBS_VENDOR_finalize(){ 2 | LBS_VENDOR_AMLOGIC_get 3 | LBS_VENDOR_AMLOGIC_sign 4 | } 5 | 6 | LBS_VENDOR_AMLOGIC_PATH="$LBS_VENDOR_PATH/$VENDOR_PATH/blx" 7 | 8 | LBS_VENDOR_AMLOGIC_get(){ 9 | if [ ! -d "$LBS_VENDOR_AMLOGIC_PATH" ]; then 10 | git clone --depth=1 --single-branch "https://github.com/libre-computer-project/libretech-amlogic-blx.git" "$LBS_VENDOR_AMLOGIC_PATH" 11 | fi 12 | } 13 | 14 | LBS_VENDOR_AMLOGIC_sign(){ 15 | local encrypt_path="$LBS_VENDOR_AMLOGIC_PATH/aml_encrypt_${AML_ENCRYPT}" 16 | if [ "$AML_ENCRYPT" = "gxl" ]; then 17 | $encrypt_path --bl3enc --input "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl30_new.bin --output "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl30.bin.enc 18 | $encrypt_path --bl3enc --input "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl31.img --output "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl31.img.enc 19 | $encrypt_path --bl3enc --input "$LBS_UBOOT_PATH"/u-boot.bin --output "$LBS_UBOOT_PATH"/u-boot.bin.enc --compress lz4 20 | $encrypt_path --bl2sig --input "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl2_new.bin --output "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl2.bin.enc 21 | $encrypt_path --bootmk --output "$LBS_UBOOT_BIN_FINAL_PATH" \ 22 | --bl2 "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl2.bin.enc \ 23 | --bl30 "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl30.bin.enc \ 24 | --bl31 "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl31.img.enc \ 25 | --bl33 "$LBS_UBOOT_PATH"/u-boot.bin.enc 26 | elif [ "$AML_ENCRYPT" = "g12a" ] || [ "$AML_ENCRYPT" = "g12b" ]; then 27 | $encrypt_path --bl30sig --input "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl30_new.bin --output "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl30_new.bin.g12.enc --level v3 28 | $encrypt_path --bl3sig --input "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl30_new.bin.g12.enc --output "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl30_new.bin.enc --level v3 --type bl30 29 | $encrypt_path --bl3sig --input "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl31.img --output "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl31.img.enc --level v3 --type bl31 30 | $encrypt_path --bl3sig --input "$LBS_UBOOT_PATH"/u-boot.bin --compress lz4 --output "$LBS_UBOOT_PATH"/u-boot.bin.enc --level v3 --type bl33 31 | $encrypt_path --bl2sig --input "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl2_new.bin --output "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl2.n.bin.sig 32 | $encrypt_path --bootmk --output "$LBS_UBOOT_BIN_FINAL_PATH" \ 33 | --bl2 "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl2.n.bin.sig \ 34 | --bl30 "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl30_new.bin.enc \ 35 | --bl31 "$LBS_VENDOR_AMLOGIC_PATH"/$BOARD_NAME/bl31.img.enc \ 36 | --bl33 "$LBS_UBOOT_PATH"/u-boot.bin.enc \ 37 | --ddrfw1 "$LBS_VENDOR_AMLOGIC_PATH"/init/"$AML_ENCRYPT"/piei.fw \ 38 | --ddrfw2 "$LBS_VENDOR_AMLOGIC_PATH"/init/"$AML_ENCRYPT"/lpddr4_1d.fw \ 39 | --ddrfw3 "$LBS_VENDOR_AMLOGIC_PATH"/init/"$AML_ENCRYPT"/lpddr4_2d.fw \ 40 | --ddrfw4 "$LBS_VENDOR_AMLOGIC_PATH"/init/"$AML_ENCRYPT"/aml_ddr.fw \ 41 | --level v3 42 | 43 | #--ddrfw4 "$LBS_VENDOR_AMLOGIC_PATH"/init/"$AML_ENCRYPT"/diag_lpddr4.fw \ 44 | #--ddrfw1 "$LBS_VENDOR_AMLOGIC_PATH"/init/"$AML_ENCRYPT"/ddr4_1d.fw \ 45 | #--ddrfw2 "$LBS_VENDOR_AMLOGIC_PATH"/init/"$AML_ENCRYPT"/ddr4_2d.fw \ 46 | #--ddrfw3 "$LBS_VENDOR_AMLOGIC_PATH"/init/"$AML_ENCRYPT"/ddr3_1d.fw \ 47 | else 48 | echo "Unknown Amlogic Platform" >&2 49 | return 1 50 | fi 51 | 52 | dd if="$LBS_UBOOT_BIN_FINAL_PATH" of="$LBS_OUT_PATH/$LBS_TARGET.usb.bl2" bs=49152 count=1 53 | dd if="$LBS_UBOOT_BIN_FINAL_PATH" of="$LBS_OUT_PATH/$LBS_TARGET.usb.tpl" skip=49152 bs=1 54 | } 55 | -------------------------------------------------------------------------------- /vendor/libre-computer/u-boot_configs: -------------------------------------------------------------------------------- 1 | CONFIG_ARM=y 2 | CONFIG_ENV_SIZE=0x10000 3 | CONFIG_ARMV8_CRYPTO=y 4 | # CONFIG_LOCALVERSION_AUTO is not set 5 | CONFIG_LTO=y 6 | CONFIG_BOOTSTD_FULL=y 7 | CONFIG_BOOTSTD_BOOTCOMMAND=y 8 | # CONFIG_BOOTMETH_VBE is not set 9 | CONFIG_BOOTDELAY=1 10 | CONFIG_BOOTCOMMAND="run distro_bootcmd" 11 | CONFIG_USE_PREBOOT=y 12 | # CONFIG_SYS_CONSOLE_ENV_OVERWRITE is not set 13 | CONFIG_DISPLAY_BOARDINFO_LATE=y 14 | CONFIG_CMD_BOOTZ=y 15 | # CONFIG_BOOTM_PLAN9 is not set 16 | # CONFIG_BOOTM_RTEMS is not set 17 | # CONFIG_BOOTM_VXWORKS is not set 18 | CONFIG_CMD_BOOTEFI_SELFTEST=y 19 | CONFIG_CMD_BOOTMENU=y 20 | CONFIG_CMD_ASKENV=y 21 | CONFIG_CMD_GREPENV=y 22 | CONFIG_CMD_ERASEENV=y 23 | CONFIG_CMD_ENV_CALLBACK=y 24 | CONFIG_CMD_ENV_FLAGS=y 25 | CONFIG_CMD_NVEDIT_EFI=y 26 | CONFIG_CMD_NVEDIT_INDIRECT=y 27 | CONFIG_CMD_NVEDIT_INFO=y 28 | CONFIG_CMD_NVEDIT_LOAD=y 29 | CONFIG_CMD_NVEDIT_SELECT=y 30 | CONFIG_CMD_BINOP=y 31 | CONFIG_CRC32_VERIFY=y 32 | CONFIG_CMD_MD5SUM=y 33 | CONFIG_MD5SUM_VERIFY=y 34 | CONFIG_CMD_MEMINFO=y 35 | CONFIG_CMD_MX_CYCLIC=y 36 | CONFIG_CMD_SHA1SUM=y 37 | CONFIG_SHA1SUM_VERIFY=y 38 | CONFIG_CMD_STRINGS=y 39 | CONFIG_CMD_BIND=y 40 | CONFIG_CMD_CLK=y 41 | CONFIG_CMD_DFU=y 42 | CONFIG_CMD_GPIO=y 43 | CONFIG_CMD_GPT=y 44 | CONFIG_CMD_I2C=y 45 | CONFIG_CMD_LSBLK=y 46 | CONFIG_CMD_MBR=y 47 | CONFIG_CMD_MMC=y 48 | CONFIG_CMD_MMC_SWRITE=y 49 | CONFIG_CMD_CLONE=y 50 | CONFIG_CMD_READ=y 51 | CONFIG_CMD_SPI=y 52 | CONFIG_CMD_USB=y 53 | CONFIG_CMD_USB_MASS_STORAGE=y 54 | CONFIG_CMD_SETEXPR_FMT=y 55 | CONFIG_BOOTP_NTPSERVER=y 56 | CONFIG_BOOTP_TIMEOFFSET=y 57 | CONFIG_CMD_SNTP=y 58 | CONFIG_CMD_DNS=y 59 | CONFIG_CMD_LINK_LOCAL=y 60 | CONFIG_CMD_BMP=y 61 | CONFIG_CMD_CLS=y 62 | CONFIG_CMD_EFIDEBUG=y 63 | CONFIG_CMD_TIME=y 64 | CONFIG_CMD_GETTIME=y 65 | CONFIG_CMD_RNG=y 66 | CONFIG_CMD_KASLRSEED=y 67 | CONFIG_CMD_UUID=y 68 | CONFIG_CMD_PMIC=y 69 | CONFIG_CMD_REGULATOR=y 70 | CONFIG_CMD_AES=y 71 | CONFIG_CMD_HASH=y 72 | CONFIG_HASH_VERIFY=y 73 | CONFIG_CMD_BTRFS=y 74 | CONFIG_CMD_EROFS=y 75 | CONFIG_CMD_SQUASHFS=y 76 | CONFIG_CMD_FS_UUID=y 77 | CONFIG_ENV_IS_IN_FAT=y 78 | CONFIG_ENV_FAT_DEVICE_AND_PART="0:auto" 79 | CONFIG_SYS_RELOC_GD_ENV_ADDR=y 80 | CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y 81 | CONFIG_NET_RANDOM_ETHADDR=y 82 | CONFIG_LBA48=y 83 | CONFIG_SYS_64BIT_LBA=y 84 | CONFIG_BUTTON=y 85 | CONFIG_BUTTON_ADC=y 86 | CONFIG_BUTTON_GPIO=y 87 | CONFIG_DFU_SF=y 88 | CONFIG_FASTBOOT_MMC_BOOT_SUPPORT=y 89 | CONFIG_FASTBOOT_MMC_USER_SUPPORT=y 90 | CONFIG_FASTBOOT_CMD_OEM_FORMAT=y 91 | CONFIG_LED=y 92 | CONFIG_LED_GPIO=y 93 | CONFIG_MISC=y 94 | CONFIG_PWRSEQ=y 95 | CONFIG_MMC_PWRSEQ=y 96 | CONFIG_SUPPORT_EMMC_RPMB=y 97 | CONFIG_SUPPORT_EMMC_BOOT=y 98 | CONFIG_MMC_IO_VOLTAGE=y 99 | CONFIG_MMC_UHS_SUPPORT=y 100 | CONFIG_DM_RESET=y 101 | CONFIG_DM_RNG=y 102 | CONFIG_BAUDRATE=1500000 103 | CONFIG_DEBUG_UART_SHIFT=2 104 | CONFIG_SYSINFO=y 105 | CONFIG_SYSINFO_SMBIOS=y 106 | CONFIG_SYSRESET=y 107 | CONFIG_SYSRESET_CMD_POWEROFF=y 108 | CONFIG_USB=y 109 | CONFIG_USB_KEYBOARD=y 110 | CONFIG_USB_GADGET=y 111 | CONFIG_USB_GADGET_MANUFACTURER="Libre Computer" 112 | CONFIG_USB_GADGET_VBUS_DRAW=500 113 | CONFIG_DM_VIDEO=y 114 | CONFIG_VIDEO_LOGO=y 115 | CONFIG_DISPLAY=y 116 | CONFIG_VIDEO_DT_SIMPLEFB=y 117 | CONFIG_SPLASH_SCREEN=y 118 | CONFIG_SPLASH_SCREEN_ALIGN=y 119 | CONFIG_SPLASH_SOURCE=y 120 | CONFIG_VIDEO_BMP_GZIP=y 121 | CONFIG_BMP_16BPP=y 122 | CONFIG_BMP_24BPP=y 123 | CONFIG_BMP_32BPP=y 124 | CONFIG_SHA384=y 125 | CONFIG_ERRNO_STR=y 126 | CONFIG_GETOPT=y 127 | CONFIG_OF_LIBFDT_OVERLAY=y 128 | -------------------------------------------------------------------------------- /vendor/amlogic/distrofix.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | FILE_OS_RELEASE=/etc/os-release 6 | FILE_DISTRO_DEBIAN_VERSION=/etc/debian_version 7 | STRING_DISTRO_DEBIAN=debian 8 | STRING_DISTRO_DEBIAN_BULLSEYE_ID=bullseye 9 | STRING_DISTRO_DEBIAN_BULLSEYE_VERSION=11 10 | 11 | STRING_EMMC=mmcblk1 12 | STRING_EMMC_BOOT0=boot0 13 | 14 | DF_NET_add(){ 15 | local FILE_NETWORK_ETH0=/etc/network/interfaces.d/eth0 16 | local STRING_NETWORK_ETH0="auto eth0\nallow-hotplug eth0\niface eth0 inet dhcp\n# iface eth0 inet6 auto\n" 17 | if [ ! -f "$FILE_NETWORK_ETH0" ]; then 18 | if echo "$STRING_NETWORK_ETH0" > "$FILE_NETWORK_ETH0"; then 19 | echo "eth0 hot-plug added" >&2 20 | else 21 | echo "eth0 hot-plug failed" >&2 22 | exit 1 23 | fi 24 | fi 25 | } 26 | DF_DHCP_reduceWait(){ 27 | local FILE_DHCP_CLIENT="/etc/dhcp/dhclient.conf" 28 | local STRING_DHCP_CLIENT_TIMEOUT_SED="s/^#?(timeout\\s+)[0-9]+/\\130/" 29 | local STRING_DHCP_CLIENT_RETRY_SED="s/^#?(retry\\s+)[0-9]+/\\130/" 30 | if [ -f "$FILE_DHCP_CLIENT" ]; then 31 | if sed -Ei "$STRING_DHCP_CLIENT_TIMEOUT_SED" "$FILE_DHCP_CLIENT"; then 32 | echo "dhcp timeout reduced" >&2 33 | else 34 | echo "dhcp timeout failed" >&2 35 | exit 1 36 | fi 37 | 38 | if sed -Ei "$STRING_DHCP_CLIENT_RETRY_SED" "$FILE_DHCP_CLIENT"; then 39 | echo "dhcp retry reduced" >&2 40 | else 41 | echo "dhcp retry failed" >&2 42 | exit 1 43 | fi 44 | fi 45 | } 46 | 47 | DF_APT_fixSources(){ 48 | local FILE_APT_SOURCES=/etc/apt/sources.list 49 | local STRING_APT_SOURCES_CDROM_SED="s/^deb\\s+cdrom.*/# \0\n\ndeb http:\\/\\/deb.debian.org\\/debian $STRING_DISTRO_DEBIAN_RELEASE main/g" 50 | local STRING_APT_SOURCES_UPDATE_SED="s/^#?\\s*(deb\\s+http.*)\\s+(main)/\\1 \\2 contrib non-free/g" 51 | if [ -f "$FILE_APT_SOURCES" ]; then 52 | if sed -Ei "$STRING_APT_SOURCES_CDROM_SED" "$FILE_APT_SOURCES"; then 53 | echo "apt cdrom repo disabled and $STRING_DISTRO_DEBIAN_RELEASE main enabled" >&2 54 | else 55 | echo "apt cdrom repo disabled and $STRING_DISTRO_DEBIAN_RELEASE main failed" >&2 56 | exit 1 57 | fi 58 | 59 | if sed -Ei "$STRING_APT_SOURCES_UPDATE_SED" "$FILE_APT_SOURCES"; then 60 | echo "apt security and updates repo enabled" >&2 61 | else 62 | echo "apt security and updates repo failed" >&2 63 | exit 1 64 | fi 65 | fi 66 | } 67 | DF_FSTAB_addOptions(){ 68 | local FILE_FSTAB=/etc/fstab 69 | local STRING_FSTAB_GREP="\\s/\\s\\+btrfs\\s\\+" 70 | local STRING_FSTAB_SED="s/(\\s\\/\\s+btrfs\\s+)(compress=zstd,)?(noatime,)?/\\1compress=zstd,noatime,/g" 71 | if grep "$STRING_FSTAB_GREP" "$FILE_FSTAB" > /dev/null; then 72 | if sed -Ei "$STRING_FSTAB_SED" "$FILE_FSTAB"; then 73 | echo "btrfs zstd noatime enabled" >&2 74 | else 75 | echo "btrfs zstd noatime failed" >&2 76 | exit 1 77 | fi 78 | fi 79 | } 80 | DF_DISK_isEMMCRoot(){ 81 | local COMMAND_DEV_ROOT="findmnt -nvo SOURCE /" 82 | local dev_root=$($COMMAND_DEV_ROOT) 83 | dev_root="${dev_root##*/}" 84 | dev_root="${dev_root%%p[0-9]}" 85 | [ "$dev_root" = "$STRING_EMMC" ] 86 | } 87 | DF_DISK_convertGPTtoMBR(){ 88 | local BLKDEV_EMMC="/dev/$1" 89 | local STRING_FDISK_GREP="^label: gpt\$" 90 | local STRING_FDISK_SED_LABEL="s/label: gpt/label: mbr/" 91 | local STRING_FDISK_SED_LABELID="s/label-id: .*//" 92 | local STRING_FDISK_SED_ESP="s/C12A7328-F81F-11D2-BA4B-00A0C93EC93B/ef/g" 93 | local STRING_FDISK_SED_LINUX="s/0FC63DAF-8483-4772-8E79-3D69D8477DE4/83/g" 94 | local STRING_FDISK_SED_SWAP="s/0657FD6D-A4AB-43C4-84E5-0933C84B4F4F/82/g" 95 | local STRING_FDISK_SED_PTUUID="s/, uuid=.*//g" 96 | local sfds=$(mktemp) 97 | fdisk "$BLKDEV_EMMC" > /dev/null < /dev/null; then 103 | sed -i "$STRING_FDISK_SED_LABEL" "$sfds" 104 | sed -i "$STRING_FDISK_SED_LABELID" "$sfds" 105 | sed -i "$STRING_FDISK_SED_ESP" "$sfds" 106 | sed -i "$STRING_FDISK_SED_LINUX" "$sfds" 107 | sed -i "$STRING_FDISK_SED_SWAP" "$sfds" 108 | sed -i "$STRING_FDISK_SED_PTUUID" "$sfds" 109 | fdisk "$BLKDEV_EMMC" > /dev/null <&2 116 | else 117 | echo "disk gpt2mbr failed" >&2 118 | fi 119 | fi 120 | rm "$sfds" 121 | } 122 | DF_GRUB_install(){ 123 | local FILE_GRUB=/boot/efi/EFI/BOOT/BOOTAA64.EFI 124 | local FILE_GRUB_DEFAULT=/etc/default/grub 125 | local STRING_GRUB_DEFAULT_GREP='GRUB_CMDLINE_LINUX_DEFAULT="quiet"' 126 | local STRING_GRUB_DEFAULT_SED="s/(GRUB_CMDLINE_LINUX_DEFAULT=)\"quiet\"/\\1\"noquiet\"/" 127 | local COMMAND_GRUB_INSTALL="grub-install --force-extra-removable" 128 | local COMMAND_GRUB_UPDATE="update-grub" 129 | if [ ! -f "$FILE_GRUB" ]; then 130 | if $COMMAND_GRUB_INSTALL; then 131 | echo "grub efi loader installed" >&2 132 | else 133 | echo "grub efi loader failed" >&2 134 | exit 1 135 | fi 136 | fi 137 | if grep "$STRING_GRUB_DEFAULT_GREP" "$FILE_GRUB_DEFAULT" > /dev/null; then 138 | if sed -Ei "$STRING_GRUB_DEFAULT_SED" "$FILE_GRUB_DEFAULT"; then 139 | echo "grub linux quiet disabled" >&2 140 | else 141 | echo "grub linux quiet failed" >&2 142 | exit 1 143 | fi 144 | fi 145 | 146 | if $COMMAND_GRUB_UPDATE 2> /dev/null; then 147 | echo "grub cfg updated" >&2 148 | else 149 | echo "grub cfg failed" >&2 150 | exit 1 151 | fi 152 | } 153 | DF_BOOT_install(){ 154 | local FILE_BOOT_FLASH_SCRIPT=$(dirname "$0")/mbruefiloader.sh 155 | if [ ! -z "$2" ]; then 156 | local FILE_EMMC_BOOT_RO="/sys/class/block/${1}${2}/force_ro" 157 | echo -n 0 > "$FILE_EMMC_BOOT0_RO" 158 | fi 159 | local BLKDEV_EMMC_BOOT="${1}${2}" 160 | if [ -b "/dev/$BLKDEV_EMMC_BOOT" ]; then 161 | if "$FILE_BOOT_FLASH_SCRIPT" "$BLKDEV_EMMC_BOOT" 2> /dev/null; then 162 | echo "emmc bootloader installed" >&2 163 | else 164 | echo "emmc bootloader failed" >&2 165 | exit 1 166 | fi 167 | fi 168 | } 169 | 170 | if [ -f "$FILE_OS_RELEASE" ]; then 171 | . "$FILE_OS_RELEASE" 172 | fi 173 | if [ ! -z "$ID" -a "$ID" = "$STRING_DISTRO_DEBIAN" ]; then 174 | echo -n "Debian " >&2 175 | if [ ! -z "VERSION_ID" -a "$VERSION_ID" = "$STRING_DISTRO_DEBIAN_BULLSEYE_VERSION" ]; then 176 | echo "$STRING_DISTRO_DEBIAN_BULLSEYE_VERSION $STRING_DISTRO_DEBIAN_BULLSEYE_ID detected" >&2 177 | STRING_DISTRO_DEBIAN_RELEASE="$STRING_DISTRO_DEBIAN_BULLSEYE_ID" 178 | elif [ -f "$FILE_DISTRO_DEBIAN_VERSION" ]; then 179 | debian_version=$(cat "$FILE_DISTRO_DEBIAN_VERSION") 180 | if [ $debian_version = "bookworm/sid" ]; then 181 | echo "bookworm 12 sid detected" >&2 182 | STRING_DISTRO_DEBIAN_RELEASE=bookworm 183 | else 184 | echo "unsupported detected" >&2 185 | fi 186 | else 187 | echo "unsupported detected" >&2 188 | exit 1 189 | fi 190 | DF_NET_add 191 | DF_DHCP_reduceWait 192 | DF_APT_fixSources 193 | 194 | DF_FSTAB_addOptions 195 | 196 | if DF_DISK_isEMMCRoot; then 197 | DF_DISK_convertGPTtoMBR "$STRING_EMMC" 198 | DF_BOOT_install "$STRING_EMMC" 199 | fi 200 | 201 | DF_GRUB_install 202 | echo "Distro fixes applied" >&2 203 | fi 204 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | --------------------------------------------------------------------------------