[Android General] avisekjena:
I am trying to Port TWRP for this device.

I have managed to extract the recovery.img and was trying to port TWRP using the said instructions. Started with twrp-3.3.1-0-shamu_nexus.img and recovery-twrp3020-nexbox_a95x.img and edited the images as instructed but when I load/boot from the edited image, I get the following log.

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Initializing cgroup subsys cpu
Initializing cgroup subsys cpuacct
Linux version 3.14.28-1.12pre (jenkins_slave@Android-C1) (gcc version 4.8.5 (Broadcom stbgcc-4.8-1.5) ) #1 SMP Tue Jul 16 04:40:39 UTC 2019
revision 3 (ARMv7), cr=30c7387d
CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
Machine model: BCM97252SSFFG_NOAVS
moving dtb from 0x0000000007629000 to 0x0000000000d0ebb4
cma: Reserved 768 MiB at 0x0000000090000000
bmem: Reserved 336 MiB at 0x000000002a000000
bmem: Reserved 256 MiB at 0x0000000080000000
pmem: Reserved 8 MiB at 0x000000003f800000
cma: Reserved 16 MiB at 0x000000000f000000
Memory policy: Data cache writealloc
MCP: Enabling write pairing
PERCPU: Embedded 9 pages/cpu @cdfbd000 s13312 r8192 d15360 u36864
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 523776
Kernel command line: mem=1024m@0m mem=1024m@2048m bmem=336m@672m bmem=256m@2048m brcm_cma=768m@2304m ramoops.mem_address=0x3F800000 ramoops.mem_size=0x800000 ramoops.console_size=0x400000 pmem=8m@1016m androidboot.serialno=1234567890 androidboot.hardware=ganesa bootreason=software_master androidboot.hardware=ganesa bootreason=software_master
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 644848K/2097152K available (8067K kernel code, 509K rwdata, 2812K rodata, 433K init, 1509K bss, 649488K reserved, 802816K cma-reserved, 434172K highmem)
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xd0800000 - 0xff000000 ( 744 MB)
lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
.text : 0xc0008000 - 0xc0aa8174 (10881 kB)
.init : 0xc0aa9000 - 0xc0b15400 ( 433 kB)
.data : 0xc0b16000 - 0xc0b956c0 ( 510 kB)
.bss : 0xc0b956c0 - 0xc0d0ebb4 (1510 kB)
Hierarchical RCU implementation.
RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
NR_IRQS:16 nr_irqs:16 16
irq_brcmstb_l2: registered L2 intc (mem: 0xfc403000, parent irq: 93)
irq_brcmstb_l2: registered L2 intc (mem: 0xfc3e1000, parent irq: 64)
irq_brcmstb_l2: registered L2 intc (mem: 0xfc410640, parent irq: 95)
irq_brcmstb_l2: registered L2 intc (mem: 0xfc4d1200, parent irq: 58)
Architected cp15 timer(s) running at 27.00MHz (virt).
sched_clock: 56 bits at 27MHz, resolution 37ns, wraps every 2545165795328ns
Switching to timer-based delay loop
Console: colour dummy device 80x30
Calibrating delay loop (skipped), value calculated using timer frequency.. 54.00 BogoMIPS (lpj=27000)
pid_max: default: 32768 minimum: 301
Security Framework initialized
SELinux: Initializing.
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
Initializing cgroup subsys debug
Initializing cgroup subsys freezer
CPU: Testing write buffer coherency: ok
CPU0: update cpu_power 1024
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x7ad6c8 - 0x7ad720
CPU1: Booted secondary processor
CPU1: update cpu_power 1024
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
Brought up 2 CPUs
SMP: Total of 2 processors activated.
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 42 architecture 4 part 00 variant 0 rev 0
regulator-dummy: no parameters
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
ramoops: using module parameters
enabled
pstore: Registered ramoops as persistent store backend
ramoops: attached 0x800000@0x3f800000, ecc: 0/0
cpuidle: using governor ladder
cpuidle: using governor menu
irq: no irq domain found for /rdb/interrupt-controller@f040a700 !
irq: no irq domain found for /rdb/interrupt-controller@f0417380 !
registered
registered
registered
registered
registered
registered
registered
registered
registered
registered
registered
registered
registered
registered
irq: no irq domain found for /rdb/interrupt-controller@f0417380 !
hw-breakpoint: Failed to enable monitor mode on CPU 1.
Broadcom Brahma-B15 readahead cache at: 0xfc3e2478
bio: create slab <bio-0> at 0
brcmstb-gpio f040a600.gpio: Couldn't get IRQ. Enable CONFIG_BCM7120_L2_IRQ if you want GPIO interrupt support
brcmstb-gpio f040a600.gpio: Registered 5 banks (GPIO(s): 0-159)
brcmstb-gpio f0417400.gpio: Couldn't get IRQ. Enable CONFIG_BCM7120_L2_IRQ if you want GPIO interrupt support
brcmstb-gpio f0417400.gpio: Registered 2 banks (GPIO(s): 160-223)
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Linux video capture interface: v2.00
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
Advanced Linux Sound Architecture Driver Initialized.
Bluetooth: Core ver 2.18
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: L2CAP socket layer initialized
Bluetooth: SCO socket layer initialized
cfg80211: Calling CRDA to update world regulatory domain
brcm-pci f0460000.pcie: adjusting to legacy (broken) pcie DT
brcm-pci f0490000.pcie: adjusting to legacy (broken) pcie DT
brcm-pci f0460000.pcie: link down
brcm-pci f0490000.pcie: link down
Switched to clocksource arch_sys_counter
thermal thermal_zone0: failed to read out thermal zone 0
NET: Registered protocol family 2
TCP established hash table entries: 2048 (order: 1, 8192 bytes)
TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP: reno registered
UDP hash table entries: 256 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Trying to unpack rootfs image as initramfs...
Freeing initrd memory: 4828K (c2008000 - c24bf000)
hw perfevents: enabled with ARMv7 Cortex-A15 PMU driver, 7 counters available
futex hash table entries: 512 (order: 3, 32768 bytes)
audit: initializing netlink subsys (disabled)
audit: type=2000 audit(0.432:1): initialized
bounce pool size: 64 pages
squashfs: version 4.0 (2009/01/31) Phillip Lougher
NFS: Registering the id_resolver key type
Key type id_resolver registered
Key type id_legacy registered
nfs4filelayout_init: NFSv4 File Layout Driver Registering...
jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
fuse init (API version 7.22)
msgmni has been set to 452
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
brcm-gisb-arb f0400000.gisb-arb: registered mem: fc400000, irqs: 258, 259
brcm-cma brcm-cma.0: Initialized Broadcom CMA root device
brcm-cma brcm-cma.0: Added CMA device @ PA=0x90000000 LEN=0x30000000
brcm-cma brcm-cma.0: Pre-allocated 0x30000000 bytes @ 0x90000000
brcmstb_memc f1102000.memc-ddr: registered
brcmstb_memc f1182000.memc-ddr: registered
brcm-waketimer f0417580.waketimer: rtc core: registered brcmstb-waketmr as rtc0
brcm-waketimer f0417580.waketimer: registered, with irq 260
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
f040a900.serial: ttyS0 at MMIO 0xf040a900 (irq = 107, base_baud = 5062500) is a 16550A
enabled
f040a940.serial: ttyS1 at MMIO 0xf040a940 (irq = 108, base_baud = 5062500) is a 16550A
f040a980.serial: ttyS2 at MMIO 0xf040a980 (irq = 109, base_baud = 5062500) is a 16550A
brd: module loaded
loop: module loaded
brcmstb_hdmi_hpd switch successfully registered
spi_brcmstb f03e3400.spi: 1-lane output, 3-byte address
spi_brcmstb f03e3400.spi: master is unqueued, this is deprecated
m25p80 spi32766.0: found mx25l3255e, expected m25p80
m25p80 spi32766.0: mx25l3255e (4096 Kbytes)
3 ofpart partitions found on MTD device spi32766.0
Creating 3 MTD partitions on "spi32766.0":
0x000000000000-0x000000300000 : "flash0.bolt"
0x000000300000-0x000000400000 : "flash0.nvram"
0x000000000000-0x000000400000 : "flash0"
libphy: Fixed MDIO Bus: probed
tun: Universal TUN/TAP device driver, 1.6
tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
bcmgenet f0b00000.ethernet: GENET 4.5 EPHY: 0x1001
libphy: bcmgenet MII bus: probed
e1000e: Intel(R) PRO/1000 Network Driver - 2.3.2-k
e1000e: Copyright(c) 1999 - 2013 Intel Corporation.
pegasus: v0.9.3 (2013/04/25), Pegasus/Pegasus II USB Ethernet driver
usbcore: registered new interface driver pegasus
usbcore: registered new interface driver asix
usbcore: registered new interface driver ax88179_178a
usbcore: registered new interface driver cdc_ether
usbcore: registered new interface driver cdc_ncm
xhci-brcm: xHCI BRCM driver
xhci-brcm f0471000.xhci_v2: xHCI Host Controller
xhci-brcm f0471000.xhci_v2: new USB bus registered, assigned bus number 1
xhci-brcm f0471000.xhci_v2: irq 149, io mem 0xf0471000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: config failed, hub doesn't have any ports! (err -19)
xhci-brcm f0471000.xhci_v2: xHCI Host Controller
xhci-brcm f0471000.xhci_v2: new USB bus registered, assigned bus number 2
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
ehci-brcm: EHCI BRCM driver
ehci-brcm f0470300.ehci_v2: EHCI Host Controller
ehci-brcm f0470300.ehci_v2: new USB bus registered, assigned bus number 3
ehci-brcm f0470300.ehci_v2: irq 145, io mem 0xf0470300
ehci-brcm f0470300.ehci_v2: USB 2.0 started, EHCI 1.00
hub 3-0:1.0: USB hub found
hub 3-0:1.0: 1 port detected
ehci-brcm f0470500.ehci_v2: EHCI Host Controller
ehci-brcm f0470500.ehci_v2: new USB bus registered, assigned bus number 4
ehci-brcm f0470500.ehci_v2: irq 146, io mem 0xf0470500
ehci-brcm f0470500.ehci_v2: USB 2.0 started, EHCI 1.00
hub 4-0:1.0: USB hub found
hub 4-0:1.0: 1 port detected
ohci-brcm: OHCI BRCM driver
ohci-brcm f0470400.ohci_v2: BRCM OHCI controller
ohci-brcm f0470400.ohci_v2: new USB bus registered, assigned bus number 5
ohci-brcm f0470400.ohci_v2: irq 147, io mem 0xf0470400
hub 5-0:1.0: USB hub found
hub 5-0:1.0: 1 port detected
ohci-brcm f0470600.ohci_v2: BRCM OHCI controller
ohci-brcm f0470600.ohci_v2: new USB bus registered, assigned bus number 6
ohci-brcm f0470600.ohci_v2: irq 148, io mem 0xf0470600
hub 6-0:1.0: USB hub found
hub 6-0:1.0: 1 port detected
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci-pci: OHCI PCI platform driver
usbcore: registered new interface driver usb-storage
mousedev: PS/2 mouse device common for all mice
usbcore: registered new interface driver xpad
i2c /dev entries driver
usbcore: registered new interface driver uvcvideo
USB Video Class driver (1.1.1)
brcmstb_thermal f04d1500.thermal: registered AVS TMON of-sensor driver
bcm7038-wdt f040a7a8.watchdog: Registered Broadcom Watchdog
device-mapper: uevent: version 1.0.3
device-mapper: ioctl: 4.27.0-ioctl (2013-10-30) initialised: dm-devel@redhat.com
usb 3-1: new high-speed USB device number 2 using ehci-brcm
usbcore: registered new interface driver btusb
cpufreq_cpu0: failed to get cpu0 regulator: -19
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
mmc0: no vqmmc regulator found
mmc0: no vmmc regulator found
using ADMA
mmc1: no vqmmc regulator found
mmc1: no vmmc regulator found
using ADMA
hub 3-1:1.0: USB hub found
hub 3-1:1.0: 4 ports detected
hidraw: raw HID events driver (C) Jiri Kosina
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
ashmem: initialized
usbcore: registered new interface driver snd-usb-audio
mmc0: BKOPS_EN bit is not set
Netfilter messages via NETLINK v0.30.
mmc0: new high speed MMC card at address 0001
nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
mmcblk0: mmc0:0001 8GME4R 7.28 GiB
mmcblk0boot0: mmc0:0001 8GME4R partition 1 4.00 MiB
mmcblk0boot1: mmc0:0001 8GME4R partition 2 4.00 MiB
mmcblk0rpmb: mmc0:0001 8GME4R partition 3 512 KiB
xt_time: kernel timezone is -0000
IPVS: Registered protocols ()
IPVS: Connection hash table configured (size=4096, memory=32Kbytes)
IPVS: Creating netns size=784 id=0
IPVS: ipvs loaded.
ip_tables: (C) 2000-2006 Netfilter Core Team
arp_tables: (C) 2002 David S. Miller
TCP: cubic registered
NET: Registered protocol family 10
mip6: Mobile IPv6
ip6_tables: (C) 2000-2006 Netfilter Core Team
Alternate GPT is invalid, using primary GPT.
sit: IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11
Bridge firewalling registered
Bluetooth: HIDP (Human Interface Emulation) ver 1.2
Bluetooth: HIDP socket layer initialized
Key type dns_resolver registered
Registering SWP/SWPB emulation handler
regulator-dummy: disabling
dummy_hcd dummy_hcd.0: USB Host+Gadget Emulator, driver 02 May 2005
dummy_hcd dummy_hcd.0: Dummy host controller
dummy_hcd dummy_hcd.0: new USB bus registered, assigned bus number 7
hub 7-0:1.0: USB hub found
mmcblk0boot1: unknown partition table
hub 7-0:1.0: 1 port detected
mmcblk0boot0: unknown partition table
file system registered
Number of LUNs=8
Mass Storage Function, version: 2009/09/11
LUN: removable file: (no medium)
android_usb gadget: android_usb ready
brcm-waketimer f0417580.waketimer: setting system clock to 1970-01-01 00:00:49 UTC (49)
ALSA device list:
No soundcards found.
Freeing unused kernel memory: 432K (c0aa9000 - c0b15000)
audit: type=1403 audit(49.559:2): policy loaded auid=4294967295 ses=4294967295
audit: type=1404 audit(49.571:3): enforcing=1 old_enforcing=0 auid=4294967295 ses=4294967295
usb 3-1.1: new full-speed USB device number 3 using ehci-brcm
init: /init.rc: 67: invalid command 'load_system_props'
audit: type=1400 audit(49.681:4): avc: denied { mknod } for pid=17 comm="kdevtmpfs" capability=27 scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=capability permissive=0
audit: type=1400 audit(49.711:5): avc: denied { mknod } for pid=17 comm="kdevtmpfs" capability=27 scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=capability permissive=0
on usb-f0470300.ehci_v2-1.1/input2
input: Logitech Unifying Device. Wireless PID:404d as /devices/rdb.4/f0470300.ehci_v2/usb3/3-1/3-1.1/3-1.1:1.2/0003:046D:C52B.0003/0003:046D:C52B.0004/input/input0
audit: type=1400 audit(49.811:6): avc: denied { mknod } for pid=17 comm="kdevtmpfs" capability=27 scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=capability permissive=0
audit: type=1400 audit(49.829:7): avc: denied { mknod } for pid=17 comm="kdevtmpfs" capability=27 scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=capability permissive=0
audit: type=1400 audit(49.847:8): avc: denied { mknod } for pid=17 comm="kdevtmpfs" capability=27 scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=capability permissive=0
usb 3-1.2: new high-speed USB device number 4 using ehci-brcm
on usb-f0470300.ehci_v2-1.1:1
audit: type=1400 audit(49.963:9): avc: denied { mknod } for pid=17 comm="kdevtmpfs" capability=27 scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=capability permissive=0
hub 3-1.2:1.0: USB hub found
hub 3-1.2:1.0: 2 ports detected
init: /dev/hw_random not found
init: /dev/hw_random not found
android_usb: already disabled
init: Unable to open persistent property directory /data/property errno: 2
init: cannot find '/sbin/nxmini', disabling 'nxmini'
android_usb: already disabled
audit: type=1400 audit(50.022:10): avc: denied { write } for pid=2336 comm="setenforce" name="enforce" dev="selinuxfs" ino=4 scontext=u:r:recovery:s0 tcontext=u:object_r:selinuxfs:s0 tclass=file permissive=1
init: cannot find '/system/bin/sh', disabling 'console'
avc: denied { set } for property=twrp.crash_counter scontext=u:r:recovery:s0 tcontext=u:object_r:default_prop:s0 tclass=property_service
read descriptors
read strings
android_work: did not send uevent (0 0 (null))
usb 7-1: new high-speed USB device number 2 using dummy_hcd
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=DISCONNECTED
android_work: sent uevent USB_STATE=CONNECTED
android_usb gadget: high-speed config #1: android
android_work: sent uevent USB_STATE=CONFIGURED
usb 3-1.2.1: new full-speed USB device number 5 using ehci-brcm
usb 3-1.2.2: new high-speed USB device number 6 using ehci-brcm

When compared with log from stock recovery, this is where things start to differ:

audit: type=1400 audit(49.681:4): avc: denied { mknod } for pid=17 comm="kdevtmpfs" capability=27 scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=capability permissive=0

My guess is, it is trying to load the blocks and failing for some context policies.

Ftsab looks like this:

/system ext4 /dev/block/by-name/system
/data ext4 /dev/block/by-name/userdata
/cache ext4 /dev/block/by-name/cache
/boot emmc /dev/block/by-name/boot
/recovery emmc /dev/block/by-name/recovery flags=backup=1
/misc emmc /dev/block/by-name/misc
/usb-otg vfat /dev/block/sda1 flags=removable;storage;display=USB-OTG

Any suggestion/help is appreciated.