From 0b9acf52a4443288f0f12a3caec2c03cba56e232 Mon Sep 17 00:00:00 2001 From: Daniele Debernardi Date: Tue, 9 Jan 2018 20:42:52 +0100 Subject: [PATCH] [samsung-i9070] Add proper fix for framebuffer (#1106) - Removed the framebuffer configuration in the initramfs hook - Added patch for fixing the framebuffer mode in the kernel source - Cleanup linux-samsung-i9070 APKBUILD --- device/device-samsung-i9070/APKBUILD | 4 +- device/device-samsung-i9070/initfs-hook.sh | 4 - .../01_remove_ramdisks_from_initramfs.patch | 11 +- .../05_fix_fb_rgb_mode.patch | 36 +++++ device/linux-samsung-i9070/APKBUILD | 150 +++++++----------- .../config-samsung-i9070.armhf | 2 +- 6 files changed, 105 insertions(+), 102 deletions(-) create mode 100644 device/linux-samsung-i9070/05_fix_fb_rgb_mode.patch diff --git a/device/device-samsung-i9070/APKBUILD b/device/device-samsung-i9070/APKBUILD index bd4d8bb24..fb4eb43df 100644 --- a/device/device-samsung-i9070/APKBUILD +++ b/device/device-samsung-i9070/APKBUILD @@ -1,7 +1,7 @@ # Reference: pkgname=device-samsung-i9070 pkgver=1 -pkgrel=18 +pkgrel=19 pkgdesc="Samsung Galaxy S Advance" url="https://github.com/postmarketOS" arch="noarch" @@ -31,5 +31,5 @@ package() { } sha512sums="fe7b2af2abd441775705e5d228eab7904194bb3ef6af08a69593849e3380e6c9fc4905b3eac52e851aff0f2364a4425a79da8e6e48416b7a630754a525df3b9e deviceinfo -098187f6ab56d2542f98f1b5fbcf493431f665a4300db05e859357366e39b02a3d508bfd94c1d1bd7c669261e7ef0d4e1aef1fdbb15541fe34f3f48a6caa247f initfs-hook.sh +449e5047f9c15d536233fe2836cf10ae3dd2bf46f1c12ad0423f098bd54bff357438747a3c23aec9b1d8826146f87ff39d657c2b48247fb5ac4ebdeed65634fa initfs-hook.sh 61e8becbf6fa7c1c6c42e481083f5981ae7af33a48cbc53e817d8ac2c6a8e4f67a54b32ae3b8f5f25f7b412165a849dc93a629110dc47b0d16927bf2a12eb7e1 modules-load.conf" diff --git a/device/device-samsung-i9070/initfs-hook.sh b/device/device-samsung-i9070/initfs-hook.sh index 03df2cb96..114aa1993 100644 --- a/device/device-samsung-i9070/initfs-hook.sh +++ b/device/device-samsung-i9070/initfs-hook.sh @@ -1,9 +1,5 @@ #!/bin/sh -# set framebuffer resolution -echo 16 > /sys/class/graphics/fb0/bits_per_pixel -echo 960,1600 > /sys/class/graphics/fb0/virtual_size - # set usb properties echo 0 > /sys/class/android_usb/android0/enable echo samsung > /sys/class/android_usb/android0/iManufacturer diff --git a/device/linux-samsung-i9070/01_remove_ramdisks_from_initramfs.patch b/device/linux-samsung-i9070/01_remove_ramdisks_from_initramfs.patch index eec4549a5..e13de2bf2 100644 --- a/device/linux-samsung-i9070/01_remove_ramdisks_from_initramfs.patch +++ b/device/linux-samsung-i9070/01_remove_ramdisks_from_initramfs.patch @@ -1,8 +1,15 @@ diff --git a/usr/u8500_initramfs.list b/usr/u8500_initramfs.list -index 35e8d68..c846052 100644 +index 35e8d68..bc8c3c5 100644 --- a/usr/u8500_initramfs.list +++ b/usr/u8500_initramfs.list -@@ -29,5 +29,3 @@ file /stage1/init source/usr/u8500_initramfs_files/init 755 0 0 +@@ -24,10 +24,8 @@ nod /dev/block/mmcblk1p1 600 0 0 b 179 19 + slink /init /stage1/init 777 0 0 + dir /proc 755 0 0 + dir /stage1 755 0 0 +-file /stage1/busybox source/usr/u8500_initramfs_files/busybox 755 0 0 +-file /stage1/init source/usr/u8500_initramfs_files/init 755 0 0 ++file /stage1/busybox usr/u8500_initramfs_files/busybox 755 0 0 ++file /stage1/init usr/u8500_initramfs_files/init 755 0 0 dir /sys 755 0 0 dir /mnt 755 0 0 dir /mnt/.lfs 755 0 0 diff --git a/device/linux-samsung-i9070/05_fix_fb_rgb_mode.patch b/device/linux-samsung-i9070/05_fix_fb_rgb_mode.patch new file mode 100644 index 000000000..3594a9020 --- /dev/null +++ b/device/linux-samsung-i9070/05_fix_fb_rgb_mode.patch @@ -0,0 +1,36 @@ +diff --git a/arch/arm/mach-ux500/board-janice-mcde.c b/arch/arm/mach-ux500/board-janice-mcde.c +index 00417c38..7b8d8b31 100644 +--- a/arch/arm/mach-ux500/board-janice-mcde.c ++++ b/arch/arm/mach-ux500/board-janice-mcde.c +@@ -222,7 +222,7 @@ static struct mcde_display_device generic_display0 = { + .port = &port0, + .chnl_id = MCDE_CHNL_A, + .fifo = MCDE_FIFO_A, +- .default_pixel_format = MCDE_OVLYPIXFMT_RGBA8888,//support RGBA888 for janice ++ .default_pixel_format = MCDE_OVLYPIXFMT_RGB888,//support RGBA888 for janice + .x_res_padding = 0, + .y_res_padding = 0, + .native_x_res = 480, +@@ -243,7 +243,7 @@ static int display_postregistered_callback(struct notifier_block *nb, + { + struct mcde_display_device *ddev = dev; + u16 width, height; +- u16 virtual_height; ++ u16 virtual_width, virtual_height; + struct fb_info *fbi; + #if defined(CONFIG_DISPDEV) || defined(CONFIG_COMPDEV) + struct mcde_fb *mfb; +@@ -256,10 +256,11 @@ static int display_postregistered_callback(struct notifier_block *nb, + return 0; + + mcde_dss_get_native_resolution(ddev, &width, &height); +- virtual_height = height * 3; ++ virtual_width = width * 2; ++ virtual_height = height * 2; + + /* Create frame buffer */ +- fbi = mcde_fb_create(ddev, width, height, width, virtual_height, ++ fbi = mcde_fb_create(ddev, width, height, virtual_width, virtual_height, + ddev->default_pixel_format, FB_ROTATE_UR); + + if (IS_ERR(fbi)) { diff --git a/device/linux-samsung-i9070/APKBUILD b/device/linux-samsung-i9070/APKBUILD index 576cc6c1f..784d31609 100644 --- a/device/linux-samsung-i9070/APKBUILD +++ b/device/linux-samsung-i9070/APKBUILD @@ -1,149 +1,113 @@ -# APKBUILD based on linux-vanilla aport. Changes: -# - add findutils makedepend (necessary for the initramfs) -# - it builds an initramfs - do not use ramdisk.cpio and -# ramdisk-recovery.cpio, in there, always use the -# initramfs from the kernel2 partition ("isorec") -# - directly boot to that initramfs, not only when the recovery -# key combination was pressed. -# - use Alpine's busybox-static instead of the pre-compiled -# binary, that comes with the source -# - reduce lzo compression because Alpine's busybox doesn't -# support high compression -# - add kernel modules installation -# - add wifi firmware from vendor files -# -# Kernel config changes, based on: arch/arm/configs/janice_defconfig -# - enable devtmpfs (needed for udev -> touch support in weston) -# - disable ANDROID_PARANOID_NETWORK (removes network restrictions) +# Kernel config based on: arch/arm/configs/janice_defconfig -_vendor=samsung -_flavor=samsung-i9070 -_hash="ac7219c4b8dcec7bc5a598d42c6be0db4aa36332" -_config="config-${_flavor}.armhf" - -pkgname=linux-${_flavor} +pkgname="linux-samsung-i9070" pkgver=3.0.101 -case $pkgver in - *.*.*) _kernver=${pkgver%.*};; - *.*) _kernver=$pkgver;; -esac -pkgrel=9 -arch="armhf" +pkgrel=10 pkgdesc="Samsung Galaxy S Advance kernel from Epirex" +arch="armhf" +_carch="arm" +_flavor="samsung-i9070" url="https://github.com/Epirex/Samsung_STE_Kernel" -depends="postmarketos-mkinitfs" -makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev busybox-static-armhf" +license="GPL2" options="!strip !check !tracedeps" -install= +makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev busybox-static-armhf" +HOSTCC="${CC:-gcc}" +HOSTCC="${HOSTCC#${CROSS_COMPILE}}" + +# Source +_repository="Samsung_STE_Kernel" +_commit="ac7219c4b8dcec7bc5a598d42c6be0db4aa36332" +_config="config-${_flavor}.armhf" source=" - $pkgname-$_hash.tar.gz::https://github.com/Epirex/Samsung_STE_Kernel/archive/${_hash}.tar.gz + $pkgname-$_commit.tar.gz::https://github.com/Epirex/${_repository}/archive/${_commit}.tar.gz $_config 00_fix_return_address.patch 01_remove_ramdisks_from_initramfs.patch 02_reduce_lzo_compression.patch 03_change_modules_install_dir.patch 04_change_dhd_firmware_dir.patch + 05_fix_fb_rgb_mode.patch compiler-gcc6.h init " -subpackages="" -license="GPL2" - -_abi_release=${pkgver} -_carch="arm" -HOSTCC="${CC:-gcc}" -HOSTCC="${HOSTCC#${CROSS_COMPILE}}" - -ksrcdir="$srcdir/Samsung_STE_Kernel-${_hash}" +builddir="$srcdir/${_repository}-${_commit}" prepare() { - local _patch_failed= - cd "$ksrcdir" - - # first apply patches in specified order - for i in $source; do - case $i in - *.patch) - msg "Applying $i..." - if ! patch -s -p1 -N -i "$srcdir"/$i; then - echo $i >>failed - _patch_failed=1 - fi - ;; - esac - done - - if ! [ -z "$_patch_failed" ]; then - error "The following patches failed:" - cat failed - return 1 - fi + default_prepare # Use Alpine's busybox.static instead of the pre-compiled busybox shipped # with the source cp -v /usr/$(arch_to_hostspec $arch)/bin/busybox.static \ - "$ksrcdir"/usr/u8500_initramfs_files/busybox + "$builddir"/usr/u8500_initramfs_files/busybox # use custom init script in the initramfs which loads the initramfs from # the kernel2 partition ("isorec") - cp -v "$srcdir"/init "$ksrcdir"/usr/u8500_initramfs_files/init + cp -v "$srcdir"/init "$builddir"/usr/u8500_initramfs_files/init # gcc6 support - cp -v "$srcdir/compiler-gcc6.h" "$ksrcdir/include/linux/" + cp -v "$srcdir/compiler-gcc6.h" "$builddir/include/linux/" - mkdir -p "$srcdir"/build - cp "$srcdir"/$_config "$srcdir"/build/.config - make -C "$ksrcdir" O="$srcdir"/build ARCH="$_carch" HOSTCC="$HOSTCC" \ - silentoldconfig + # Remove -Werror from all makefiles + find . -type f -name Makefile -print0 | \ + xargs -0 sed -i 's/-Werror-/-W/g' + find . -type f -name Makefile -print0 | \ + xargs -0 sed -i 's/-Werror//g' + + cp "$srcdir"/$_config "$builddir"/.config + make ARCH="$_carch" HOSTCC="$HOSTCC" silentoldconfig } -# this is so we can do: 'abuild menuconfig' to reconfigure kernel menuconfig() { - cd "$srcdir"/build - echo "--[ menuconfig ]--" + cd "$builddir" make ARCH="$_carch" menuconfig cp .config "$startdir"/$_config } build() { - cd "$srcdir"/build unset LDFLAGS - - echo "--[ Build kernel ]--" make ARCH="$_carch" CC="${CC:-gcc}" \ - KBUILD_BUILD_VERSION="$((pkgrel + 1))-Alpine" - - echo "--[ Build modules ]--" + KBUILD_BUILD_VERSION="$((pkgrel + 1))-postmarketOS" # the 'no-pic' flag is necessary to avoid the # error 'Unknown symbol _GLOBAL_OFFSET_TABLE_ (err 0)' when loading the module make ARCH="$_carch" CC="${CC:-gcc}" CFLAGS_MODULE="-fno-pic" \ - KBUILD_BUILD_VERSION="$((pkgrel + 1))-Alpine" CONFIG_NO_ERROR_ON_MISMATCH=y \ - modules + KBUILD_BUILD_VERSION="$((pkgrel + 1))-postmarketOS" modules } package() { - echo "--[ Installing kernel ]--" - install -Dm644 "$srcdir/build/arch/arm/boot/zImage" \ - "$pkgdir/boot/vmlinuz-$_flavor" - - install -D "$srcdir/build/include/config/kernel.release" \ + # kernel.release + install -D "$builddir/include/config/kernel.release" \ "$pkgdir/usr/share/kernel/$_flavor/kernel.release" - cd "$srcdir"/build - unset LDFLAGS + # zImage (find the right one) + cd "$builddir/arch/$_carch/boot" + _target="$pkgdir/boot/vmlinuz-$_flavor" + for _zimg in zImage-dtb Image.gz-dtb *zImage Image; do + [ -e "$_zimg" ] || continue + msg "zImage found: $_zimg" + install -Dm644 "$_zimg" "$_target" + break + done + if ! [ -e "$_target" ]; then + error "Could not find zImage in $PWD!" + return 1 + fi - echo "--[ Installing modules ]--" + # Modules + cd "$builddir" + unset LDFLAGS make ARCH="$_carch" CC="${CC:-gcc}" \ - KBUILD_BUILD_VERSION="$((pkgrel + 1))-Alpine" CONFIG_NO_ERROR_ON_MISMATCH=y \ - INSTALL_MOD_PATH="$pkgdir" INSTALL_MOD_STRIP=1 modules_install + KBUILD_BUILD_VERSION="$((pkgrel + 1))-postmarketOS" \ + INSTALL_MOD_PATH="$pkgdir" INSTALL_MOD_STRIP=1 \ + modules_install } sha512sums="bb8218d803ec27f983449a43d14df75122311609a39e5b57095f4e8933752a2699fa0d4df1674aeee7d6e3a439551dacc9af3cab26b6e3e71f0441a4f16693df linux-samsung-i9070-ac7219c4b8dcec7bc5a598d42c6be0db4aa36332.tar.gz -84dab76407f10e1bc9072a53596a38d96acb129c67fbb8f8fe1c737e165ccaba283b1a20830c0ed6ec7a3183a85ccfee5f2918f99567f3bba8b3ffc01fc228e1 config-samsung-i9070.armhf +63295d5ff1af86765ef35cc175f133be9ba29b9a4e0aac13e69af6dcca1952730db8b4444ca62ba47214ff0c5720aa126e95db0829396ba934d272fdbeb74fb5 config-samsung-i9070.armhf ea1d3b5a234fa565e3c1a792de48f4fc4e6023d281d303c8e319c7ef28edc5739ab0e4dea0139a41f0a5c7d03e27921ccaa214fd0ac5c72245a094ce60128864 00_fix_return_address.patch -c8f12ecf578be0c4600563134079b980a1079b08ac868302af8821022befe873aa94c67b9690ba87f5967f0a48939d15e871dc2d2862bed7b6a1d0c9a95cfd8f 01_remove_ramdisks_from_initramfs.patch +3c8e15644eced6f73c5c7d3df0437f3a9f750f4ec32d744c9e4266ccccef9e38316a898227a898a9fc0696bee0281c0e14312de2944e27a696f18a42deabb383 01_remove_ramdisks_from_initramfs.patch ef5b912c26fea4ab882592bdf7487942c64b123de8d25d08d976f29743f311742ee2f773bf2d110ddb5095f254dbb0bd4487c5cfce77311929082599199e7ebd 02_reduce_lzo_compression.patch 27bba6d070db6f499d030680c020906fc3238dc60d90a9b2f0f3a355ef15beb227c1cf48b7858156264fe10f7943772ed00a837be36ba4b80de8199f0383e688 03_change_modules_install_dir.patch 47533412cc91d2ead046039c90180ebc459e157017be85dca69cd882a183963448beb973f2cb7eaccbcd35354b0ed6a668131cd39ea30393dd52fd93b7e26815 04_change_dhd_firmware_dir.patch +67278735e21c00d4208e76788d3d99ff1bd9c628608f60a73004f6deb8a4bc75fdf7c1e43108010c57aa6da06aa5e49292b109a2c4421212e181abaca45ea44d 05_fix_fb_rgb_mode.patch d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h ef01c51c138239a49c1d00ae0074a07fed267d64934cf3d436a8ff057b91692ee2d040a45eacbb0dc62d5017a708c4dca2fadc282c850fa72aeebcfa787e2cbc init" diff --git a/device/linux-samsung-i9070/config-samsung-i9070.armhf b/device/linux-samsung-i9070/config-samsung-i9070.armhf index a626e30d4..7d4f6f3c1 100644 --- a/device/linux-samsung-i9070/config-samsung-i9070.armhf +++ b/device/linux-samsung-i9070/config-samsung-i9070.armhf @@ -100,7 +100,7 @@ CONFIG_MM_OWNER=y # CONFIG_SYSFS_DEPRECATED is not set CONFIG_RELAY=y CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE="source/usr/u8500_initramfs.list" +CONFIG_INITRAMFS_SOURCE="usr/u8500_initramfs.list" CONFIG_INITRAMFS_ROOT_UID=0 CONFIG_INITRAMFS_ROOT_GID=0 # CONFIG_RD_GZIP is not set