From 645141a5b9a9027ea9a26649c7b34d139ed3925f Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Mon, 21 Aug 2017 22:38:11 +0300 Subject: [PATCH] Better Mozilla Flame device support (#435) * No need to append DTB to kernel * Remove kernel module build for now * Add device-specific firmware package * Add special partitions to fstab * Fix typo in screen width --- device/device-mozilla-flame/APKBUILD | 15 ++++++------ .../device-mozilla-flame.post-install | 21 ++++++++++++++++ device/device-mozilla-flame/deviceinfo | 2 +- device/device-mozilla-flame/initfs-hook.sh | 5 ++-- device/linux-mozilla-flame/APKBUILD | 22 ++--------------- firmware/firmware-mozilla-flame/APKBUILD | 24 +++++++++++++++++++ 6 files changed, 59 insertions(+), 30 deletions(-) create mode 100644 device/device-mozilla-flame/device-mozilla-flame.post-install create mode 100644 firmware/firmware-mozilla-flame/APKBUILD diff --git a/device/device-mozilla-flame/APKBUILD b/device/device-mozilla-flame/APKBUILD index 6291171d3..7261de215 100644 --- a/device/device-mozilla-flame/APKBUILD +++ b/device/device-mozilla-flame/APKBUILD @@ -1,15 +1,15 @@ pkgname=device-mozilla-flame pkgver=1 -pkgrel=1 +pkgrel=2 pkgdesc="Mozilla Flame" url="https://github.com/postmarketOS" arch="noarch" license="MIT" -depends="linux-mozilla-flame mkbootimg" +depends="linux-mozilla-flame firmware-mozilla-flame mkbootimg" makedepends="" -install="" +install="$pkgname.post-install" subpackages="" -source="deviceinfo initfs-hook.sh 90-android-touch-dev.rules" +source="deviceinfo initfs-hook.sh 90-android-touch-dev.rules $install" options="!check" build() { @@ -25,6 +25,7 @@ package() { "$pkgdir"/etc/udev/rules.d/90-android-touch-dev.rules } -sha512sums="e1491537517787e7828ca88e749fefba7aafdc14062ce292e4e39d0cfc215ba79c79a64c5be9f4e65e092aabb060a051472c476d49105ed2e048dda88a0f9edd deviceinfo -8590967fa10388a890fdfafdb1070b9ab22dc89e06a3a8834806c772191e3b67de7b914b0d68e5ddf581cee715cb90f3f24abcb8762c415ff328c6da23e55d52 initfs-hook.sh -ee25f3d0377f027d108593eb7953b8db49d7f05a5c36a0c8ca7e7849d15e3c217bc1ac97d77a66e28d2db4b81c0f50b905639911276da40321d2b6cca7f797df 90-android-touch-dev.rules" +sha512sums="6fed912ef5850ba75e4b8f5e8dd36141965978faab011c1556a02c6e2ae42d02710b9a9f0e53f08e9c63d95eafce7c748c37928741157fa321d9f4c1ed6bac4a deviceinfo +29f7be2df62a48604cfbb48bc2192ac309b36b0bf0f02819fdbb240868ff382c0cf17baf1ad8c84361474a2218ec34bdb28ae3ccd940b2560d1b1e281449c48d initfs-hook.sh +ee25f3d0377f027d108593eb7953b8db49d7f05a5c36a0c8ca7e7849d15e3c217bc1ac97d77a66e28d2db4b81c0f50b905639911276da40321d2b6cca7f797df 90-android-touch-dev.rules +0a301a723f2a6ad8285fa8c016a73b0d05ae9811a8c96cd73f6db274e85676f7b3d427ede46484665fd613b67ef42330f0b69413328c04c3f489db86c5aa9038 device-mozilla-flame.post-install" diff --git a/device/device-mozilla-flame/device-mozilla-flame.post-install b/device/device-mozilla-flame/device-mozilla-flame.post-install new file mode 100644 index 000000000..6071bb1ca --- /dev/null +++ b/device/device-mozilla-flame/device-mozilla-flame.post-install @@ -0,0 +1,21 @@ +#!/bin/sh + +# Add firmware partition mount points +mkdir /data +mkdir /persist +mkdir /modem + +# Add firmware partitions to fstab +if [ -z "$(grep /data /etc/fstab)" ]; then + echo "/dev/mmcblk0p29 /data ext4 defaults 0 2" >> /etc/fstab +fi + +if [ -z "$(grep /persist /etc/fstab)" ]; then + echo "/dev/mmcblk0p13 /persist ext4 defaults 0 2" >> /etc/fstab +fi + +if [ -z "$(grep /modem /etc/fstab)" ]; then + echo "/dev/mmcblk0p1 /modem vfat defaults 0 2" >> /etc/fstab +fi + +exit 0 diff --git a/device/device-mozilla-flame/deviceinfo b/device/device-mozilla-flame/deviceinfo index 2eecd16ca..63b5b7ae1 100644 --- a/device/device-mozilla-flame/deviceinfo +++ b/device/device-mozilla-flame/deviceinfo @@ -13,7 +13,7 @@ deviceinfo_flash_methods="fastboot" deviceinfo_arch="armhf" deviceinfo_screen_width="480" -deviceinfo_screen_height="864" +deviceinfo_screen_height="854" deviceinfo_generate_bootimg="true" deviceinfo_bootimg_qcdt="true" diff --git a/device/device-mozilla-flame/initfs-hook.sh b/device/device-mozilla-flame/initfs-hook.sh index e7a2ccc87..4fdddf788 100644 --- a/device/device-mozilla-flame/initfs-hook.sh +++ b/device/device-mozilla-flame/initfs-hook.sh @@ -1,4 +1,5 @@ #!/bin/sh -# set framebuffer resolution -cat /sys/class/graphics/fb0/modes > /sys/class/graphics/fb0/mode +fbdev=/sys/class/graphics/fb0 +echo "480,1708" > $fbdev/virtual_size +cat $fbdev/modes > $fbdev/mode diff --git a/device/linux-mozilla-flame/APKBUILD b/device/linux-mozilla-flame/APKBUILD index e4b44d813..f411f2e34 100644 --- a/device/linux-mozilla-flame/APKBUILD +++ b/device/linux-mozilla-flame/APKBUILD @@ -20,7 +20,7 @@ case $pkgver in *.*.*) _kernver=${pkgver%.*};; *.*) _kernver=$pkgver;; esac -pkgrel=4 +pkgrel=5 arch="armhf" pkgdesc="Mozilla flame kernel" url="https://github.com/mozilla-b2g/codeaurora_kernel_msm" @@ -78,9 +78,6 @@ prepare() { silentoldconfig } - - -# this is so we can do: 'abuild menuconfig' to reconfigure kernel menuconfig() { cd "$srcdir"/build || return 1 make ARCH="$_carch" menuconfig @@ -95,10 +92,6 @@ build() { KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" CONFIG_NO_ERROR_ON_MISMATCH=y DTC_FLAGS="-p 1024" \ || return 1 - make ARCH="$_carch" CC="${CC:-gcc}" \ - KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" CONFIG_NO_ERROR_ON_MISMATCH=y modules \ - || return 1 - dtbTool -s 2048 -p "scripts/dtc/" -o "arch/arm/boot/dt.img" "arch/arm/boot/" } @@ -106,21 +99,10 @@ package() { cd "$srcdir"/build unset LDFLAGS - make ARCH="$_carch" CC="${CC:-gcc}" \ - KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" CONFIG_NO_ERROR_ON_MISMATCH=y \ - INSTALL_MOD_PATH="${pkgdir}" modules_install - make ARCH="$_carch" CC="${CC:-gcc}" \ KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" CONFIG_NO_ERROR_ON_MISMATCH=y \ INSTALL_MOD_PATH="${pkgdir}" firmware_install - rm "${pkgdir}/lib/modules/${pkgver}/build" - install -Dm644 "${srcdir}"/build/Module.symvers "${pkgdir}/lib/modules/${pkgver}/build/Module.symvers" - install -Dm644 "${srcdir}"/build/System.map "${pkgdir}/lib/modules/${pkgver}/build/System.map" - install -Dm644 "${srcdir}"/build/modules.builtin "${pkgdir}/lib/modules/${pkgver}/build/modules.builtin" - install -Dm644 "${srcdir}"/build/modules.order "${pkgdir}/lib/modules/${pkgver}/build/modules.order" - cd ../.. - mkdir -p "$pkgdir/usr/lib/linux-mozilla-flame" for dtb in $(find "$srcdir/build/arch/arm/boot" -name "*.dtb") do @@ -130,7 +112,7 @@ package() { install -Dm644 "$srcdir/build/arch/arm/boot/dt.img" \ "$pkgdir/boot/dt.img" - install -Dm644 "$srcdir/build/arch/arm/boot/zImage-dtb" \ + install -Dm644 "$srcdir/build/arch/arm/boot/zImage" \ "$pkgdir/boot/vmlinuz-$_flavor" install -D "$srcdir/build/include/config/kernel.release" \ diff --git a/firmware/firmware-mozilla-flame/APKBUILD b/firmware/firmware-mozilla-flame/APKBUILD new file mode 100644 index 000000000..13d1f505a --- /dev/null +++ b/firmware/firmware-mozilla-flame/APKBUILD @@ -0,0 +1,24 @@ +pkgname=firmware-mozilla-flame +pkgver=1 +pkgrel=1 +pkgdesc="Mozilla Flame Firmware" +url="https://github.com/yuvadm/mozilla-flame-firmware" +arch="armhf" +license="proprietary" +depends="" +makedepends="" +install="" +subpackages="" +_hash=503a4052a8bfdc3b4c06533f2d08fe4d6a923842 +source=$pkgname-$_hash.zip::$url"/archive/${_hash}.zip" +options="!check !strip" + +package() { + mkdir -p "$pkgdir/lib/firmware/postmarketos" + for fw in $(find "${srcdir}/mozilla-flame-firmware-${_hash}/" -type f) + do + install -m644 $fw "$pkgdir/lib/firmware/postmarketos/" + done +} + +sha512sums="dc9253f5891a488874879fbe94d9d3e59807f33c91958d9b93fc0b07fe31ca664b9929a98857831be07900280ce4c04c4231ab3951e4f02f81b66dd034354560 firmware-mozilla-flame-503a4052a8bfdc3b4c06533f2d08fe4d6a923842.zip"