Zombah sandbox: различия между версиями

Материал из Toshiba AC100 wiki
Перейти к навигации Перейти к поиску
м (add by-name ac100 partitions)
 
(не показано 15 промежуточных версий этого же участника)
Строка 1: Строка 1:
=ac100 sound=
==ac100 sound==
<pre>
<pre>
cat /proc/asound/cards                                           
cat /proc/asound/cards                                           
Строка 10: Строка 10:
</pre>
</pre>


=grouper sound=
==grouper sound==
<pre>
<pre>
shell@grouper:/ $ cat /proc/asound/cards
shell@grouper:/ $ cat /proc/asound/cards
Строка 26: Строка 26:
</pre>
</pre>


=ubuntu cmdline=
==ubuntu cmdline==
* Kernel buildin
* Kernel buildin
<pre>
<pre>
Строка 37: Строка 37:
</pre>
</pre>
----
----
=adb error=
==adb error==
<pre>
<pre>
$./adb shell
$./adb shell
Строка 49: Строка 49:


----
----
=Make android code support old and current android api=
==Make android code support old and current android api==
<pre>
<pre>
/* comment this line if Android OS is ICS and prior */
/* comment this line if Android OS is ICS and prior */
Строка 105: Строка 105:
</pre>
</pre>
----
----
= ac100 ubuntu kernel repo =
== ac100 ubuntu kernel repo ==
[http://kernel.ubuntu.com/git?p=jani/ubuntu-ac100.git;a=summary ubuntu repo]  
[http://kernel.ubuntu.com/git?p=jani/ubuntu-ac100.git;a=summary ubuntu repo]  
----
----


= rfkill mystic =
== rfkill mystic ==
rfkill устройства оказывается гуляют туда сюда между rfkill0 и rfkill1 для gpio и bt,
rfkill устройства оказывается гуляют туда сюда между rfkill0 и rfkill1 для gpio и bt,
это создает всякие странности в работе обоих когда ставятся не правильные права, т.к.
это создает всякие странности в работе обоих когда ставятся не правильные права, т.к.
Строка 191: Строка 191:
</pre>
</pre>
----
----
= Брутальный способ увидеть кто пишет/читает с диска =
== Брутальный способ увидеть кто пишет/читает с диска ==
<pre>
<pre>
echo 1 > /proc/sys/vm/block_dump
echo 1 > /proc/sys/vm/block_dump
Строка 197: Строка 197:
начинаются приличные тормоза но в лог ядра валит какой процесс почитал или пописал
начинаются приличные тормоза но в лог ядра валит какой процесс почитал или пописал
----
----
= Описание хардварных фич андроида =
== Описание хардварных фич андроида ==
Нашел корректное описание фич http://developer.android.com/guide/topics/manifest/uses-feature-element.html#hw-features
Нашел корректное описание фич http://developer.android.com/guide/topics/manifest/uses-feature-element.html#hw-features
----
----
= Linaro Disablesuspend.sh =
== Linaro Disablesuspend.sh ==
Скрипт работает, отрубает сон с концами и навсегда.
Скрипт работает, отрубает сон с концами и навсегда.


Строка 209: Строка 209:
</pre>
</pre>
----
----
= Google Now crash fix =
== Google Now crash fix ==
Найден в этом треде http://productforums.google.com/forum/#!msg/mobile/fnwmbw7XYzQ/-7iO_NcRUOUJ
Найден в этом треде http://productforums.google.com/forum/#!msg/mobile/fnwmbw7XYzQ/-7iO_NcRUOUJ


Достаточно перейти в настройках Input Language с English (US) на например English (UK)
Достаточно перейти в настройках Input Language с English (US) на например English (UK)
----
----
= Добавляем вывод в сишную функцию где нет дебага =
== Добавляем вывод в сишную функцию где нет дебага ==
<pre>
<pre>
printk("PRINTK: %s called\n", __func__);
printk("PRINTK: %s called\n", __func__);
</pre>
</pre>
----
----
= Странный вывод avp при nvflash'нии с установленным u-boot бутлоадером =
== Странный вывод avp при nvflash'нии с установленным u-boot бутлоадером ==
<pre>
<pre>
**********Aos DebugSemiHosting Initialized*******
**********Aos DebugSemiHosting Initialized*******
Строка 241: Строка 241:
OS will cold boot in 10 seconds if no input is detected
OS will cold boot in 10 seconds if no input is detected
Press <Enter> to select, Arrow key (Left, Right) for selection move
Press <Enter> to select, Arrow key (Left, Right) for selection move
</pre>
----
== Debug app start in wine ==
<pre>
WINEDEBUG=+tid,+seh,+relay,+server wine ./brb.exe >>log.txt 2>&1
</pre>
----
==Adb vendor keys==
<pre>
This adbd's $ADB_VENDOR_KEYS is not set; try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
</pre>
==LCD problems bisect==
4.0 seems to be last fine <br/>
4.1-rc1 for now is first problematic <br/>
4.1-rc[1-3] require this patch for boot https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?h=v4.1-rc4&id=9cf82e72ec449b4516843377ac7a20abe300c64f <br/>
Bisect finished to this commit https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/drivers/usb/Makefile?h=v4.1-rc1&id=8f116d1c12580b7c2349e3291d22621ee21b08a0 <br/>
===LCD Problems log compare===
Compare initcall_debug logs: <br/>
Logs of broken lcd start: http://pastebin.com/QjAHRN5D <br/>
Logs of lcd start fine: http://pastebin.com/uTMa65aH <br/>
<pre>
fine:
[    0.655377] initcall pinctrl_init+0x0/0xcc returned 0 after 0 usecs
...
[    7.514257] calling  lm90_driver_init+0x0/0x10 @ 1
[    7.519179] 2-004c supply vcc not found, using dummy regulator
[    7.519505] hub 3-1:1.0: USB hub found
[    7.525071] hub 3-1:1.0: 3 ports detected
[    7.534155] initcall lm90_driver_init+0x0/0x10 returned 0 after 14713 usecs
...
[    9.619049] calling  deferred_probe_initcall+0x0/0x80 @ 1
[    9.625598] tegra-dc 54200000.dc: failed to probe RGB output: -517
[    9.636913] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    9.643534] [drm] No driver support for vblank timestamp query.
[    9.703283] Console: switching to colour frame buffer device 128x37
[    9.715614] drm drm: fb0:  frame buffer device
[    9.720119] drm drm: registered panic notifier
[    9.744741] [drm] Initialized tegra 0.0.0 20120330 on minor 0
[    9.750614] initcall deferred_probe_initcall+0x0/0x80 returned 0 after 123200 usecs
...
[    9.919006] calling  regulator_init_complete+0x0/0x174 @ 1
[    9.928138] initcall regulator_init_complete+0x0/0x174 returned 0 after 340 usecs
problem:
[    0.655321] initcall pinctrl_init+0x0/0xcc returned 0 after 9765 usecs
...
[    7.514276] calling  lm90_driver_init+0x0/0x10 @ 1
[    7.514689] hub 3-1:1.0: USB hub found
[    7.519119] hub 3-1:1.0: 3 ports detected
[    7.527018] 2-004c supply vcc not found, using dummy regulator
[    7.534141] initcall lm90_driver_init+0x0/0x10 returned 0 after 7052 usecs
...
[    9.617640] calling  deferred_probe_initcall+0x0/0x80 @ 1
[    9.624167] tegra-dc 54200000.dc: failed to probe RGB output: -517
[    9.635497] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    9.642120] [drm] No driver support for vblank timestamp query.
[    9.672562] Console: switching to colour frame buffer device 128x37
[    9.684893] drm drm: fb0:  frame buffer device
[    9.689397] drm drm: registered panic notifier
[    9.714844] [drm] Initialized tegra 0.0.0 20120330 on minor 0
[    9.720715] initcall deferred_probe_initcall+0x0/0x80 returned 0 after 95375 usecs
...
[    9.879497] calling  regulator_init_complete+0x0/0x174 @ 1
[    9.900504] initcall regulator_init_complete+0x0/0x174 returned 0 after 12270 usecs
</pre>
==Find latest linux-mainline version==
<pre>
curl --silent https://www.kernel.org/finger_banner | awk '/ mainline /{print $(NF)}'
wget -qO- https://www.kernel.org/finger_banner | awk '/ mainline /{print $(NF)}'
...
wget -qO- https://www.kernel.org/finger_banner | grep stable | awk -F":" '{sub(/^ *| *$/, "", $2); print $2}' |head -1
...
curl -s https://www.kernel.org/finger_banner | perl -lane 'print $1 if /latest (?:mainline) .*?:\s+(\S+)$/'
</pre>
Use variable in pattern
<pre>
BRANCH=stable
LINUX_BANNER=https://www.kernel.org/finger_banner
wget -qO- $LINUX_BANNER | awk -v pattern=$BRANCH 'match($0, pattern) {print $(NF)}'
wget -qO- $LINUX_BANNER | awk -v pattern=$BRANCH '$0 ~ pattern {print $(NF)}'
</pre>
==Partitions by-name==
<pre>
root@android:/dev/block/platform/soc0/c8000600.sdhci/by-name # ls -la
lrwxrwxrwx root    root              2016-04-06 07:56 APP -> /dev/block/mmcblk0p3
lrwxrwxrwx root    root              2016-04-06 07:56 CAC -> /dev/block/mmcblk0p4
lrwxrwxrwx root    root              2016-04-06 07:56 LNX -> /dev/block/mmcblk0p2
lrwxrwxrwx root    root              2016-04-06 07:56 MSC -> /dev/block/mmcblk0p5
lrwxrwxrwx root    root              2016-04-06 07:56 SOS -> /dev/block/mmcblk0p1
lrwxrwxrwx root    root              2016-04-06 07:56 UDA -> /dev/block/mmcblk0p6
lrwxrwxrwx root    root              2016-04-06 07:56 UDB -> /dev/block/mmcblk0p7
</pre>
</pre>
----
----

Текущая версия от 19:51, 19 апреля 2016

ac100 sound

cat /proc/asound/cards                                          
 0 [tegraalc5632   ]: tegra-alc5632 - tegra-alc5632
                                   tegra-alc5632

cat /proc/asound/pcm                                            
00-00: ALC5632 PCM alc5632-hifi-0 :  : playback 1 : capture 1
00-01: SPDIF PCM dit-hifi-1 :  : playback 1 : capture 1

grouper sound

shell@grouper:/ $ cat /proc/asound/cards
cat /proc/asound/cards
 0 [Tegra          ]: HDA-Intel - HDA NVIDIA Tegra
                      HDA NVIDIA Tegra at 0x70038000 irq 113
 1 [tegrart5640    ]: tegra-rt5640 - tegra-rt5640
                      tegra-rt5640
shell@grouper:/ $ cat /proc/asound/pcm
cat /proc/asound/pcm
00-03: HDMI 0 : HDMI 0 : playback 1
01-00: RT5640 PCM rt5640-aif1-0 :  : playback 1 : capture 1
01-01: SPDIF PCM dit-hifi-1 :  : playback 1 : capture 1
01-02: BT SCO PCM dit-hifi-2 :  : playback 1 : capture 1

ubuntu cmdline

  • Kernel buildin
CONFIG_CMDLINE="mem=512M@0 root=/dev/mmcblk1p1 console=ttyS0,115200n8 quite silent earlyprintk rootwait"
  • Bootimage buildin
Command line: mem=512M@0 tegrapart=recovery:300:a00:800,boot:d00:1000:800,mbr:1d00:200:800 console=tty0 root=/dev/mmcblk0p7 quiet splash

adb error

$./adb shell
error: device offline

New android require adb authorization upon first connect, authorized pc's file live in /data/misc/adb/adb_keys

So if you have error that device offline either you have old adb version or not authorized.


Make android code support old and current android api

/* comment this line if Android OS is ICS and prior */
#define ANDROID_VERSION_JB      (1)

#ifdef ANDROID_VERSION_JB
#define LOGV            ALOGV
#define LOGV_IF         ALOGV_IF
#define LOGD            ALOGD
#define LOGD_IF         ALOGD_IF
#define LOGI            ALOGI
#define LOGI_IF         ALOGI_IF
#define LOGW            ALOGW
#define LOGW_IF         ALOGW_IF
#define LOGE            ALOGE
#define LOGE_IF         ALOGE_IF
#define IF_LOGV         IF_ALOGV
#define IF_LOGD         IF_ALOGD
#define IF_LOGI         IF_ALOGI
#define IF_LOGW         IF_ALOGW
#define IF_LOGE         IF_ALOGE
#define LOG_ASSERT      ALOG_ASSERT
#define LOG             ALOG
#define IF_LOG          IF_ALOG
#endif

shell@android:/dev/bus/usb $ ls -la
drwxr-xr-x root     root              2013-02-24 01:09 001
drwxr-xr-x root     root              2013-02-24 01:09 002
shell@android:/ $ cd /dev/bus/usb/001/                                         
shell@android:/dev/bus/usb/001 $ ls -la
crw-rw---- root     usb      189,   0 2013-02-24 01:09 001
crw-rw---- root     usb      189,   1 2013-02-24 01:09 002
crw-rw---- root     usb      189,   2 2013-02-24 01:09 003
crw-rw---- root     usb      189,   3 2013-02-24 01:09 004
shell@android:/dev/bus/usb/001 $ cd ../002/                                    
shell@android:/dev/bus/usb/002 $ ls -la
crw-rw---- root     usb      189, 128 2013-02-24 01:09 001
crw-rw---- root     usb      189, 129 2013-02-24 01:09 002
crw-rw---- root     usb      189, 130 2013-02-24 01:09 003
lsusb
        Bus 001 Device 001: ID 1d6b:0002 !Linux Foundation 2.0 root hub
        Bus 002 Device 001: ID 1d6b:0002 !Linux Foundation 2.0 root hub
        Bus 001 Device 002: ID 0424:2512 ?Standard Microsystems Corp.
        Bus 002 Device 002: ID 0424:2513 ?Standard Microsystems Corp.
wifi    Bus 001 Device 003: ID 0db0:3871 ?Micro Star International (Device name unknown)
bt      Bus 001 Device 004: ID 0db0:a871 ?Micro Star International (Device name unknown)
3g      Bus 002 Device 003: ID 0bdb:190a !Ericsson Business Mobile Networks BV, f3307
ext-usb Bus 002 Device 004: ID 046d:c024

ac100 ubuntu kernel repo

ubuntu repo


rfkill mystic

rfkill устройства оказывается гуляют туда сюда между rfkill0 и rfkill1 для gpio и bt, это создает всякие странности в работе обоих когда ставятся не правильные права, т.к. в андроиде прописано жестко на какое устройство какие права ставить (юид и гид)

root@android:/sys/class/rfkill # ls
rfkill0
rfkill1
rfkill2
root@android:/sys/class/rfkill # cat rfkill0/name                              
hci0
root@android:/sys/class/rfkill # cat rfkill1/name                              
wifi_rfkill
root@android:/sys/class/rfkill # cat rfkill2/name                              
phy0
root@android:/sys/class/rfkill #
root@android:/sys # find . -name "rfkill*"
./devices/platform/rfkill_gpio
./devices/platform/rfkill_gpio/rfkill
./devices/platform/rfkill_gpio/rfkill/rfkill1
./devices/platform/tegra-ehci.1/usb1/1-1/1-1.1/1-1.1:1.0/ieee80211/phy0/rfkill2
./devices/platform/tegra-ehci.1/usb1/1-1/1-1.2/1-1.2:1.0/bluetooth/hci0/rfkill0
./devices/virtual/misc/rfkill
./bus/platform/devices/rfkill_gpio
./bus/platform/drivers/rfkill_gpio
./bus/platform/drivers/rfkill_gpio/rfkill_gpio
./class/misc/rfkill
./class/rfkill
./class/rfkill/rfkill0
./class/rfkill/rfkill1
./class/rfkill/rfkill2
./module/rfkill


Марвин в курсе, что такое может быть, но пока не знает как пофиксить

[01:22] <zombah> marvin24: hello, i noticed that sometimes rfkill0 and rfkill1 change their names between hci0 and wifi_rfkill and in rare cases rfkill2 appear with name phy0, is this ok or im missing something?
[01:36] <zombah> marvin24: i mean, now i just rebooted and wifi_rfkill is rfkill1, but how this happen because i thought it always must be rfkill0
[01:39] <-- ojn покинул(а) сервер (Remote host closed the connection).
[01:44] <marvin24> zombah: could be
[01:44] <marvin24> I didn't looked for a better way to connect rfkill to thier devices
[01:44] <marvin24> and I don't have a bt model
[01:44] <zombah> marvin24: ohh is it possible to always bind to rfkill0? android need to set specific permissions adn they differ for bt and wifi
[01:45] <marvin24> there must be some method
[01:45] <marvin24> but again, I didn't looked into it yet
[01:45] <woglinde> he marvin24
[01:45] <zombah> i see, i will search other examples, thanx
[01:46] --> styopah вошел на канал ([email protected]).
[01:47] <marvin24> we have a similar problem for rtc
[01:48] <woglinde> hm?
[01:48] <marvin24> because the regulator and the tegra soc supplies a rtc device and it is just random which one get which
[01:48] <woglinde> oh
[01:48] <woglinde> damn
[01:48] <marvin24> and system seems to use rtc0 as a clock source by default
[01:48] <marvin24> so sometimes date works, and sometimes not
[01:48] <woglinde> I thought we wanted to use the one from the tps
[01:48] <marvin24> you can only force module load in the right order
[01:48] <woglinde> and disable the other
[01:49] <marvin24> you should be able to enable all supported hw
[01:49] <woglinde> ?
[01:49] <-- styopah покинул(а) сервер (Client Quit).
[01:49] <marvin24> I think this is a common problem for many device, so there must be a simple solution
[01:49] <marvin24> maybe udev or so
[01:49] <woglinde> if the tegra rtc is not usefull why not disable it
[01:49] <marvin24> it is useful
[01:50] <woglinde> hm
[01:50] <marvin24> it just starts art 1.1.1970 at every system start
[01:50] <zombah> andoroid lack udev support
[01:50] <marvin24> maybe there is some other method
[01:50] <woglinde> how is that usefull if the tps rtc has the right date
[01:54] <marvin24> if you only need relative time chances
[01:55] <marvin24> and I guess the tegra rtc is more accurate in short term
[01:57] <marvin24> often some other device properties are use to define the device id
[01:57] <marvin24> e.g. mac address or serial number
[01:58] <marvin24> but this doesn't work for a gpio only ...

Брутальный способ увидеть кто пишет/читает с диска

echo 1 > /proc/sys/vm/block_dump

начинаются приличные тормоза но в лог ядра валит какой процесс почитал или пописал


Описание хардварных фич андроида

Нашел корректное описание фич http://developer.android.com/guide/topics/manifest/uses-feature-element.html#hw-features


Linaro Disablesuspend.sh

Скрипт работает, отрубает сон с концами и навсегда.

попробовать прописать в init.paz00.rc, а то disablesuspend.sh слишком брутален

# Do not suspend
write /sys/power/wake_lock nosuspend

Google Now crash fix

Найден в этом треде http://productforums.google.com/forum/#!msg/mobile/fnwmbw7XYzQ/-7iO_NcRUOUJ

Достаточно перейти в настройках Input Language с English (US) на например English (UK)


Добавляем вывод в сишную функцию где нет дебага

printk("PRINTK: %s called\n", __func__);

Странный вывод avp при nvflash'нии с установленным u-boot бутлоадером

**********Aos DebugSemiHosting Initialized*******
---------------------------------------------------
ADJUSTED CLOCKS:
MC clock is set to 333000 KHz
EMC clock is set to 666000 KHz (DDR clock is at 333000 KHz)
PLLX0 clock is set to 1000000 KHz
PLLC0 clock is set to 600000 KHz
CPU clock is set to 1000000 KHz
System and AVP clock is set to 240000 KHz
GraphicsHost clock is set to 108000 KHz
3D clock is set to 111000 KHz
2D clock is set to 111000 KHz
Epp clock is set to 111000 KHz
Mpe clock is set to 111000 KHz
Vde clock is set to 240000 KHz
Entering NvFlash recovery mode / Nv3p Server
I2C Slave is *New*Checking for android ota recovery 
Checking for RCK.. press <Enter> in 5 sec to enter RCK
OS will cold boot in 10 seconds if no input is detected
Press <Enter> to select, Arrow key (Left, Right) for selection move

Debug app start in wine

WINEDEBUG=+tid,+seh,+relay,+server wine ./brb.exe >>log.txt 2>&1

Adb vendor keys

This adbd's $ADB_VENDOR_KEYS is not set; try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.

LCD problems bisect

4.0 seems to be last fine
4.1-rc1 for now is first problematic
4.1-rc[1-3] require this patch for boot https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?h=v4.1-rc4&id=9cf82e72ec449b4516843377ac7a20abe300c64f
Bisect finished to this commit https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/drivers/usb/Makefile?h=v4.1-rc1&id=8f116d1c12580b7c2349e3291d22621ee21b08a0

LCD Problems log compare

Compare initcall_debug logs:
Logs of broken lcd start: http://pastebin.com/QjAHRN5D
Logs of lcd start fine: http://pastebin.com/uTMa65aH

fine:
[    0.655377] initcall pinctrl_init+0x0/0xcc returned 0 after 0 usecs
...
[    7.514257] calling  lm90_driver_init+0x0/0x10 @ 1
[    7.519179] 2-004c supply vcc not found, using dummy regulator
[    7.519505] hub 3-1:1.0: USB hub found
[    7.525071] hub 3-1:1.0: 3 ports detected
[    7.534155] initcall lm90_driver_init+0x0/0x10 returned 0 after 14713 usecs
...
[    9.619049] calling  deferred_probe_initcall+0x0/0x80 @ 1
[    9.625598] tegra-dc 54200000.dc: failed to probe RGB output: -517
[    9.636913] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    9.643534] [drm] No driver support for vblank timestamp query.
[    9.703283] Console: switching to colour frame buffer device 128x37
[    9.715614] drm drm: fb0:  frame buffer device
[    9.720119] drm drm: registered panic notifier
[    9.744741] [drm] Initialized tegra 0.0.0 20120330 on minor 0
[    9.750614] initcall deferred_probe_initcall+0x0/0x80 returned 0 after 123200 usecs
...
[    9.919006] calling  regulator_init_complete+0x0/0x174 @ 1
[    9.928138] initcall regulator_init_complete+0x0/0x174 returned 0 after 340 usecs

problem:
[    0.655321] initcall pinctrl_init+0x0/0xcc returned 0 after 9765 usecs
...
[    7.514276] calling  lm90_driver_init+0x0/0x10 @ 1
[    7.514689] hub 3-1:1.0: USB hub found
[    7.519119] hub 3-1:1.0: 3 ports detected
[    7.527018] 2-004c supply vcc not found, using dummy regulator
[    7.534141] initcall lm90_driver_init+0x0/0x10 returned 0 after 7052 usecs
...
[    9.617640] calling  deferred_probe_initcall+0x0/0x80 @ 1
[    9.624167] tegra-dc 54200000.dc: failed to probe RGB output: -517
[    9.635497] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    9.642120] [drm] No driver support for vblank timestamp query.
[    9.672562] Console: switching to colour frame buffer device 128x37
[    9.684893] drm drm: fb0:  frame buffer device
[    9.689397] drm drm: registered panic notifier
[    9.714844] [drm] Initialized tegra 0.0.0 20120330 on minor 0
[    9.720715] initcall deferred_probe_initcall+0x0/0x80 returned 0 after 95375 usecs
...
[    9.879497] calling  regulator_init_complete+0x0/0x174 @ 1
[    9.900504] initcall regulator_init_complete+0x0/0x174 returned 0 after 12270 usecs

Find latest linux-mainline version

curl --silent https://www.kernel.org/finger_banner | awk '/ mainline /{print $(NF)}'
wget -qO- https://www.kernel.org/finger_banner | awk '/ mainline /{print $(NF)}'
...
wget -qO- https://www.kernel.org/finger_banner | grep stable | awk -F":" '{sub(/^ *| *$/, "", $2); print $2}' |head -1
...
curl -s https://www.kernel.org/finger_banner | perl -lane 'print $1 if /latest (?:mainline) .*?:\s+(\S+)$/'

Use variable in pattern

BRANCH=stable
LINUX_BANNER=https://www.kernel.org/finger_banner
wget -qO- $LINUX_BANNER | awk -v pattern=$BRANCH 'match($0, pattern) {print $(NF)}'
wget -qO- $LINUX_BANNER | awk -v pattern=$BRANCH '$0 ~ pattern {print $(NF)}'


Partitions by-name

root@android:/dev/block/platform/soc0/c8000600.sdhci/by-name # ls -la
lrwxrwxrwx root     root              2016-04-06 07:56 APP -> /dev/block/mmcblk0p3
lrwxrwxrwx root     root              2016-04-06 07:56 CAC -> /dev/block/mmcblk0p4
lrwxrwxrwx root     root              2016-04-06 07:56 LNX -> /dev/block/mmcblk0p2
lrwxrwxrwx root     root              2016-04-06 07:56 MSC -> /dev/block/mmcblk0p5
lrwxrwxrwx root     root              2016-04-06 07:56 SOS -> /dev/block/mmcblk0p1
lrwxrwxrwx root     root              2016-04-06 07:56 UDA -> /dev/block/mmcblk0p6
lrwxrwxrwx root     root              2016-04-06 07:56 UDB -> /dev/block/mmcblk0p7