xiaomi-tissot: Add firmware for WiFi and fix ramoops (!189)

Add firmware required to make WiFi work. Patch the kernel so the ramoops
dmesgs can be read properly without having to remove that header every
time.

[skip ci]: already built successfully in CI
This commit is contained in:
Ion Agorria 2019-02-04 22:45:54 +01:00 committed by Oliver Smith
parent 4346402695
commit 797f0d5319
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
4 changed files with 146 additions and 5 deletions

View file

@ -2,15 +2,15 @@
pkgname="device-xiaomi-tissot"
pkgdesc="Xiaomi A1"
pkgver=0.1
pkgrel=0
pkgrel=1
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="postmarketos-base linux-xiaomi-tissot mkbootimg mesa-dri-swrast msm-fb-refresher"
makedepends="devicepkg-dev"
source="deviceinfo
"
source="deviceinfo"
subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
build() {
devicepkg_build $startdir $pkgname
@ -20,4 +20,10 @@ package() {
devicepkg_package $startdir $pkgname
}
nonfree_firmware() {
pkgdesc="Firmware for xiaomi-tissot"
depends="linux-firmware-qcom firmware-xiaomi-tissot"
mkdir "$subpkgdir"
}
sha512sums="176aa6496dd4bc335fec4ba986348390b60233ba303d3b170650dbe3020e2a15438ca8708f2d9e5fc92e9dc8f3301fe7ba0f8840e953e4591a7bd7da22c0b459 deviceinfo"

View file

@ -3,7 +3,7 @@
pkgname="linux-xiaomi-tissot"
pkgver=3.18.71
pkgrel=1
pkgrel=2
pkgdesc="Xiaomi A1 kernel fork"
arch="aarch64"
_carch="arm64"
@ -39,6 +39,7 @@ source="
init-ignore-dm-if-skip_initramfs.patch
tweak-warn-once-skb_release_head_state.patch
fix-xorg-mdss-update-fb-info.patch
fix-ramoops-header.patch
"
builddir="$srcdir/${_repository}-${_commit}"
@ -90,4 +91,5 @@ b408f157cc025d410b38f5aee9be977e670e1ac3f195f6c3a6681446fa0c3887067d62a4f729cfcd
32f8180ae59351835f91ead8e38ae4933658c13bfe62bdbb32de82aecb16e1ff9e96333f4f129423ae8be4dc3210ee3bbf3fd0ea199df0f397ecb2f2efe37bcb init-reverse-skip_initramfs.patch
d97b343970bba978b0c99222e01d3a66abba9d7fe5725705021b4ab2895dd18df2c68bfbb894f05f2894714b958e1aa63ed5e09d19cbbff1204fdc7f246891b4 init-ignore-dm-if-skip_initramfs.patch
170a979908156f740d32fc3a8f74c2b2cb54420e12b81f2373fed1eb095159f1e03d3c24116a345f41ccd927fd93594b0a0e4b58a57ffe6869288f1ec030078c tweak-warn-once-skb_release_head_state.patch
a277af28a718f5caf94257005393aa92d62c96110a8ec6368ff62f2e0d871b69c56c4ce00174db637204d53fa63ad3a79b8d6141713dca0878e1f06fe0379caa fix-xorg-mdss-update-fb-info.patch"
a277af28a718f5caf94257005393aa92d62c96110a8ec6368ff62f2e0d871b69c56c4ce00174db637204d53fa63ad3a79b8d6141713dca0878e1f06fe0379caa fix-xorg-mdss-update-fb-info.patch
5abf30392e44372a01936ba59d9f392e835632fbd2356a4c50997652cd5c4ad4c142814145ab9263367558668a3b6cf5600886cd69d3108e6bd0718de10b0b6e fix-ramoops-header.patch"

View file

@ -0,0 +1,88 @@
The ramoops driver prepends a "====timestamp.timestamp-C|D\n"
header to the compressed record before handing it over to pstore
driver which doesn't know about the header. In pstore_decompress(),
the pstore driver reads the first "==" as a zlib header, so the
decompression always fails. For example, this causes the driver
to write /dev/pstore/dmesg-ramoops-0.enc.z instead of
/dev/pstore/dmesg-ramoops-0.
This patch makes the ramoops driver remove the header before
pstore decompression.
Signed-off-by: Ben Zhang <benzh@chromium.org>
---
fs/pstore/ram.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 3b57443..ec881b3 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -135,25 +135,27 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max,
return prz;
}
-static void ramoops_read_kmsg_hdr(char *buffer, struct timespec *time,
+static int ramoops_read_kmsg_hdr(char *buffer, struct timespec *time,
bool *compressed)
{
char data_type;
+ int header_length = 0;
- if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lu.%lu-%c\n",
- &time->tv_sec, &time->tv_nsec, &data_type) == 3) {
+ if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lu.%lu-%c\n%n", &time->tv_sec,
+ &time->tv_nsec, &data_type, &header_length) == 3) {
if (data_type == 'C')
*compressed = true;
else
*compressed = false;
- } else if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lu.%lu\n",
- &time->tv_sec, &time->tv_nsec) == 2) {
+ } else if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lu.%lu\n%n",
+ &time->tv_sec, &time->tv_nsec, &header_length) == 2) {
*compressed = false;
} else {
time->tv_sec = 0;
time->tv_nsec = 0;
*compressed = false;
}
+ return header_length;
}
static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
@@ -165,6 +167,7 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
ssize_t ecc_notice_size;
struct ramoops_context *cxt = psi->data;
struct persistent_ram_zone *prz;
+ int header_length;
prz = ramoops_get_next_prz(cxt->przs, &cxt->dump_read_cnt,
cxt->max_dump_cnt, id, type,
@@ -178,7 +181,13 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
if (!prz)
return 0;
+ if (!persistent_ram_old(prz))
+ return 0;
+
size = persistent_ram_old_size(prz);
+ header_length = ramoops_read_kmsg_hdr(persistent_ram_old(prz), time,
+ compressed);
+ size -= header_length;
/* ECC correction notice */
ecc_notice_size = persistent_ram_ecc_string(prz, NULL, 0);
@@ -187,8 +196,7 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
if (*buf == NULL)
return -ENOMEM;
- memcpy(*buf, persistent_ram_old(prz), size);
- ramoops_read_kmsg_hdr(*buf, time, compressed);
+ memcpy(*buf, (char *)persistent_ram_old(prz) + header_length, size);
persistent_ram_ecc_string(prz, *buf + size, ecc_notice_size + 1);
return size + ecc_notice_size;
--
2.1.0.rc2.206.gedb03e5

View file

@ -0,0 +1,45 @@
pkgname=firmware-xiaomi-tissot
pkgver=1
pkgrel=0
pkgdesc="Firmware files for Xiaomi Mi A1"
url="https://postmarketos.org"
arch="aarch64"
license="proprietary"
depends="wcnss-wlan"
options="!strip !check !archcheck"
# Source
_files="
wcnss.b00 wcnss.b01 wcnss.b02 wcnss.b04 wcnss.b06
wcnss.b09 wcnss.b10 wcnss.b11 wcnss.b12 wcnss.mdt
adsp.b00 adsp.b01 adsp.b02 adsp.b03 adsp.b04
adsp.b05 adsp.b06 adsp.b07 adsp.b08 adsp.b09
adsp.b10 adsp.b11 adsp.b12 adsp.b13 adsp.mdt
qdsp6m.qdb
a506_zap.b00 a506_zap.b01 a506_zap.b02 a506_zap.mdt
"
_files_prima="
WCNSS_wlan_dictionary.dat
WCNSS_qcom_cfg.ini
WCNSS_qcom_wlan_nv.bin
"
_commit="98cc201f4cef4372298206bc910a6599a95cd258"
source="$pkgname-$_commit.tar.gz::https://gitlab.com/IonAgorria/postmarketos-vendor-xiaomi-tissot/-/archive/$_commit/postmarketos-vendor-xiaomi-tissot-$_commit.tar.gz"
package() {
cd "$srcdir/postmarketos-vendor-xiaomi-tissot-${_commit}"
# /lib/firmware/postmarketos
for _i in $_files; do
install -D -m644 "$_i" \
"$pkgdir/lib/firmware/postmarketos/$_i"
done
# /lib/firmware/postmarketos/wlan/prima
for _i in $_files_prima; do
install -D -m644 "wlan/prima/$_i" \
"$pkgdir/lib/firmware/postmarketos/wlan/prima/$_i"
done
}
sha512sums="c459d6bf893ff62e6b4b96f4e4cafc3dcf7ac08bab99b8df577ad637b4714fb7fbfddf6cb1ab657bd59bc3c18715239a2117659b099fbd92e14b585f1400b179 firmware-xiaomi-tissot-98cc201f4cef4372298206bc910a6599a95cd258.tar.gz"