diff --git a/.gitignore b/.gitignore index 8455eb5..355e2dc 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ /src/linux-rockchip /src/linux-sunxi /src/linux-librem5 +/src/linux-sdm845 /src/busybox /src/u-boot /src/u-boot-librem5 @@ -15,6 +16,7 @@ /*.dtb /*.img.xz /*.gz +/*.gz-dtb /*.bin /*.tar.bz2 /*.tar.xz diff --git a/Makefile b/Makefile index c2ddbb4..32afe0c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CROSS_FLAGS = ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CROSS_FLAGS_BOOT = CROSS_COMPILE=aarch64-linux-gnu- -all: pine64-pinephone.img.xz pine64-pinetab.img.xz purism-librem5.tar.xz +all: pine64-pinephone.img.xz pine64-pinetab.img.xz purism-librem5.tar.xz boot-xiaomi-beryllium-tianma.img boot-xiaomi-beryllium-ebbg.img boot-oneplus-enchilada.img boot-oneplus-fajita.img pine64-pinephone.img: fat-pine64-pinephone.img u-boot-sunxi-with-spl.bin @@ -67,6 +67,28 @@ fat-pine64-pinebookpro.img: initramfs-pine64-pinebookpro.gz kernel-rockchip.gz s @mmd -i $@ extlinux @mcopy -i $@ src/pine64-pinebookpro.conf ::extlinux/extlinux.conf +kernel-xiaomi-beryllium-tianma.gz-dtb: kernel-sdm845.gz dtbs/sdm845/sdm845-xiaomi-beryllium-tianma.dtb + cat kernel-sdm845.gz dtbs/sdm845/sdm845-xiaomi-beryllium-tianma.dtb > $@ + +kernel-xiaomi-beryllium-ebbg.gz-dtb: kernel-sdm845.gz dtbs/sdm845/sdm845-xiaomi-beryllium-ebbg.dtb + cat kernel-sdm845.gz dtbs/sdm845/sdm845-xiaomi-beryllium-ebbg.dtb > $@ + +kernel-oneplus-enchilada.gz-dtb: kernel-sdm845.gz dtbs/sdm845/sdm845-oneplus-enchilada.dtb + cat kernel-sdm845.gz dtbs/sdm845/sdm845-oneplus-enchilada.dtb > $@ + +kernel-oneplus-fajita.gz-dtb: kernel-sdm845.gz dtbs/sdm845/sdm845-oneplus-fajita.dtb + cat kernel-sdm845.gz dtbs/sdm845/sdm845-oneplus-fajita.dtb > $@ + +boot-%.img: initramfs-%.gz kernel-%.gz-dtb + rm -f $@ + $(eval BASE := $(shell cat src/deviceinfo_$* | grep base | cut -d "\"" -f 2)) + $(eval SECOND := $(shell cat src/deviceinfo_$* | grep second | cut -d "\"" -f 2)) + $(eval KERNEL := $(shell cat src/deviceinfo_$* | grep kernel | cut -d "\"" -f 2)) + $(eval RAMDISK := $(shell cat src/deviceinfo_$* | grep ramdisk | cut -d "\"" -f 2)) + $(eval TAGS := $(shell cat src/deviceinfo_$* | grep tags | cut -d "\"" -f 2)) + $(eval PAGESIZE := $(shell cat src/deviceinfo_$* | grep pagesize | cut -d "\"" -f 2)) + mkbootimg --kernel kernel-$*.gz-dtb --ramdisk initramfs-$*.gz --base $(BASE) --second_offset $(SECOND) --kernel_offset $(KERNEL) --ramdisk_offset $(RAMDISK) --tags_offset $(TAGS) --pagesize $(PAGESIZE) -o $@ + %.img.xz: %.img @echo "XZ $@" @xz -c $< > $@ @@ -132,6 +154,24 @@ kernel-librem5.gz: src/linux_config_librem5 src/linux-librem5 dtbs/librem5/imx8mq-librem5-r2.dtb: kernel-librem5.gz +kernel-sdm845.gz: src/linux-sdm845 + @echo "MAKE $@" + @mkdir -p build/linux-sdm845 + @mkdir -p dtbs/sdm845 + @$(MAKE) -C src/linux-sdm845 O=../../build/linux-sdm845 $(CROSS_FLAGS) defconfig sdm845.config + @printf "CONFIG_USB_ETH=n" >> build/linux-sdm845/.config + @$(MAKE) -C src/linux-sdm845 O=../../build/linux-sdm845 $(CROSS_FLAGS) + @cp build/linux-sdm845/arch/arm64/boot/Image.gz $@ + @cp build/linux-sdm845/arch/arm64/boot/dts/qcom/sdm845-{xiaomi-beryllium-*,oneplus-enchilada,oneplus-fajita}.dtb dtbs/sdm845/ + +dtbs/sdm845/sdm845-xiaomi-beryllium-ebbg.dtb: kernel-sdm845.gz + +dtbs/sdm845/sdm845-xiaomi-beryllium-tianma.dtb: kernel-sdm845.gz + +dtbs/sdm845/sdm845-oneplus-enchilada.dtb: kernel-sdm845.gz + +dtbs/sdm845/sdm845-oneplus-fajita.dtb: kernel-sdm845.gz + %.scr: src/%.txt @echo "MKIMG $@" @mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d $< $@ @@ -172,44 +212,50 @@ src/linux-rockchip: @echo "WGET linux-rockchip" @mkdir src/linux-rockchip @wget https://gitlab.manjaro.org/tsys/linux-pinebook-pro/-/archive/v5.6/linux-pinebook-pro-v5.6.tar.gz - @tar -xvf linux-pinebook-pro-v5.6.tar.gz --strip-components 1 -C src/linux-rockchip + @tar -xf linux-pinebook-pro-v5.6.tar.gz --strip-components 1 -C src/linux-rockchip src/linux-sunxi: @echo "WGET linux-sunxi" @mkdir src/linux-sunxi @wget https://github.com/megous/linux/archive/orange-pi-5.9-20201019-1553.tar.gz - @tar -xvf orange-pi-5.9-20201019-1553.tar.gz --strip-components 1 -C src/linux-sunxi + @tar -xf orange-pi-5.9-20201019-1553.tar.gz --strip-components 1 -C src/linux-sunxi src/linux-librem5: @echo "WGET linux-librem5" @mkdir src/linux-librem5 @wget -c https://source.puri.sm/Librem5/linux-next/-/archive/pureos/5.9.16+librem5.2/linux-next-pureos-5.9.16+librem5.2.tar.gz - @tar -xvf linux-next-pureos-5.9.16+librem5.2.tar.gz --strip-components 1 -C src/linux-librem5 + @tar -xf linux-next-pureos-5.9.16+librem5.2.tar.gz --strip-components 1 -C src/linux-librem5 + +src/linux-sdm845: + @echo "WGET linux-sdm845" + @mkdir src/linux-sdm845 + @wget -c https://gitlab.com/sdm845-mainline/linux/-/archive/b7a1e57f78d690d02aff902114bf2f6ca978ecfe/linux-b7a1e57f78d690d02aff902114bf2f6ca978ecfe.tar.gz + @tar -xf linux-b7a1e57f78d690d02aff902114bf2f6ca978ecfe.tar.gz --strip-components 1 -C src/linux-sdm845 src/arm-trusted-firmware: @echo "WGET arm-trusted-firmware" @mkdir src/arm-trusted-firmware @wget https://github.com/ARM-software/arm-trusted-firmware/archive/50d8cf26dc57bb453b1a52be646140bfea4aa591.tar.gz - @tar -xvf 50d8cf26dc57bb453b1a52be646140bfea4aa591.tar.gz --strip-components 1 -C src/arm-trusted-firmware + @tar -xf 50d8cf26dc57bb453b1a52be646140bfea4aa591.tar.gz --strip-components 1 -C src/arm-trusted-firmware src/u-boot: @echo "WGET u-boot" @mkdir src/u-boot @wget https://ftp.denx.de/pub/u-boot/u-boot-2020.04.tar.bz2 - @tar -xvf u-boot-2020.04.tar.bz2 --strip-components 1 -C src/u-boot + @tar -xf u-boot-2020.04.tar.bz2 --strip-components 1 -C src/u-boot @cd src/u-boot && patch -p1 < ../u-boot-pinephone.patch src/u-boot-librem5: @echo "WGET u-boot-librem5" @mkdir src/u-boot-librem5 @wget https://source.puri.sm/Librem5/u-boot-builder/-/archive/3b1c7d957f46c87c6cdd71cd8dab7c84aca26570/u-boot-builder-3b1c7d957f46c87c6cdd71cd8dab7c84aca26570.tar.gz - @tar -xvf u-boot-builder-3b1c7d957f46c87c6cdd71cd8dab7c84aca26570.tar.gz --strip-components 1 -C src/u-boot-librem5 + @tar -xf u-boot-builder-3b1c7d957f46c87c6cdd71cd8dab7c84aca26570.tar.gz --strip-components 1 -C src/u-boot-librem5 src/busybox: @echo "WGET busybox" @mkdir src/busybox @wget https://www.busybox.net/downloads/busybox-1.32.0.tar.bz2 - @tar -xvf busybox-1.32.0.tar.bz2 --strip-components 1 -C src/busybox + @tar -xf busybox-1.32.0.tar.bz2 --strip-components 1 -C src/busybox .PHONY: clean cleanfast purism-librem5 @@ -232,6 +278,7 @@ cleanfast: @rm -vf *.bin @rm -vf *.cpio @rm -vf *.gz + @rm -vf *.gz-dtb @rm -vf *.scr @rm -vf splash/*.gz @rm -vf *.lst diff --git a/README.md b/README.md index a477f2d..b6a396c 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,9 @@ A swiss army knife for mobile devices, currently supporting: - Pine64 PineTab - Pine64 PinePhone - Purism Librem 5 +- Xiaomi Pocophone F1 +- OnePlus 6 +- OnePlus 6T You can use this to flash a image **directly to eMMC**, troubleshooting a broken system, and a lot more. @@ -32,6 +35,10 @@ In case eMMC isn't showing up try to charge your battery and try again. There ar Extract the downloaded JumpDrive release archive for the Librem 5, put the device into flash mode, then run the `boot-purism-librem5.sh` script from the release. +### Xiaomi Pocophone F1 / OnePlus 6 / OnePlus 6T + +Boot the image using `fastboot boot`. + ### Building The dependencies are: @@ -44,6 +51,9 @@ Additional dependencies for the Purism Librem 5: - arm-none-eabi- toolchain - uuu +Additional dependencies for the Xiaomi Pocophone F1 / OnePlus 6 / OnePlus 6T: +- mkbootimg + ```shell-session $ git submodule update --init --recursive Downloads the projects to build diff --git a/splash/oneplus-enchilada-error.ppm b/splash/oneplus-enchilada-error.ppm new file mode 100644 index 0000000..763a889 Binary files /dev/null and b/splash/oneplus-enchilada-error.ppm differ diff --git a/splash/oneplus-enchilada.ppm b/splash/oneplus-enchilada.ppm new file mode 100644 index 0000000..7020e2d Binary files /dev/null and b/splash/oneplus-enchilada.ppm differ diff --git a/splash/oneplus-fajita-error.ppm b/splash/oneplus-fajita-error.ppm new file mode 100644 index 0000000..c39e995 Binary files /dev/null and b/splash/oneplus-fajita-error.ppm differ diff --git a/splash/oneplus-fajita.ppm b/splash/oneplus-fajita.ppm new file mode 100644 index 0000000..dcb7687 Binary files /dev/null and b/splash/oneplus-fajita.ppm differ diff --git a/splash/xiaomi-beryllium-ebbg-error.ppm b/splash/xiaomi-beryllium-ebbg-error.ppm new file mode 120000 index 0000000..b0efd55 --- /dev/null +++ b/splash/xiaomi-beryllium-ebbg-error.ppm @@ -0,0 +1 @@ +xiaomi-beryllium-error.ppm \ No newline at end of file diff --git a/splash/xiaomi-beryllium-ebbg.ppm b/splash/xiaomi-beryllium-ebbg.ppm new file mode 120000 index 0000000..2e624de --- /dev/null +++ b/splash/xiaomi-beryllium-ebbg.ppm @@ -0,0 +1 @@ +xiaomi-beryllium.ppm \ No newline at end of file diff --git a/splash/xiaomi-beryllium-error.ppm b/splash/xiaomi-beryllium-error.ppm new file mode 100644 index 0000000..fffb63e Binary files /dev/null and b/splash/xiaomi-beryllium-error.ppm differ diff --git a/splash/xiaomi-beryllium-tianma-error.ppm b/splash/xiaomi-beryllium-tianma-error.ppm new file mode 120000 index 0000000..b0efd55 --- /dev/null +++ b/splash/xiaomi-beryllium-tianma-error.ppm @@ -0,0 +1 @@ +xiaomi-beryllium-error.ppm \ No newline at end of file diff --git a/splash/xiaomi-beryllium-tianma.ppm b/splash/xiaomi-beryllium-tianma.ppm new file mode 120000 index 0000000..2e624de --- /dev/null +++ b/splash/xiaomi-beryllium-tianma.ppm @@ -0,0 +1 @@ +xiaomi-beryllium.ppm \ No newline at end of file diff --git a/splash/xiaomi-beryllium.ppm b/splash/xiaomi-beryllium.ppm new file mode 100644 index 0000000..fc322c1 Binary files /dev/null and b/splash/xiaomi-beryllium.ppm differ diff --git a/src/deviceinfo_oneplus-enchilada b/src/deviceinfo_oneplus-enchilada new file mode 120000 index 0000000..cc52510 --- /dev/null +++ b/src/deviceinfo_oneplus-enchilada @@ -0,0 +1 @@ +deviceinfo_sdm845 \ No newline at end of file diff --git a/src/deviceinfo_oneplus-fajita b/src/deviceinfo_oneplus-fajita new file mode 120000 index 0000000..cc52510 --- /dev/null +++ b/src/deviceinfo_oneplus-fajita @@ -0,0 +1 @@ +deviceinfo_sdm845 \ No newline at end of file diff --git a/src/deviceinfo_sdm845 b/src/deviceinfo_sdm845 new file mode 100644 index 0000000..1c3c750 --- /dev/null +++ b/src/deviceinfo_sdm845 @@ -0,0 +1,6 @@ +deviceinfo_flash_offset_base="0x00000000" +deviceinfo_flash_offset_kernel="0x00008000" +deviceinfo_flash_offset_ramdisk="0x01000000" +deviceinfo_flash_offset_second="0x00f00000" +deviceinfo_flash_offset_tags="0x00000100" +deviceinfo_flash_pagesize="4096" \ No newline at end of file diff --git a/src/deviceinfo_xiaomi-beryllium-ebbg b/src/deviceinfo_xiaomi-beryllium-ebbg new file mode 120000 index 0000000..cc52510 --- /dev/null +++ b/src/deviceinfo_xiaomi-beryllium-ebbg @@ -0,0 +1 @@ +deviceinfo_sdm845 \ No newline at end of file diff --git a/src/deviceinfo_xiaomi-beryllium-tianma b/src/deviceinfo_xiaomi-beryllium-tianma new file mode 120000 index 0000000..cc52510 --- /dev/null +++ b/src/deviceinfo_xiaomi-beryllium-tianma @@ -0,0 +1 @@ +deviceinfo_sdm845 \ No newline at end of file diff --git a/src/info-oneplus-enchilada.sh b/src/info-oneplus-enchilada.sh new file mode 100644 index 0000000..5531c2d --- /dev/null +++ b/src/info-oneplus-enchilada.sh @@ -0,0 +1,4 @@ +PLATFORM=oneplus-enchilada +MANUFACTURER=OnePlus +PRODUCT="OnePlus 6" +EMMC=/dev/sda17 diff --git a/src/info-oneplus-fajita.sh b/src/info-oneplus-fajita.sh new file mode 100644 index 0000000..e30bcf4 --- /dev/null +++ b/src/info-oneplus-fajita.sh @@ -0,0 +1,4 @@ +PLATFORM=oneplus-fajita +MANUFACTURER=OnePlus +PRODUCT="OnePlus 6T" +EMMC=/dev/sda17 diff --git a/src/info-xiaomi-beryllium-ebbg.sh b/src/info-xiaomi-beryllium-ebbg.sh new file mode 120000 index 0000000..47333f0 --- /dev/null +++ b/src/info-xiaomi-beryllium-ebbg.sh @@ -0,0 +1 @@ +info-xiaomi-beryllium.sh \ No newline at end of file diff --git a/src/info-xiaomi-beryllium-tianma.sh b/src/info-xiaomi-beryllium-tianma.sh new file mode 120000 index 0000000..47333f0 --- /dev/null +++ b/src/info-xiaomi-beryllium-tianma.sh @@ -0,0 +1 @@ +info-xiaomi-beryllium.sh \ No newline at end of file diff --git a/src/info-xiaomi-beryllium.sh b/src/info-xiaomi-beryllium.sh new file mode 100644 index 0000000..064d4ca --- /dev/null +++ b/src/info-xiaomi-beryllium.sh @@ -0,0 +1,5 @@ +PLATFORM=xiaomi-beryllium +MANUFACTURER=Xiaomi +PRODUCT="Pocophone F1" +EMMC=/dev/sda21 +SD=/dev/mmcblk0