amazon-soho: new device (MR 2056)

This commit is contained in:
kekzoz 2021-03-21 22:37:31 +00:00 committed by Oliver Smith
parent a2856d47de
commit df9cffb0e4
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
10 changed files with 3747 additions and 0 deletions

View file

@ -0,0 +1,29 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-amazon-soho
pkgdesc="Amazon Kindle Fire HD (3rd Generation)"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="postmarketos-base linux-amazon-soho mkbootimg mesa-dri-gallium"
makedepends="devicepkg-dev"
source="
deviceinfo
initfs-hook.sh
amazon-omap-boot-hack.sh
"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
install -Dm755 "$srcdir/amazon-omap-boot-hack.sh" "$pkgdir/usr/share/postmarketos-mkinitfs/amazon-omap-boot-hack.sh"
}
sha512sums="c77494e106caa7c1df36f5b1bc32a178c96eade1f9663d092d59d62935bec30bbe105ba80a591b25335dd3a531800f42bf4cba3a60e063bc093755593d0e7d21 deviceinfo
1aca985770246b9ca140996a498815b5c9ca3458a6cb84db85825344f01deda8b1de7c88e2e0c610df636ad2179faac7fd90d9992add51186a6449f2d43a3f71 initfs-hook.sh
8944b00650e0e19bb5d7f6063827b6a8b9627fabe91f770729881813b7492e4c68a58ac14d98d961cade8290e07a44c8e4a162ec3983c6c1ab88149cd4589b34 amazon-omap-boot-hack.sh"

View file

@ -0,0 +1,12 @@
#!/bin/sh
echo "==> Amending boot.img for Amazon signature verification exploit"
SOHO_HEADER_DATA='\x50\x03\x00\x00\x00\x25\xe4\x00'
SOHO_HEADER_SIZE=848
SOHO_HEADER_OFFSET=52
tempfile=$(mktemp)
bootimgfile=$(echo "${1}" | sed 's/initramfs-/boot.img-/g')
dd if=/dev/zero of="${tempfile}" bs=$SOHO_HEADER_SIZE count=1
printf "%b" $SOHO_HEADER_DATA | dd of="${tempfile}" bs=$SOHO_HEADER_OFFSET seek=1 conv=notrunc
cat "${bootimgfile}" >> "${tempfile}"
mv "${tempfile}" "${bootimgfile}"

View file

@ -0,0 +1,32 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell
# scripts.
deviceinfo_format_version="0"
deviceinfo_name="Amazon Kindle Fire HD (3rd Generation)"
deviceinfo_manufacturer="Amazon"
deviceinfo_codename="amazon-soho"
deviceinfo_year="2013"
deviceinfo_arch="armv7"
# Device related
deviceinfo_chassis="tablet"
deviceinfo_keyboard="false"
deviceinfo_external_storage="false"
deviceinfo_screen_width="800"
deviceinfo_screen_height="1280"
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_kernel_cmdline="console=tty0 mem=1G vmalloc=496M init=/init"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_bootimg_mtk_mkimage="false"
deviceinfo_bootimg_dtb_second="false"
deviceinfo_mkinitfs_postprocess="/usr/share/postmarketos-mkinitfs/amazon-omap-boot-hack.sh"
deviceinfo_flash_offset_base="0x80000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_pagesize="2048"

View file

@ -0,0 +1,5 @@
#!/bin/sh
# Turn overlay0 off and on again to remove bootloader screen
echo 0 > /sys/devices/platform/omapdss/overlay0/enabled
echo 1 > /sys/devices/platform/omapdss/overlay0/enabled

View file

@ -0,0 +1,59 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm/configs/android_soho_defconfig
pkgname=linux-amazon-soho
pkgver=3.4.113
pkgrel=0
pkgdesc="Amazon Kindle Fire HD (3rd Generation) kernel fork"
arch="armv7"
_carch="arm"
_flavor="amazon-soho"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="bash bc bison devicepkg-dev flex openssl-dev perl xz gcc4"
# Compiler: GCC 4 (doesn't boot when compiled with newer versions)
if [ "${CC:0:5}" != "gcc4-" ]; then
CC="gcc4-$CC"
HOSTCC="gcc4-gcc"
CROSS_COMPILE="gcc4-$CROSS_COMPILE"
fi
# Source
_repository="android_kernel_ti_omap"
_commit="4c841d44d7d1574367e7a786e079040660987367"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://github.com/kekzoz/$_repository/archive/$_commit.tar.gz
$_config
gcc7-give-up-on-ilog2-const-optimizations.patch
gcc8-fix-put-user.patch
gcc10-extern_YYLOC_global_declaration.patch
kernel-use-the-gnu89-standard-explicitly.patch
"
builddir="$srcdir/$_repository-$_commit"
_outdir="out"
prepare() {
default_prepare
. downstreamkernel_prepare
}
build() {
unset LDFLAGS
make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
}
package() {
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor" "$_outdir"
}
sha512sums="793a098f5fce4327e8b1ddc6d640f3ff416307fbc4b3f32c3d5e56cf5b9b4e728fbcf096777c5d007866dab63ba20a847a6b0e7a23c3d2487d4834240e1ba485 linux-amazon-soho-4c841d44d7d1574367e7a786e079040660987367.tar.gz
8f4177081d640a0af60a8f5b65771b323bd79c7599df7ee2db9644c5f376af9c45bf23f35ab1c377d4134931bbf30276a7b29f3da943efade617d3a167fe06ae config-amazon-soho.armv7
77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7 gcc7-give-up-on-ilog2-const-optimizations.patch
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch
2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb gcc10-extern_YYLOC_global_declaration.patch
ad0182a483791fc88e058838bc331b2f04a75ba291e763767babdb815efadfc3b4fda97e69e2e3f00a426cabea088e35297a92bd287592597d1e309be68ee92c kernel-use-the-gnu89-standard-explicitly.patch"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc10-extern_YYLOC_global_declaration.patch

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc7-give-up-on-ilog2-const-optimizations.patch

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc8-fix-put-user.patch

View file

@ -0,0 +1 @@
../../.shared-patches/linux/kernel-use-the-gnu89-standard-explicitly.patch