Hello,
I compiled and stiched together the latest kernel for W2, based on the work from Andreas Faerber [source: kernel/git/afaerber/linux-realtek.git - Realtek ARM SoC kernel tree by Andreas Faerber]
I stitched together with the help of bpi-migrate the latest Arch Arm rootfs, and this boots out of the box after going through the instructions. The bpi-package is a good way - it needs a lot of polishing.
Until few days ago I didn’t knew s**t about U-Boot, so I dont expected much, but, surprisingly the Kernel is loading and doing something to HDMI because it initialized but then I guess It crashes/panics but neither UART or the screen shows anything (which is strange, since it should spill things to UART)
I still dont know s**t about uboot - its an WIP effort. What I read so far is well … its twisted then watching the latest presidential debate in reverse… I probably will figure stuff as I go once I read it 2303 times, however, If you, dear reader, have a tip or my logic is wrong: WRITE TO ME!
current UART uboot log:
30000000000:"Synchronous Abort" handler, esr 0x96000002
ELR: 62cd0
LR: 62c4c
x0 : 000000000000000c x1 : 000000000000003a
x2 : 0000000000000020 x3 : 0000030000000000
x4 : 0000000000000020 x5 : 000000000007668e
x6 : 0000000000000004 x7 : 000000000000000f
x8 : 00000000000ffae0 x9 : 000000000000000c
x10: 00000000000ff94c x11: 0000000000000008
x12: 00000000ffffffff x13: 0000000007880c3a
x14: 0000000000000000 x15: 0000000000000001
x16: 0000000000000440 x17: 0000000000000004
x18: 000000007feefea8 x19: 0000000000000040
x20: 0000030000000000 x21: 0000030000000000
x22: 000000000007c9e0 x23: 0000000000000008
x24: 0000000000000004 x25: 0000000000000004
x26: 0000000000000004 x27: 00000000000ffd28
x28: 0000000000000000 x29: 00000000000ffca0
Resetting CPU ...
resetting ...
Banana Pi BPI-W2(SPI ROM:20180907)
C1:80000000
C2
?
C3h
SD card is detected !!
C4
BPI: try bootcode_from_sdcard !!
BPI: support boot from sdcard
Command 0x00000000
interrupt 0x98010424 = 0x00000002
Command pass
response 0x98010589 = 0x000000A0
response 0x9801058A = 0x00000000
response 0x9801058B = 0x00000000
response 0x9801058C = 0x00000000
response 0x9801058D = 0x00000000
response 0x9801058E = 0x00000000
Command 0x00000008
interrupt 0x98010424 = 0x00000002
Command pass
response 0x98010589 = 0x00000008
response 0x9801058A = 0x00000000
response 0x9801058B = 0x00000000
response 0x9801058C = 0x00000001
response 0x9801058D = 0x000000AA
response 0x9801058E = 0x00000013
Command 0x00000037
interrupt 0x98010424 = 0x00000002
Command pass
response 0x98010589 = 0x00000037
response 0x9801058A = 0x00000000
response 0x9801058B = 0x00000000
response 0x9801058C = 0x00000001
response 0x9801058D = 0x00000020
response 0x9801058E = 0x00000083
AppCommand 0x00000029
interrupt 0x98010424 = 0x00000002
Command pass
response 0x98010589 = 0x0000003F
response 0x9801058A = 0x00000000
response 0x9801058B = 0x000000FF
response 0x9801058C = 0x00000080
response 0x9801058D = 0x00000000
response 0x9801058E = 0x000000FF
Command 0x00000037
interrupt 0x98010424 = 0x00000002
Command pass
response 0x98010589 = 0x00000037
response 0x9801058A = 0x00000000
response 0x9801058B = 0x00000000
response 0x9801058C = 0x00000001
response 0x9801058D = 0x00000020
response 0x9801058E = 0x00000083
AppCommand 0x00000029
interrupt 0x98010424 = 0x00000002
Command pass
response 0x98010589 = 0x0000003F
response 0x9801058A = 0x00000000
response 0x9801058B = 0x000000FF
response 0x9801058C = 0x00000080
response 0x9801058D = 0x00000000
response 0x9801058E = 0x000000FF
Command 0x00000037
interrupt 0x98010424 = 0x00000002
Command pass
response 0x98010589 = 0x00000037
response 0x9801058A = 0x00000000
response 0x9801058B = 0x00000000
response 0x9801058C = 0x00000001
response 0x9801058D = 0x00000020
response 0x9801058E = 0x00000083
AppCommand 0x00000029
interrupt 0x98010424 = 0x00000002
Command pass
response 0x98010589 = 0x0000003F
response 0x9801058A = 0x000000C1
response 0x9801058B = 0x000000FF
response 0x9801058C = 0x00000080
response 0x9801058D = 0x00000000
response 0x9801058E = 0x000000FF
card powerup status = 0x000000C1
card capacity status = 0x00000001
can switch to 1.8V = 0x00000001
Command 0x0000000B
interrupt 0x98010424 = 0x00000002
Command pass
response 0x98010589 = 0x0000000B
response 0x9801058A = 0x00000000
response 0x9801058B = 0x00000000
response 0x9801058C = 0x00000003
response 0x9801058D = 0x00000000
response 0x9801058E = 0x000000D9
wait 0x98010585[4:0] 0
wait 0x98010585[4:0] done
wait 0x98010585[4:0] 1
wait 0x98010585[4:0] done
Command 0x00000002
interrupt 0x98010424 = 0x00000012
Command pass
response 0x98010589 = 0x00000029
response 0x9801058A = 0x00000005
response 0x9801058B = 0x00000018
response 0x9801058C = 0x00000001
response 0x9801058D = 0x00000039
response 0x9801058E = 0x000000CD
CID 0xA0000 = 0x%x
4D54023F
CID 0xA0004 = 0x%x
32334153
CID 0xA0008 = 0x%x
29315047
CID 0xA000C = 0x%x
39011805
Command 0x00000003
interrupt 0x98010424 = 0x00000012
Command pass
response 0x98010589 = 0x00000003
response 0x9801058A = 0x00000012
response 0x9801058B = 0x00000034
response 0x9801058C = 0x00000005
response 0x9801058D = 0x00000000
response 0x9801058E = 0x00000021
RCA = 0x00001234
Command 0x00000007
interrupt 0x98010424 = 0x00000012
Command pass
response 0x98010589 = 0x00000007
response 0x9801058A = 0x00000000
response 0x9801058B = 0x00000000
response 0x9801058C = 0x00000007
response 0x9801058D = 0x00000000
response 0x9801058E = 0x00000075
SD card has been initialized.
Command 0x00000037
interrupt 0x98010424 = 0x00000012
Command pass
response 0x98010589 = 0x00000037
response 0x9801058A = 0x00000000
response 0x9801058B = 0x00000000
response 0x9801058C = 0x00000009
response 0x9801058D = 0x00000020
response 0x9801058E = 0x00000033
AppCommand 0x00000006
interrupt 0x98010424 = 0x00000012
Command pass
response 0x98010589 = 0x00000006
response 0x9801058A = 0x00000000
response 0x9801058B = 0x00000000
response 0x9801058C = 0x00000009
response 0x9801058D = 0x00000020
response 0x9801058E = 0x000000B9
4-bit bus width
SDR12/normal mode.
Command 0x00000006
interrupt 0x98010424 = 0x00000012
Command pass
response 0x98010589 = 0x00000006
response 0x9801058A = 0x00000000
response 0x9801058B = 0x00000000
response 0x9801058C = 0x00000009
response 0x9801058D = 0x00000000
response 0x9801058E = 0x000000DD
DMA finished
cr_auto_Read_Write_1, cmd_idx = 0x00000012
Command pass
response 0x98010589 = 0x0000000C
response 0x9801058A = 0x00000000
response 0x9801058B = 0x00000000
response 0x9801058C = 0x0000000B
response 0x9801058D = 0x00000000
response 0x9801058E = 0x0000007F
interrupt 0x98010424 = 0x00000012
Command 0x0000000D
interrupt 0x98010424 = 0x00000002
Command pass
response 0x98010589 = 0x0000000D
response 0x9801058A = 0x00000000
response 0x9801058B = 0x00000000
response 0x9801058C = 0x00000009
response 0x9801058D = 0x00000000
response 0x9801058E = 0x0000003F
64b
U-Boot 2015.07 (Apr 01 2019 - 08:48:21 +0800)
CPU : Cortex-A53 Quad Core - AARCH64
Board: Banana Pi BPI-W2 (RTD1296)
DRAM: 2 GiB
Watchdog: Disabled
mapping memory 0x20000000-0x40000000 non-cached
flushing dcache successfully.
MMC: Initialize eMMC in traditional mmc flow.
RTD1295 eMMC: 0
rsp[0]=0x15010038,
rsp[1]=0x474d4534,
rsp[2]=0x5201f681,
rsp[3]=0xb84d7469
The cid_val is 15.
rsp[0]=0xd0270132,
rsp[1]=0x0f5903ff,
rsp[2]=0xf6dbffef,
rsp[3]=0x8e40400d
mmc->version=0x40000000
version=0x00000004
[LY] cardtype=57, mmc->card_caps=0f
[LY] freq = 00464388, clk diver = 00000080
[LY] speed up emmc at HS-200
[LY] HS-200 bus width=2
[LY] mmc->boot_caps = 20b
TEMP TX_WINDOW=0x7ffffffe, TX_best=0xf
RX_WINDOW=0xffffff03, RX_best=0x14
TX1_WINDOW=0x7fffff80, TX_best=0x12
[LY] hs200 : 0
[HC] ERASE Unit Size = 524288 bytes
[HC] WPG_SIZE = 8388608 bytes
Device: RTD1295 eMMC
Manufacturer ID: 15
OEM: 100
Name: 8GME4
Tran Speed: 200000000
Rd Block Len: 512
MMC version 4.0
High Capacity: No
Capacity: 7.3 GiB
User Capacity: 7.3 GiB
Boot Capacity: 4 MiB
RPMB Capacity: 512 KiB
Bus Width: 8-bit
Speed: HS200
SD:
SD device index# 0
mmc->scr[0]=2358043,mmc->scr[1]=1000000
SD: init done, no error
SD: capacity 60506112 sectors(0x39b4000), (29544 MB)
Factory: SD
Factory: pp:0, seq#:0x2, size:0x200
------------can't find tmp/factory/000BootParam.h
Set up default values
[logo]src w/h=1920/1080 dst w/h=3840/2160
[ENV] read_env from factory failed
Using default environment
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
vid=31,19,18,16,4,3,
------------can't find tmp/factory/video_rpc.bin
tv_system=25 mode=1
Net: Realtek PCIe GBE Family Controller mcfg = 0024
dev->name=r8168#0
Checking default environment
Hit Esc or Tab key to enter console mode or rescue linux: 3
------------can't find tmp/factory/recovery
======== Checking into android recovery ==== 0
Interface: SD
Device 0: Vendor: Man 02544d Snr 31290518 Rev: 5.0 Prod: SA32G
Type: Removable Hard Disk
Capacity: 29544.0 MB = 28.8 GB (60506112 x 512)
Filesystem: FAT32 "BPI-BOOT "
Boot from SD
reading bananapi/bpi-w2/linux/uEnv.txt
1364 bytes read in 6 ms (221.7 KiB/s)
Loaded environment from uEnv.txt
[console:earlycon=uart8250,mmio32,0x98007800 fbcon=map:0 console=ttyS0,460800] [root:/dev/mmcblk0p2 rw rootfstype=ext4 rootwait ] [kernel:] [fdt:]
Banana Pi bpi-w2 chip: RTD1296 Service: linux
==== boot_from_sd (boot from SD mode; secure_mode 0)=====
reading bananapi/bpi-w2/linux/bpi-w2.dtb
46741 bytes read in 8 ms (5.6 MiB/s)
Loading "bananapi/bpi-w2/linux/bpi-w2.dtb" to 0x02100000 is OK.
reading bananapi/bpi-w2/linux/uInitrd
9471906 bytes read in 474 ms (19.1 MiB/s)
Loading "bananapi/bpi-w2/linux/uInitrd" to 0x31400000 is OK.
reading bananapi/bpi-w2/linux/uImage
24185408 bytes read in 1168 ms (19.7 MiB/s)
Loading "bananapi/bpi-w2/linux/uImage" to 0x03000000 is OK.
reading bananapi/bpi-w2/linux/bluecore.audio
3969840 bytes read in 192 ms (19.7 MiB/s)
Loading "bananapi/bpi-w2/linux/bluecore.audio" to 0x0f900000 is OK.
Start Audio Firmware ...
flushing dcache successfully.
[bonding] 1295 chip
ClassifyBonding 0x00000800, num = 0x00000001 PB (PA)
[AUDIO][WARNING]power saving config, magic 0xffffffff != 0x80838665
[FW]kylin_bring up hwsetting
Finish kylin_bring_temp hwsetting
[+][AO][aio_HWEnable]
[AO]aio_CRTOn:
SYS_CLOCK_ENABLE1 [ 0x9800000c]: 0x93fe8561
[AO]aio_PowerControlHDMIOn:
set SYS_CLOCK_ENABLE2 [ 0x98000010]: 0xd851e416
SYS_CLOCK_ENABLE2 [ 0x98000010]: 0xd851e416
[AO]aio_PowerControlDACOn_clk:
SYS_CLOCK_ENABLE2 [ 0x98000010]: 0xd85fe416
[AO]aio_PowerControlSPDIFOn:
set SYS_CLOCK_ENABLE2 [ 0x98000010]: 0xd87fe416
SYS_CLOCK_ENABLE2 [ 0x98000010]: 0xd87fe416
[AO]aio_PowerControlI2SOn:
set SYS_CLOCK_ENABLE2 [ 0x98000010]: 0xd8ffe416
SYS_CLOCK_ENABLE2 [ 0x98000010]: 0xd8ffe416
SYS_SOFT_RESET1 [ 0x98000000]: 0xbfd21001
SYS_SOFT_RESET4 [ 0x98000050]: 0x0000801f
[AO]ao_SetDACAnalogOff:
set AIO_O_ACANA_GCTL1 [ 0x98006604]: 0x000a2aac
get AIO_O_ACANA_GCTL1 [ 0x98006604]: 0x24900004
set AIO_I_ACANA_ADC_GCTL2 [ 0x98006610]: 0x880a2a00
[-][AO][aio_HWEnable]
[Audio]SetTickRate 0x000000c8
HDMI Raw Enable: AC3 DTS MPEG2 AAC DDP MLP
SPDIF Raw Enable: AC3 DTS MPEG2 AAC MLP
Force 2ch Format: DTS DTSHD AC3 DDP MLP AAC WMAPRO
[AO][InitHDMIVideoType]HDMI Frequecny 148, resolution 25
@@@@@@@One Step TV System magic number = 0xc0de0bee, addr = 0xa001f800@@@@@@@
@@@@@@@@@ boot_info->tv_sys.interfaceType 0
HDMIOff = 0
[VO]vo->is_hdmi_off_clock_on:0
[VO_SetVideoStandard]st 25 p 1 1 0
[VO_SetVideoStandard]dp_standard:1 data0 0x00000004 data1 0x00000000
[VO_SetVideoStandard]HDMIoff 0 is_tve_on 0 user_cvbs_off 1
lvds.format 0 port_setting 0x00000381 lvds_wb 0
vo->mixer_call_dsr: 0x00000000
[VO setTVStandard 25 3D 0 0]
(TVE) TVE_DAC_mode 0,cmd->enProg 1!!
~~comp 0, ch2 0, mode_3D 0!!
SetVideoStandard return!
(VO_ConfigHDMI_InfoFrame) L:272, is_hdmi_plugin 1, hdmiMode 1!!Mode 1 dataByte1 0x00000040 0x000000a8 0x00000000
dataByte4 0x00000000 0x00000000 int0 0x00000001
(HDMI_3D) mode 1, HDMI_gen 1, En_3D 0, Format_3D 0 scramble:0!!RGB_or_YCbCr:2 Pixel_Colocrt:2 Deep_Color:0 Deep_Depth:0 xvycc:0
@@not hdr tv. clearDynamicRangeMasteringPkt
go back SET_HDMI!!
boot_info 0xa0000000 magic 0xffffffff en 255
[AO][_AO_if_video_HDMI_mode]HDMI not enabled
[AO][+]_AO_setup_default_audio_infoframe
[AO][--]_AO_hdmi_disable(0)
[AUDIO WARNING]
[AO][_AO_hdmi_disable]do nothing, HDMI not enable 0x00000000 0x00000001
Audio_Channel_Count 1 :2CH, audio_layout:0
HDMI_Frequency 148 :1080p50,1080p60
Sampling_Frequency 3 :48K
CTS = 148500, N = 6144
[+][HDMI_gen_audio_infoframe]
CA:2CH: L,R
[-][HDMI_gen_audio_infoframe]
SYS_PLL_PSAUDA1 [ 0x98000130]: 0x0050022d
[AO][++]_AO_hdmi_enable(0)
[AUDIO WARNING]
[AO][_AO_hdmi_enable]do nothing, HDMI not enable 0x00000000 0x00000001
[AO][-]_AO_setup_default_audio_infoframe
CONFIG_WAIT_AFW_1_SECOND on
booti_argv ={ booti,0x03000000,0x31400000,0x02100000,}
[Info] convert some env variable to fdt:factory node
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
Info: Try to add new node /factory...
libfdt fdt_add_subnode(): FDT_ERR_NOSPACE
## Booting kernel from Legacy Image at 03000000 ...
Image Name:
Image Type: AArch64 Linux Kernel Image (uncompressed)
Data Size: 24185344 Bytes = 23.1 MiB
Load Address: 03000000
Entry Point: 03000000
Verifying Checksum ... OK
Loading Kernel Image ... OK
## Loading init Ramdisk from Legacy Image at 31400000 ...
Image Name:
Image Type: AArch64 Linux RAMDisk Image (uncompressed)
Data Size: 9471842 Bytes = 9 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
## Flattened Device Tree blob at 02100000
Booting using the fdt blob at 0x2100000
reserving fdt memory region: addr=0 size=100000
reserving fdt memory region: addr=1f000 size=1000
reserving fdt memory region: addr=1ffe000 size=4000
reserving fdt memory region: addr=2200000 size=400000
reserving fdt memory region: addr=2600000 size=c00000
reserving fdt memory region: addr=3200000 size=b800000
reserving fdt memory region: addr=10000000 size=14000
reserving fdt memory region: addr=14200000 size=9200000
Using Device Tree in place at 0000000002100000, end 000000000210e694
[FDT] mac = 00:10:20:30:40:50
Unable to update property /gmac@0x98060000:local-mac-address, err=FDT_ERR_NOTFOUND
[FDT] update MAC address
Bring UP slave CPUs
Starting Kernel ...
flushing dcache successfully.
What I did
After building the Image (with the very same make args you used for 4.9.11x) I
put the Image and Image.gz files into the root of mmcblk1p1
partition, including System.map (guess not much use for it), that didn’t worked, obviously, since the uboot config loads bananapi/bpi-w2/linux/uImage and bananapi/bpi-w2/linux/uInitrd insted, so I made mkimage uImage
files out of the Image
including some guesswork on what exact args I need to use.
Question: which flags are the one to be used? Are the memory adresses listed fixed for all files or deterministic? What I mean is:
booti_argv ={ booti,0x03000000,0x31400000,0x02100000,}
0x03000000
→ kernel → uImage, Image, Image.gz, uImage.gz ?
0x31400000
→ ramdisk → uInitird, Initrd? ?
bananapi/bpi-w2/linux/uInitrd
bananapi/bpi-w2/linux/uInitrd and bananapi/bpi-w2/linux/uImage were replaced witk mkimage made files including dtb from the very same directory.
–
Question 1: Do I need a new properly made .dtb from current sources or can I simply re-use your dtb files released with the 4.9.11x W2 kernel?
Question 2: How do I figure/read/findout which loadadrr where to load the kernel/initrd files to and how to build a proper uImage
with mkimage
?
After the last line nothing happens.
Booting I replaced the files on mmcblk1p1 partition within the /bananapi/…/tree with my own mkimage packs, BUT, I’m not sure I properly packed those, I assume I did since the kernel is loading.
TAKEAWAYS
0) Read the docs, read the docs again…
1) I tried to build from source package under (directory /linux-rtk from BPI-W2-BP package) but it does not compute well on Archlinux, which I run as my usual distro.
I guess that building with Linearo proofed tool-chain made sense 5 years ago, but today GCC 10.x works wonders on arm so using pre 10.x tool-chain does not sense for mainline kernel, a lot of work was done by Andreas for RTD1295/96 board. The goal is to build a kernel with distro-mainted GCC, which is (almost always) the latest GCC release on arch without any headaches. I might be wrong, if you please drop me a line why Linearo is the better thing to use.
@BPI: Could you please push re-based 4.9.xxx latest working kernel source with your pataches/additions on a separate stand-alone GitHub repository? This would be a lot of easier to fiddle/fork and especially diff things. *Please, be so kind, this shouldn’t be of any hustle/effort at all since you already “released” the source there, it just sits in a repo I dont really can efficiently fork. Thanks in advance.
2) Building with ccache
and/or distcc
with a x86/64 and Aarch64 mixed hosts is a pain so I ended up compiling natively on the board with GCC 10.2 including a dumpload of modules (BPI-W2 4.9.11 has a very small amount available with the bin release, any particular reason? Some initrd/kernel size contrains to consider?)
Any tip for distcc/ccache config that would work with mixed architectures?
I got a 16 cores intel machine that cant help out. The board, is a speedy beast but I takes ~1.5h to chomp the sources with ccached files. I would like to use distcc where my x86 machine is slaved to the W2 and works as a CROSS_COMPILE worker.
@BPI: bpi-tools are a good effort, but it is not (well enough) documented, implemented almost completely without any regard for failures or error handling. I certainly don’t want to judge, uboot seems to be a yet another complexity on top but if you guys release things into the wild, please, at least put some effort to docs, you cant?
Here’s an Idea: give some free hardware in exchange for documenting and they will do it for you. Without it you are pissing on your own business and your sales. Period. I won’t comment on your work (or lack of it) any further.
HARDWARE:
I put some extra m.2 cards and want them to work, they are already present within the current mainline sources, and are reported to be working, so I got big hopes for the W2 beast :]
– UPDATES
FINDINGS/ERRORS/MISTAKES
1) I just spotted my own first wrongdoing, I changed the kernel bootargs see line
[console:earlycon=uart8250,mmio32,0x98007800 fbcon=map:0 console=ttyS0,460800] [root:/dev/mmcblk0p2 rw rootfstype=ext4 rootwait ] [kernel:] [fdt:]
The baud rate 460800
for ttyS0
won’t do. I forgot to revert to the working settings of 115200
, will retry.