xiaomi-cereus: new device (Xiaomi Redmi 6) (MR 4408)

[ci:skip-build]: already built successfully in CI
This commit is contained in:
Jerin Philip 2023-09-19 22:51:04 +05:30 committed by Oliver Smith
parent dfc672e76e
commit 58e41997b5
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
6 changed files with 5769 additions and 0 deletions

View file

@ -0,0 +1,31 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-xiaomi-cereus
pkgdesc="Xiaomi Redmi 6"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="
linux-xiaomi-cereus
mkbootimg
postmarketos-base
msm-fb-refresher
"
makedepends="devicepkg-dev"
source="
deviceinfo
"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
}
sha512sums="
dc6b3c75e011242a2cb2f44d8549478933a34742022ca54addccfe77b6cc18f63eb600a8429814bff8a47cb5ec38f012f1e3bffb93073b782684c12c86f4c308 deviceinfo
"

View file

@ -0,0 +1,33 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell
# scripts.
deviceinfo_format_version="0"
deviceinfo_name="Xiaomi Redmi 6"
deviceinfo_manufacturer="Xiaomi"
deviceinfo_codename="xiaomi-cereus"
deviceinfo_year="2018"
deviceinfo_arch="armv7"
# Device related
deviceinfo_chassis="handset"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="720"
deviceinfo_screen_height="1440"
# Bootloader related
deviceinfo_flash_method="mtkclient"
deviceinfo_kernel_cmdline="bootopt=64S3,32S1,32S1 buildvariant=user"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_bootimg_mtk_mkimage="false"
deviceinfo_bootimg_dtb_second="false"
deviceinfo_flash_pagesize="2048"
deviceinfo_header_version="1"
deviceinfo_flash_offset_base="0x40000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x11b00000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x07880000"

View file

@ -0,0 +1,51 @@
From 1978be4d1641894fe7f1c6999d77a6a455b4c655 Mon Sep 17 00:00:00 2001
From: Jerin Philip <jerinphilip@live.in>
Date: Mon, 11 Sep 2023 02:15:18 +0530
Subject: [PATCH 1/2] gcc10 extern YYLOC global declaration
Based on https://lkml.org/lkml/2020/4/1/1206. In original patch, YYLOC declaration was removed.
However, using original patch, which removes yylloc declaration on 3.18.14 kernel version results in 'yylloc not declared' error.
See part of the original description below:
gcc 10 will default to -fno-common, which causes this error at link
time:
(.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here
This is because both dtc-lexer as well as dtc-parser define the same
global symbol yyloc. Before with -fcommon those were merged into one
defintion. The proper solution would be to to mark this as "extern",
---
scripts/dtc/dtc-lexer.l | 2 +-
scripts/dtc/dtc-lexer.lex.c_shipped | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
index 790fbf6cf2d7..e7eab4d7c5a9 100644
--- a/scripts/dtc/dtc-lexer.l
+++ b/scripts/dtc/dtc-lexer.l
@@ -38,7 +38,7 @@ LINECOMMENT "//".*\n
#include "srcpos.h"
#include "dtc-parser.tab.h"
-YYLTYPE yylloc;
+extern YYLTYPE yylloc;
extern bool treesource_error;
/* CAUTION: this will stop working if we ever use yyless() or yyunput() */
diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped
index ba525c2f9fc2..a2fe8dbc0fd3 100644
--- a/scripts/dtc/dtc-lexer.lex.c_shipped
+++ b/scripts/dtc/dtc-lexer.lex.c_shipped
@@ -637,7 +637,7 @@ char *yytext;
#include "srcpos.h"
#include "dtc-parser.tab.h"
-YYLTYPE yylloc;
+extern YYLTYPE yylloc;
extern bool treesource_error;
/* CAUTION: this will stop working if we ever use yyless() or yyunput() */
--
2.42.0

View file

@ -0,0 +1,905 @@
From d6adcf0b754b348beb3811b3d00bf967d309bf8c Mon Sep 17 00:00:00 2001
From: Jerin Philip <jerinphilip@live.in>
Date: Mon, 18 Sep 2023 03:43:42 +0530
Subject: [PATCH 2/2] Port `drvgen` scripts to Python3
---
Makefile | 2 +-
scripts/drvgen/drvgen.mk | 2 +-
tools/dct/DrvGen.py | 21 ++++++++-------
tools/dct/config/YuSu.cmp | 18 ++++++-------
tools/dct/obj/AdcObj.py | 4 +--
tools/dct/obj/ChipObj.py | 53 ++++++++++++++++++++-----------------
tools/dct/obj/ClkObj.py | 32 ++++++++++++----------
tools/dct/obj/EintObj.py | 37 +++++++++++++++-----------
tools/dct/obj/GpioObj.py | 29 +++++++++++---------
tools/dct/obj/I2cObj.py | 23 +++++++++-------
tools/dct/obj/KpdObj.py | 23 +++++++++-------
tools/dct/obj/Md1EintObj.py | 8 +++---
tools/dct/obj/PmicObj.py | 8 +++---
tools/dct/obj/PowerObj.py | 8 +++---
tools/dct/utility/util.py | 8 +++---
15 files changed, 150 insertions(+), 126 deletions(-)
diff --git a/Makefile b/Makefile
index 5b1bb35ea222..ad384088c138 100644
--- a/Makefile
+++ b/Makefile
@@ -361,7 +361,7 @@ GENKSYMS = scripts/genksyms/genksyms
INSTALLKERNEL := installkernel
DEPMOD = /sbin/depmod
PERL = perl
-PYTHON = python
+PYTHON = python3
CHECK = sparse
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
diff --git a/scripts/drvgen/drvgen.mk b/scripts/drvgen/drvgen.mk
index c4a0f25aa64f..2e84e630d38f 100644
--- a/scripts/drvgen/drvgen.mk
+++ b/scripts/drvgen/drvgen.mk
@@ -66,7 +66,7 @@ $(DRVGEN_FILE_LIST): $(DRVGEN_TOOL) $(DWS_FILE) $(DRVGEN_FIG) $(PROJ_DTS_FILES)
dws_path=$(srctree)/$(DRVGEN_PATH)/$$base_prj.dws ;\
if [ -f $$dws_path ] ; then \
mkdir -p $$prj_path ;\
- $(python) $(DRVGEN_TOOL) $$dws_path $$prj_path $$prj_path cust_dtsi;\
+ $(PYTHON) $(DRVGEN_TOOL) $$dws_path $$prj_path $$prj_path cust_dtsi;\
fi \
done
diff --git a/tools/dct/DrvGen.py b/tools/dct/DrvGen.py
index f6f845a7576d..7bc61e66b127 100755
--- a/tools/dct/DrvGen.py
+++ b/tools/dct/DrvGen.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (C) 2016 MediaTek Inc.
@@ -43,16 +43,17 @@ from utility.util import LogLevel
from utility.util import log
def usage():
- print '''
-usage: DrvGen [dws_path] [file_path] [log_path] [paras]...
+ print('usage: DrvGen [dws_path] [file_path] [log_path] [paras]...\n\n'+
-options and arguments:
+ 'options and arguments:\n\n'+
-dws_path : dws file path
-file_path : where you want to put generated files
-log_path : where to store the log files
-paras : parameter for generate wanted file
-'''
+ 'dws_path : dws file path\n'+
+ 'file_path : where you want to put generated files\n'+
+ 'log_path : where to store the log files\n'+
+ 'paras : parameter for generate wanted file\n'
+ )
+def cmp(a, b):
+ return (a > b) - (a < b)
def is_oldDws(path, gen_spec):
if not os.path.exists(path):
@@ -61,7 +62,7 @@ def is_oldDws(path, gen_spec):
try:
root = xml.dom.minidom.parse(dws_path)
- except Exception, e:
+ except Exception:
log(LogLevel.warn, '%s is not xml format, try to use old DCT!' %(dws_path))
if len(gen_spec) == 0:
log(LogLevel.warn, 'Please use old DCT UI to gen all files!')
diff --git a/tools/dct/config/YuSu.cmp b/tools/dct/config/YuSu.cmp
index 694f0299e4d7..c9e548f158ca 100644
--- a/tools/dct/config/YuSu.cmp
+++ b/tools/dct/config/YuSu.cmp
@@ -51,7 +51,7 @@ DT_EXT_MD_EXP
DT_EXT_MD_WDT
DT_EXT_MD_WK_UP
DT_EXT_MD_WK_UP_USB
-DT_EXT_MD_EXP
+#DT_EXT_MD_EXP
EVDO_DT_EXT_MDM_RDY
EVDO_DT_EXT_MDM_WAKE_AP
EVDO_DT_EXT_MDM_RST_IND
@@ -278,7 +278,7 @@ GPIO_CAMERA_RDN0_B_PIN
GPIO_CAMERA_RDP0_B_PIN
GPIO_CAMERA_RDN1_B_PIN
GPIO_CAMERA_RDP1_B_PIN
-GPIO_PMIC_EINT_PIN
+#GPIO_PMIC_EINT_PIN
GPIO_PCM_DAICLK_PIN
GPIO_PCM_DAIPCMOUT_PIN
GPIO_PCM_DAIPCMIN_PIN
@@ -343,7 +343,7 @@ GPIO_VBUS_DETECT_PIN
GPIO_USB_DEFAULT_DEVICE_MODE
GPIO_HEADSET_SW_EN_PIN
GPIO_HEADSET_JPOLE_PIN
-GPIO_HEADSET_REMOTE_BUTTON_PIN
+#GPIO_HEADSET_REMOTE_BUTTON_PIN
GPIO_DISP_LRSTB_PIN
GPIO_HDMI_I2S_OUT_CK_PIN
GPIO_HDMI_I2S_OUT_WS_PIN
@@ -479,8 +479,8 @@ GPIO_TD_HIF_RD_PIN
GPIO_CAMERA_2_CMPDN_PIN
GPIO_CAMERA_2_CMRST_PIN
GPIO_CAMERA_2_CMMCLK_PIN
-GPIO_CAMERA_2_CMRST_PIN
-GPIO_CAMERA_2_CMPDN_PIN
+#GPIO_CAMERA_2_CMRST_PIN
+#GPIO_CAMERA_2_CMPDN_PIN
GPIO_CHR_PSEL_PIN
GPIO_CHR_CE_PIN
GPIO_CHR_SPM_PIN
@@ -591,7 +591,7 @@ GPIO_LTE_WDT_EINT_PIN
GPIO_LTE_POWER_PIN
GPIO_LTE_RESET_PIN
GPIO_LTE_WK_MD_PIN
-GPIO_SWITCH1_1V8_PIN
+#GPIO_SWITCH1_1V8_PIN
GPIO_CAMERA_MAIN_DVDD_ENADBLE_PIN
GPIO_HIFI_LDO1V8_EN_PIN
GPIO_SMARTPA_RST_PIN
@@ -612,7 +612,7 @@ GPIO_EDP_EINT_PIN
GPIO_EDP_ENPSR_PIN
GPIO_EDP_SYSRSTN_PIN
GPIO_EDP_STANDBY_PIN
-GPIO_EXT_BUCK_OC_EINT_PIN
+#GPIO_EXT_BUCK_OC_EINT_PIN
GPIO_VOW_CLK_MISO_PIN
GPIO_G2_TXEN_PIN
GPIO_G2_TXD3_PIN
@@ -655,7 +655,7 @@ GPIO_SMARTPA_I2S_WS_PIN
GPIO_SMARTPA_I2S_DOUT_PIN
GPIO_SMARTPA_I2S_DIN_PIN
GPIO_SMARTPA_I2S_BCK_PIN
-GPIO_SMARTPA_RST_PIN
+#GPIO_SMARTPA_RST_PIN
GPIO_SMARTPA_EINT_PIN
GPIO_SMARTPA_LDO_EN_PIN
GPIO_EXT_SPKAMP2_EN_PIN
@@ -751,7 +751,7 @@ GPIO_FUSB340_USBTYPEC_NOE_PIN
GPIO_SIL7033_RST_PIN
GPIO_HP_DEPOP_SWITCH_PIN
GPIO_CMMCLK1_PIN
-GPIO_EINT_CHG_STAT_PIN
+#GPIO_EINT_CHG_STAT_PIN
GPIO_FINGERPRINT_RST_PIN
GPIO_ANT_SEL0_PIN
GPIO_ANT_SEL1_PIN
diff --git a/tools/dct/obj/AdcObj.py b/tools/dct/obj/AdcObj.py
index f9820275d436..c2967ec13103 100755
--- a/tools/dct/obj/AdcObj.py
+++ b/tools/dct/obj/AdcObj.py
@@ -77,9 +77,9 @@ class AdcObj(ModuleObj):
value = ModuleObj.get_data(self)[key]
if value == "TEMPERATURE":
- gen_str += '''\t\tmediatek,%s0 = <%d>;\n''' %(value.lower(), string.atoi(key[3:]))
+ gen_str += '''\t\tmediatek,%s0 = <%d>;\n''' %(value.lower(), int(key[3:]))
else:
- gen_str += '''\t\tmediatek,%s = <%d>;\n''' %(value.lower(), string.atoi(key[3:]))
+ gen_str += '''\t\tmediatek,%s = <%d>;\n''' %(value.lower(), int(key[3:]))
gen_str += '''\t\tstatus = \"okay\";\n'''
gen_str += '''\t};\n'''
diff --git a/tools/dct/obj/ChipObj.py b/tools/dct/obj/ChipObj.py
index 54d63516f746..88653646f61d 100755
--- a/tools/dct/obj/ChipObj.py
+++ b/tools/dct/obj/ChipObj.py
@@ -16,31 +16,31 @@ import os
import collections
import xml.dom.minidom
-from GpioObj import GpioObj
-from GpioObj import GpioObj_whitney
-from GpioObj import GpioObj_MT6759
-from GpioObj import GpioObj_MT6739
-from GpioObj import GpioObj_MT6771
-from GpioObj import GpioObj_MT6763
-from EintObj import EintObj
-from EintObj import EintObj_MT6750S
-from EintObj import EintObj_MT6739
-from AdcObj import AdcObj
-from ClkObj import ClkObj
-from ClkObj import ClkObj_Everest
-from ClkObj import ClkObj_Olympus
-from ClkObj import ClkObj_Rushmore
-from ClkObj import ClkObj_MT6779
-from I2cObj import I2cObj
-from I2cObj import I2cObj_MT6759
-from I2cObj import I2cObj_MT6775
-from PmicObj import PmicObj
-from PmicObj import PmicObj_MT6758
-from Md1EintObj import Md1EintObj
-from Md1EintObj import Md1EintObj_MT6739
-from PowerObj import PowerObj
-from KpdObj import KpdObj
-from ModuleObj import ModuleObj
+from . GpioObj import GpioObj
+from . GpioObj import GpioObj_whitney
+from . GpioObj import GpioObj_MT6759
+from . GpioObj import GpioObj_MT6739
+from . GpioObj import GpioObj_MT6771
+from . GpioObj import GpioObj_MT6763
+from . EintObj import EintObj
+from . EintObj import EintObj_MT6750S
+from . EintObj import EintObj_MT6739
+from . AdcObj import AdcObj
+from . ClkObj import ClkObj
+from . ClkObj import ClkObj_Everest
+from . ClkObj import ClkObj_Olympus
+from . ClkObj import ClkObj_Rushmore
+from . ClkObj import ClkObj_MT6779
+from . I2cObj import I2cObj
+from . I2cObj import I2cObj_MT6759
+from . I2cObj import I2cObj_MT6775
+from . PmicObj import PmicObj
+from . PmicObj import PmicObj_MT6758
+from . Md1EintObj import Md1EintObj
+from . Md1EintObj import Md1EintObj_MT6739
+from . PowerObj import PowerObj
+from . KpdObj import KpdObj
+from . ModuleObj import ModuleObj
from utility.util import log
from utility.util import LogLevel
@@ -56,6 +56,9 @@ para_map = {'adc':['adc_h', 'adc_dtsi'],\
'pmic':['pmic_drv_h', 'pmic_drv_c', 'pmic_h', 'pmic_c', 'pmic_dtsi'],\
'power':['power_h']}
+def cmp(a, b):
+ return (a > b) - (a < b)
+
class ChipObj:
def __init__(self, path, dest):
self.__epFlag = False
diff --git a/tools/dct/obj/ClkObj.py b/tools/dct/obj/ClkObj.py
index 445fc7caf1b1..0f0e42c053a7 100755
--- a/tools/dct/obj/ClkObj.py
+++ b/tools/dct/obj/ClkObj.py
@@ -14,11 +14,11 @@
import re
import string
-import ConfigParser
+import configparser
import xml.dom.minidom
-from ModuleObj import ModuleObj
+from . ModuleObj import ModuleObj
from data.ClkData import ClkData
from data.ClkData import OldClkData
from data.ClkData import NewClkData
@@ -27,6 +27,10 @@ from utility.util import LogLevel
from utility.util import sorted_key
DEFAULT_AUTOK = 'AutoK'
+
+def cmp(a, b):
+ return (a > b) - (a < b)
+
class ClkObj(ModuleObj):
def __init__(self):
ModuleObj.__init__(self, 'cust_clk_buf.h', 'cust_clk_buf.dtsi')
@@ -62,17 +66,17 @@ class ClkObj(ModuleObj):
return True
def get_cfgInfo(self):
- cp = ConfigParser.ConfigParser(allow_no_value=True)
+ cp = configparser.ConfigParser(allow_no_value=True)
cp.read(ModuleObj.get_figPath())
- count = string.atoi(cp.get('CLK_BUF', 'CLK_BUF_COUNT'))
+ count = int(cp.get('CLK_BUF', 'CLK_BUF_COUNT'))
self.__count = count
ops = cp.options('CLK_BUF')
for op in ops:
if op == 'clk_buf_count':
- self.__count = string.atoi(cp.get('CLK_BUF', op))
- ClkData._count = string.atoi(cp.get('CLK_BUF', op))
+ self.__count = int(cp.get('CLK_BUF', op))
+ ClkData._count = int(cp.get('CLK_BUF', op))
continue
value = cp.get('CLK_BUF', op)
@@ -80,8 +84,8 @@ class ClkObj(ModuleObj):
data = OldClkData()
data.set_curList(var_list[2:])
- data.set_defVarName(string.atoi(var_list[0]))
- data.set_defCurrent(string.atoi(var_list[1]))
+ data.set_defVarName(int(var_list[0]))
+ data.set_defCurrent(int(var_list[1]))
key = op[16:].upper()
ModuleObj.set_data(self, key, data)
@@ -358,10 +362,10 @@ class ClkObj_Rushmore(ClkObj):
ClkObj.parse(self, node)
def get_cfgInfo(self):
- cp = ConfigParser.ConfigParser(allow_no_value=True)
+ cp = configparser.ConfigParser(allow_no_value=True)
cp.read(ModuleObj.get_figPath())
- count = string.atoi(cp.get('CLK_BUF', 'CLK_BUF_COUNT'))
+ count = int(cp.get('CLK_BUF', 'CLK_BUF_COUNT'))
self.__count = count
def read(self, node):
@@ -483,7 +487,7 @@ class ClkObj_MT6779(ClkObj):
return True
def get_cfgInfo(self):
- cp = ConfigParser.ConfigParser(allow_no_value=True)
+ cp = configparser.ConfigParser(allow_no_value=True)
cp.read(ModuleObj.get_figPath())
max_count = self.get_max_count(cp)
@@ -499,19 +503,19 @@ class ClkObj_MT6779(ClkObj):
var_list = value.split(r'/')
data = NewClkData()
- data.set_defVarName(string.atoi(var_list[0]))
+ data.set_defVarName(int(var_list[0]))
buf_output_list = var_list[1].split(r":")
# only -1 means no data
if len(buf_output_list) > 1:
data.cur_buf_output_list = buf_output_list[1:]
- data.set_def_buf_output(string.atoi(buf_output_list[0]))
+ data.set_def_buf_output(int(buf_output_list[0]))
driving_control_list = var_list[2].split(r":")
# only -1 means no data
if len(driving_control_list) > 1:
data.cur_driving_control_list = driving_control_list[1:]
- data.set_def_driving_control(string.atoi(driving_control_list[0]))
+ data.set_def_driving_control(int(driving_control_list[0]))
key = op[16:].upper()
ModuleObj.set_data(self, key, data)
diff --git a/tools/dct/obj/EintObj.py b/tools/dct/obj/EintObj.py
index 961e31152cdc..2292110e3bd0 100755
--- a/tools/dct/obj/EintObj.py
+++ b/tools/dct/obj/EintObj.py
@@ -16,7 +16,7 @@ import re
import os
import string
-import ConfigParser
+import configparser
import xml.dom.minidom
from data.EintData import EintData
@@ -28,6 +28,11 @@ from utility.util import compare
from obj.ModuleObj import ModuleObj
from obj.GpioObj import GpioObj
+
+def cmp(a, b):
+ return (a > b) - (a < b)
+
+
class EintObj(ModuleObj):
def __init__(self, gpio_obj):
ModuleObj.__init__(self, 'cust_eint.h', 'cust_eint.dtsi')
@@ -84,7 +89,7 @@ class EintObj(ModuleObj):
ModuleObj.gen_spec(self, para)
def get_cfgInfo(self):
- cp = ConfigParser.ConfigParser(allow_no_value=True)
+ cp = configparser.ConfigParser(allow_no_value=True)
cp.read(ModuleObj.get_figPath())
ops = cp.options('GPIO')
@@ -94,14 +99,14 @@ class EintObj(ModuleObj):
value = cp.get('GPIO', op)
list = re.split(r' +|\t+', value)
- map[string.atoi(re.findall(r'\d+', op)[0])] = string.atoi(list[len(list)-2])
+ map[int(re.findall(r'\d+', op)[0])] = int(list[len(list)-2])
mode_map[op] = list[0:len(list)-2]
EintData.set_mapTable(map)
EintData.set_modeMap(mode_map)
if cp.has_option('EINT', 'EINT_MAP_COUNT'):
- self.__map_count = string.atoi(cp.get('EINT', 'EINT_MAP_COUNT'))
+ self.__map_count = int(cp.get('EINT', 'EINT_MAP_COUNT'))
if cp.has_option('EINT', 'INTERNAL_EINT'):
info = cp.get('EINT', 'INTERNAL_EINT')
@@ -132,7 +137,7 @@ class EintObj(ModuleObj):
self.__gpio_obj.set_eint_map_table(EintData._map_table)
#def compare(self, value):
- #return string.atoi(value[4:])
+ #return int(value[4:])
def fill_hFile(self):
gen_str = ''
@@ -191,7 +196,7 @@ class EintObj(ModuleObj):
count = 0
if self.__map_count == 0:
- for i in range(0, string.atoi(self.__count)):
+ for i in range(0, int(self.__count)):
if EintData.get_gpioNum(i) >= 0:
count += 1
count += len(EintData._int_eint)
@@ -245,23 +250,23 @@ class EintObj(ModuleObj):
gpio_vec= []
for key in EintData._builtin_map.keys():
- if string.atoi(eint_num) == string.atoi(key):
+ if int(eint_num) == int(key):
temp_map = EintData._builtin_map[key]
for key in temp_map.keys():
gpio_vec.append(key)
if flag:
for item in temp_map.keys():
- item_data = self.__gpio_obj.get_gpioData(string.atoi(item))
+ item_data = self.__gpio_obj.get_gpioData(int(item))
- if item_data.get_defMode() == string.atoi(temp_map[item].split(':')[0]):
+ if item_data.get_defMode() == int(temp_map[item].split(':')[0]):
gpio_vec = []
gpio_vec.append(item)
return gpio_vec
break
- gpio_num = EintData.get_gpioNum(string.atoi(eint_num))
+ gpio_num = EintData.get_gpioNum(int(eint_num))
if gpio_num >= 0:
gpio_vec.append(gpio_num)
if flag:
@@ -301,7 +306,7 @@ class EintObj(ModuleObj):
temp = 'IRQ_TYPE_LEVEL_LOW'
gen_str += '''\tinterrupts = <%s %s>;\n''' %(self.refGpio(key[4:], True)[0], temp)
- gen_str += '''\tdebounce = <%s %d>;\n''' %(self.refGpio(key[4:], True)[0], string.atoi(value.get_debounceTime()) * 1000)
+ gen_str += '''\tdebounce = <%s %d>;\n''' %(self.refGpio(key[4:], True)[0], int(value.get_debounceTime()) * 1000)
gen_str += '''\tstatus = \"okay\";\n'''
gen_str += '''};\n'''
gen_str += '''\n'''
@@ -361,7 +366,7 @@ class EintObj_MT6739(EintObj):
gen_str += '''\tinterrupts = <%s %s %s %d>;\n''' % (key[4:], temp, self.refGpio(key[4:], True)[0], self.refGpio_defMode(key[4:], True))
if cmp(value.get_debounceEnable(), 'Enable') == 0:
gen_str += '''\tdeb-gpios = <&pio %s 0>;\n''' % (self.refGpio(key[4:], True)[0])
- gen_str += '''\tdebounce = <%d>;\n''' % (string.atoi(value.get_debounceTime()) * 1000)
+ gen_str += '''\tdebounce = <%d>;\n''' % (int(value.get_debounceTime()) * 1000)
gen_str += '''\tstatus = \"okay\";\n'''
gen_str += '''};\n'''
gen_str += '''\n'''
@@ -375,20 +380,20 @@ class EintObj_MT6739(EintObj):
refGpio_defMode = 0
for key in EintData._builtin_map.keys():
- if string.atoi(eint_num) == string.atoi(key):
+ if int(eint_num) == int(key):
temp_map = EintData._builtin_map[key]
if flag:
for item in temp_map.keys():
- item_data = self.get_gpioObj().get_gpioData(string.atoi(item))
+ item_data = self.get_gpioObj().get_gpioData(int(item))
- if item_data.get_defMode() == string.atoi(temp_map[item].split(':')[0]):
+ if item_data.get_defMode() == int(temp_map[item].split(':')[0]):
refGpio_defMode = item_data.get_defMode()
return refGpio_defMode
break
- gpio_num = EintData.get_gpioNum(string.atoi(eint_num))
+ gpio_num = EintData.get_gpioNum(int(eint_num))
if gpio_num >= 0:
if flag:
item_data = self.get_gpioObj().get_gpioData(gpio_num)
diff --git a/tools/dct/obj/GpioObj.py b/tools/dct/obj/GpioObj.py
index a5765d5fab21..6b137ec29617 100755
--- a/tools/dct/obj/GpioObj.py
+++ b/tools/dct/obj/GpioObj.py
@@ -16,19 +16,22 @@ import re
import os
import sys
import string
-import ConfigParser
+import configparser
import xml.dom.minidom
from data.GpioData import GpioData
from data.EintData import EintData
-from ModuleObj import ModuleObj
-import ChipObj
+from . ModuleObj import ModuleObj
+#from . ChipObj import ChipObj
from utility.util import compare
from utility.util import sorted_key
from utility.util import log
from utility.util import LogLevel
+def cmp(a, b):
+ return (a > b) - (a < b)
+
class GpioObj(ModuleObj):
def __init__(self):
ModuleObj.__init__(self,'cust_gpio_boot.h', 'cust_gpio.dtsi')
@@ -41,7 +44,7 @@ class GpioObj(ModuleObj):
self.__gpio_column_enable = True
def get_cfgInfo(self):
- cp = ConfigParser.ConfigParser(allow_no_value=True)
+ cp = configparser.ConfigParser(allow_no_value=True)
cp.read(ModuleObj.get_cmpPath())
# get GPIO_FREQ section
@@ -71,7 +74,7 @@ class GpioObj(ModuleObj):
GpioData._modeMap[op] = temp
data = GpioData()
- data.set_smtNum(string.atoi(list[len(list)-1]))
+ data.set_smtNum(int(list[len(list)-1]))
ModuleObj.set_data(self, op.lower(), data)
if cp.has_option('Chip Type', 'GPIO_COLUMN_ENABLE'):
@@ -84,7 +87,7 @@ class GpioObj(ModuleObj):
for node in nodes:
if node.nodeType == xml.dom.Node.ELEMENT_NODE:
if cmp(node.nodeName, 'count') == 0:
- GpioData._count = string.atoi(node.childNodes[0].nodeValue)
+ GpioData._count = int(node.childNodes[0].nodeValue)
continue
eintNode = node.getElementsByTagName('eint_mode')
@@ -103,7 +106,7 @@ class GpioObj(ModuleObj):
iesNode = node.getElementsByTagName('ies')
drvCurNode = node.getElementsByTagName('drv_cur')
- num = string.atoi(node.nodeName[4:])
+ num = int(node.nodeName[4:])
if num >= len(ModuleObj.get_data(self)):
break
data = ModuleObj.get_data(self)[node.nodeName]
@@ -115,7 +118,7 @@ class GpioObj(ModuleObj):
data.set_eintMode(flag)
if len(defmNode):
- data.set_defMode(string.atoi(defmNode[0].childNodes[0].nodeValue))
+ data.set_defMode(int(defmNode[0].childNodes[0].nodeValue))
if len(modsNode) != 0 and len(modsNode[0].childNodes) != 0:
str = modsNode[0].childNodes[0].nodeValue
@@ -676,8 +679,8 @@ class GpioObj_MT6739(GpioObj_MT6759):
GpioObj_MT6759.__init__(self)
def get_eint_index(self, gpio_index):
- if string.atoi(gpio_index) in GpioData._map_table.keys():
- return GpioData._map_table[string.atoi(gpio_index)]
+ if int(gpio_index) in GpioData._map_table.keys():
+ return GpioData._map_table[int(gpio_index)]
return -1
def fill_pinctrl_hFile(self):
@@ -727,7 +730,7 @@ class GpioObj_MT6771(GpioObj_MT6739):
if "GPIO_INIT_NO_COVER" in value.get_varNames():
continue
- num = string.atoi(key[4:])
+ num = int(key[4:])
defMode = value.get_defMode()
dout = 1 if value.get_outHigh() else 0
pullEn = 1 if value.get_inPullEn() else 0
@@ -749,7 +752,7 @@ class GpioObj_MT6763(GpioObj_MT6759):
for key in sorted_key(ModuleObj.get_data(self).keys()):
value = ModuleObj.get_data(self)[key]
- num = string.atoi(key[4:])
+ num = int(key[4:])
defMode = value.get_defMode()
dout = 1 if value.get_outHigh() else 0
pullEn = 1 if value.get_inPullEn() else 0
@@ -761,4 +764,4 @@ class GpioObj_MT6763(GpioObj_MT6759):
gen_str = gen_str[0: len(gen_str) - 4]
gen_str += ';'
gen_str += '''\n};\n'''
- return gen_str
\ No newline at end of file
+ return gen_str
diff --git a/tools/dct/obj/I2cObj.py b/tools/dct/obj/I2cObj.py
index 1d73e27166d5..dbd37a48b5a4 100755
--- a/tools/dct/obj/I2cObj.py
+++ b/tools/dct/obj/I2cObj.py
@@ -15,14 +15,17 @@
import re
import string
import xml.dom.minidom
-import ConfigParser
+import configparser
-from ModuleObj import ModuleObj
+from . ModuleObj import ModuleObj
#from utility import util
from utility.util import sorted_key
from data.I2cData import I2cData
from data.I2cData import BusData
-import ChipObj
+#from . ChipObj import ChipObj
+
+def cmp(a, b):
+ return (a > b) - (a < b)
class I2cObj(ModuleObj):
_busList = []
@@ -33,11 +36,11 @@ class I2cObj(ModuleObj):
#self.__bBusEnable = True
def get_cfgInfo(self):
- cp = ConfigParser.ConfigParser(allow_no_value=True)
+ cp = configparser.ConfigParser(allow_no_value=True)
cp.read(ModuleObj.get_figPath())
- I2cData._i2c_count = string.atoi(cp.get('I2C', 'I2C_COUNT'))
- I2cData._channel_count = string.atoi(cp.get('I2C', 'CHANNEL_COUNT'))
+ I2cData._i2c_count = int(cp.get('I2C', 'I2C_COUNT'))
+ I2cData._channel_count = int(cp.get('I2C', 'CHANNEL_COUNT'))
if cp.has_option('Chip Type', 'I2C_BUS'):
flag = cp.get('Chip Type', 'I2C_BUS')
@@ -128,7 +131,7 @@ class I2cObj(ModuleObj):
if self._bBusEnable:
- gen_str += '''\tclock-frequency = <%d>;\n''' %(string.atoi(self._busList[i].get_speed()) * 1000)
+ gen_str += '''\tclock-frequency = <%d>;\n''' %(int(self._busList[i].get_speed()) * 1000)
temp_str = ''
if cmp(self._busList[i].get_enable(), 'false') == 0:
@@ -175,7 +178,7 @@ class I2cObj_MT6759(I2cObj):
if self._bBusEnable:
- gen_str += '''\tclock-frequency = <%d>;\n''' %(string.atoi(self._busList[i].get_speed()) * 1000)
+ gen_str += '''\tclock-frequency = <%d>;\n''' %(int(self._busList[i].get_speed()) * 1000)
temp_str = ''
if cmp(self._busList[i].get_enable(), 'false') == 0:
@@ -213,7 +216,7 @@ class I2cObj_MT6775(I2cObj):
if self._bBusEnable:
- gen_str += '''\tclock-frequency = <%d>;\n''' %(string.atoi(self._busList[i].get_speed()) * 1000)
+ gen_str += '''\tclock-frequency = <%d>;\n''' %(int(self._busList[i].get_speed()) * 1000)
temp_str = ''
if cmp(self._busList[i].get_enable(), 'false') == 0:
@@ -237,4 +240,4 @@ class I2cObj_MT6775(I2cObj):
gen_str += '''};\n\n'''
- return gen_str
\ No newline at end of file
+ return gen_str
diff --git a/tools/dct/obj/KpdObj.py b/tools/dct/obj/KpdObj.py
index 6dae46f25722..0f9fee6bf5fb 100755
--- a/tools/dct/obj/KpdObj.py
+++ b/tools/dct/obj/KpdObj.py
@@ -14,14 +14,17 @@
import re
import string
-import ConfigParser
+import configparser
import xml.dom.minidom
-from ModuleObj import ModuleObj
+from . ModuleObj import ModuleObj
from utility.util import LogLevel
from utility.util import log
from data.KpdData import KpdData
+def cmp(a, b):
+ return (a > b) - (a < b)
+
class KpdObj(ModuleObj):
def __init__(self):
@@ -29,20 +32,20 @@ class KpdObj(ModuleObj):
def get_cfgInfo(self):
- cp = ConfigParser.ConfigParser(allow_no_value=True)
+ cp = configparser.ConfigParser(allow_no_value=True)
cp.read(ModuleObj.get_cmpPath())
ops = cp.options('Key_definition')
for op in ops:
- KpdData._keyValueMap[op.upper()] = string.atoi(cp.get('Key_definition', op))
+ KpdData._keyValueMap[op.upper()] = int(cp.get('Key_definition', op))
KpdData._keyValueMap['NC'] = 0
cp.read(ModuleObj.get_figPath())
if cp.has_option('KEYPAD_EXTEND_TYPE', 'KEY_ROW'):
- KpdData.set_row_ext(string.atoi(cp.get('KEYPAD_EXTEND_TYPE', 'KEY_ROW')))
+ KpdData.set_row_ext(int(cp.get('KEYPAD_EXTEND_TYPE', 'KEY_ROW')))
if cp.has_option('KEYPAD_EXTEND_TYPE', 'KEY_COLUMN'):
- KpdData.set_col_ext(string.atoi(cp.get('KEYPAD_EXTEND_TYPE', 'KEY_COLUMN')))
+ KpdData.set_col_ext(int(cp.get('KEYPAD_EXTEND_TYPE', 'KEY_COLUMN')))
return True
@@ -51,11 +54,11 @@ class KpdObj(ModuleObj):
for node in nodes:
if node.nodeType == xml.dom.Node.ELEMENT_NODE:
if node.nodeName == 'row':
- row = string.atoi(node.childNodes[0].nodeValue)
+ row = int(node.childNodes[0].nodeValue)
KpdData.set_row(row)
if node.nodeName == 'column':
- col = string.atoi(node.childNodes[0].nodeValue)
+ col = int(node.childNodes[0].nodeValue)
KpdData.set_col(col)
if node.nodeName == 'keyMatrix':
@@ -94,7 +97,7 @@ class KpdObj(ModuleObj):
KpdData._modeKeys['FACTORY'] = keys[2]
if node.nodeName == 'pwrKeyEint_gpioNum':
- num = string.atoi(node.childNodes[0].nodeValue)
+ num = int(node.childNodes[0].nodeValue)
KpdData.set_gpioNum(num)
if node.nodeName == 'pwrKeyUtility':
@@ -127,7 +130,7 @@ class KpdObj(ModuleObj):
KpdData.set_gpioDinHigh(flag)
if node.nodeName == 'pressPeriod':
- time = string.atoi(node.childNodes[0].nodeValue)
+ time = int(node.childNodes[0].nodeValue)
KpdData.set_pressTime(time)
if node.nodeName == 'keyType':
diff --git a/tools/dct/obj/Md1EintObj.py b/tools/dct/obj/Md1EintObj.py
index 30044c434278..129c86a8fb2a 100755
--- a/tools/dct/obj/Md1EintObj.py
+++ b/tools/dct/obj/Md1EintObj.py
@@ -12,7 +12,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See http://www.gnu.org/licenses/gpl-2.0.html for more details.
-import ConfigParser
+import configparser
import string
import xml.dom.minidom
from itertools import dropwhile
@@ -20,7 +20,7 @@ import re
from utility import util
from utility.util import sorted_key
-from ModuleObj import ModuleObj
+from . ModuleObj import ModuleObj
from data.Md1EintData import Md1EintData
from utility.util import LogLevel
@@ -32,7 +32,7 @@ class Md1EintObj(ModuleObj):
def get_cfgInfo(self):
# ConfigParser accept ":" and "=", so SRC_PIN will be treated specially
- cp = ConfigParser.ConfigParser(allow_no_value=True)
+ cp = configparser.ConfigParser(allow_no_value=True)
cp.read(ModuleObj.get_figPath())
if cp.has_option('Chip Type', 'MD1_EINT_SRC_PIN'):
@@ -238,4 +238,4 @@ class Md1EintObj_MT6739(Md1EintObj):
gen_str += '''\n'''
- return gen_str
\ No newline at end of file
+ return gen_str
diff --git a/tools/dct/obj/PmicObj.py b/tools/dct/obj/PmicObj.py
index 2414c00bd7d5..029f501f60e7 100755
--- a/tools/dct/obj/PmicObj.py
+++ b/tools/dct/obj/PmicObj.py
@@ -14,10 +14,10 @@
import sys, os
import re
-import ConfigParser
+import configparser
import xml.dom.minidom
-from ModuleObj import ModuleObj
+from . ModuleObj import ModuleObj
from data.PmicData import PmicData
from utility.util import log
@@ -25,6 +25,8 @@ from utility.util import LogLevel
from utility.util import compare
from utility.util import sorted_key
+def cmp(a, b):
+ return (a > b) - (a < b)
class PmicObj(ModuleObj):
def __init__(self):
@@ -39,7 +41,7 @@ class PmicObj(ModuleObj):
def get_cfgInfo(self):
- cp = ConfigParser.ConfigParser(allow_no_value=True)
+ cp = configparser.ConfigParser(allow_no_value=True)
cp.read(ModuleObj.get_cmpPath())
PmicData._var_list = cp.options('APPLICATION')
diff --git a/tools/dct/obj/PowerObj.py b/tools/dct/obj/PowerObj.py
index 6cff9bf5d8f8..77eba3968805 100755
--- a/tools/dct/obj/PowerObj.py
+++ b/tools/dct/obj/PowerObj.py
@@ -15,15 +15,15 @@
import sys,os
import re
import string
-import ConfigParser
+import configparser
import xml.dom.minidom
-import ChipObj
+#from . ChipObj import ChipObj
from data.PowerData import PowerData
from utility.util import log
from utility.util import LogLevel
from utility.util import sorted_key
-from ModuleObj import ModuleObj
+from . ModuleObj import ModuleObj
class PowerObj(ModuleObj):
def __init__(self):
@@ -31,7 +31,7 @@ class PowerObj(ModuleObj):
self.__list = {}
def getCfgInfo(self):
- cp = ConfigParser.ConfigParser(allow_no_value=True)
+ cp = configparser.ConfigParser(allow_no_value=True)
cp.read(ModuleObj.get_figPath())
self.__list = cp.options('POWER')
diff --git a/tools/dct/utility/util.py b/tools/dct/utility/util.py
index 8c0b16e17fb5..3f52908b07ec 100755
--- a/tools/dct/utility/util.py
+++ b/tools/dct/utility/util.py
@@ -27,16 +27,16 @@ class LogLevel:
def log(level, msg):
if level == LogLevel.info:
- print LEVEL_INFO + msg
+ print(LEVEL_INFO + msg)
elif level == LogLevel.warn:
- print LEVEL_WARN + msg
+ print(LEVEL_WARN + msg)
elif level == LogLevel.error:
- print LEVEL_ERROR + msg
+ print(LEVEL_ERROR + msg)
def compare(value):
lst = re.findall(r'\d+', value)
if len(lst) != 0:
- return string.atoi(lst[0])
+ return int(lst[0])
# if can not find numbers
return value
--
2.42.0

View file

@ -0,0 +1,60 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm/configs/ranchu_defconfig
pkgname=linux-xiaomi-cereus
pkgver=4.9.119
pkgrel=0
pkgdesc="Xiaomi Redmi 6 kernel fork"
arch="armv7"
_carch="arm"
_flavor="xiaomi-cereus"
url="https://github.com/xiaomi-mt6765/android_kernel_xiaomi_mt6765"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="
bash
bc
bison
devicepkg-dev
findutils
flex
openssl-dev
perl
python3
"
# Source
_repository="android_kernel_xiaomi_mt6765"
_commit="31dbe7b6881b35094fa220a68f6c476c615f10dc"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://github.com/xiaomi-mt6765/$_repository/archive/$_commit.tar.gz
$_config
0001-gcc10-extern-YYLOC-global-declaration.patch
0002-Port-drvgen-scripts-to-Python3.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" KBUILD_VERBOSE=0
}
package() {
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" \
"$_flavor" "$_outdir"
}
sha512sums="
c543d691eac482c6bef8c6b5c42cf2643e53745ac437c659de6b31720e5e879cc5ecfab1ac63c60eea24acb7a9e40db5e54d3ac5a461c6136d073bdc1ff3560f linux-xiaomi-cereus-31dbe7b6881b35094fa220a68f6c476c615f10dc.tar.gz
601be85e17467b0afb1bb34acc3cb878b70555acf9dc95fe2bec28991c725f7e8c088c28ad7837329a326df5352fad715f82b1b5e6d1a455df2761463bd4e701 config-xiaomi-cereus.armv7
6d3dd281d69b561ab18693b07b72fe1bc87626a27f72ae1b0f72be2bc42fe45611bf3d8d35543107ac5673ee099a1013b615274f9135627f5b878a9f2cd51b5f 0001-gcc10-extern-YYLOC-global-declaration.patch
6e8e12268c0c5eff0e3d0964f26678929410138a8783c628953112e449400cf8660e83321cd9cebf34ac74dd008f32dd4b0b6bdfa7097083cbaa23920367f13e 0002-Port-drvgen-scripts-to-Python3.patch
"

File diff suppressed because it is too large Load diff