<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0"
 xmlns:blogChannel="http://backend.userland.com/blogChannelModule"
>

<channel>
<title><![CDATA[Dobrica Pavlinušić's random unstructured stuff: M8S PRO]]></title>
<link>https://saturn.ffzg.hr/rot13/index.cgi?m8s_pro</link>
<description></description>
<pubDate>Thu, 24 Jun 2021 19:02:32 -0000</pubDate>
<webMaster>root@saturn.ffzg.hr</webMaster>
<generator>Socialtext Workspace v2.19.0.2</generator>

<item>
<title><![CDATA[M8S PRO]]></title>
<link>https://saturn.ffzg.hr/rot13/index.cgi?m8s_pro</link>
<description><![CDATA[<div>Creator: Dobrica Pavlinušić</div><hr/><div>Tags: arm</div><hr/><div class="wiki">
<p>
Board sticker: M8S PRO R4 S912 3G 32G DDR4 DQ</p>
<div class="nlw_phrase"><table class="wafl_container">
  <tr>
    <td>
      <div class="wafl_box">
        
          <div class="wafl_titlebox">
            <div class="wafl_title">
              
                Contents: [Dobrica Pavlinušić's random unstructured stuff]
              
            </div>
          </div>
          <div class="wafl_items">
            
              <div class="wiki">
<ul>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#android_info">Dobrica Pavlinušić's random unstructured stuff (Android info)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Android info} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#recovery_sd">Dobrica Pavlinušić's random unstructured stuff (recovery sd)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] recovery sd} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#amlogic_info">Dobrica Pavlinušić's random unstructured stuff (amlogic info)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] amlogic info} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#armbian">Dobrica Pavlinušić's random unstructured stuff (armbian)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] armbian} --></span></li>

<ul>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#ath10k_wifi_sdio_firmware">Dobrica Pavlinušić's random unstructured stuff (ath10k wifi sdio firmware)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] ath10k wifi sdio firmware} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#kernel_source">Dobrica Pavlinušić's random unstructured stuff (kernel source)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] kernel source} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#u_boot_source">Dobrica Pavlinušić's random unstructured stuff (u-boot source)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] u-=boot source} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#balbes150_updates">Dobrica Pavlinušić's random unstructured stuff (balbes150 updates)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] balbes150 updates} --></span></li>
</ul>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#gpiod">Dobrica Pavlinušić's random unstructured stuff (gpiod)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] gpiod} --></span></li>

<ul>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#button_gpio_2">Dobrica Pavlinušić's random unstructured stuff (button - gpio 2)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] button -= gpio 2} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#led_gpio_9">Dobrica Pavlinušić's random unstructured stuff (led - gpio 9)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] led -= gpio 9} --></span></li>
</ul>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#u_boot">Dobrica Pavlinušić's random unstructured stuff (u-boot)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] u-=boot} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#2020_10_status_for_amlogic">Dobrica Pavlinušić's random unstructured stuff (2020-10 status for amlogic)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] 2020-=10 status for amlogic} --></span></li>
</ul>
</div>

            
            
          </div>
        
      </div>
    </td>
  </tr>
</table>
<!-- wiki: {toc: }
--></div><br /><br /><span class="nlw_phrase"><img alt="M8S-PRO.jpg" src="https://saturn.ffzg.hr/rot13/index.cgi/M8S-PRO.jpg?action=attachments_download;page_name=m8s_pro;id=20200910192403-0-17633" /><!-- wiki: {image: M8S-=PRO.jpg} --></span><br /><br /><p>
It doesn't have button soldered, it works like power button in android</p>
<p>
Serial port is marked on bottom of board (tx/rx are from cpu perspective)</p>
<p>
probably: <a target="_blank" title="(external link)" href="https://www.geekbuying.com/item/MECOOL-M8S-PRO-S912-KODI-17-0-4K-HDR10-3GB-DDR4-32GB-eMMC-TV-Box-380737.html">https://www.geekbuying.com/item/MECOOL-M8S-PRO-S912-KODI-17-0-4K-HDR10-3GB-DDR4-32GB-eMMC-TV-Box-380737.html</a></p>
<h1 id="android_info">Android info</h1>
<p>
Android 7.1 bootlog from serial: <span class="nlw_phrase"><a href="https://saturn.ffzg.hr/rot13/index.cgi/m8s-android-bootlog.txt.gz?action=attachments_download;page_name=m8s_pro;id=20200911192044-0-13804">m8s-android-bootlog.txt.gz</a><!-- wiki: {file: m8s-=android-=bootlog.txt.gz} --></span></p>
<pre>
U-Boot 2015.01-g9331ff1-dirty (Mar 15 2018 - 16:16:24)

DRAM:  3 GiB
...
        aml_dt soc: gxm platform: q20xrmii variant: 3g
        dtb 0 soc: gxm   plat: q20xrmii   vari: 2g
        dtb 1 soc: gxm   plat: q20xrmii   vari: 3g
      Find match dtb: 1
...
parts: 10
00:      logo	0000000002000000 1
01:  recovery	0000000002000000 1
02:       rsv	0000000000800000 1
03:       tee	0000000000800000 1
04:     crypt	0000000002000000 1
05:      misc	0000000002000000 1
06:      boot	0000000002000000 1
07:    system	0000000080000000 1
08:     cache	0000000020000000 2
09:      data	ffffffffffffffff 4

M8SPRO:/ # uname -a
Linux localhost 3.14.29 #46 SMP PREEMPT Thu Apr 12 19:43:12 CST 2018 armv8l

M8SPRO:/ # cat /proc/cmdline
rootfstype=ramfs init=/init console=ttyS0,115200 no_console_suspend earlyprintk=aml-uart,0xc81004c0 ramoops.pstore_en=1 ramoops.record_size=0x8000 ramoops.console_size=0x4000 androidboot.selinux=permissive logo=osd1,loaded,0x3d800000,1080p60hz maxcpus=8 vout=1080p60hz,enable hdmimode=1080p60hz cvbsmode=576cvbs hdmitx= cvbsdrv=0 pq= androidboot.firstboot=0 jtag=apao androidboot.hardware=amlogic mac=D0:76:58:0E:63:A3 androidboot.mac=D0:76:58:0E:63:A3 androidboot.slot_suffix=_a buildvariant=userdebug

M8SPRO:/ # cat /proc/cpuinfo
Processor	: AArch64 Processor rev 4 (aarch64)
processor	: 0
processor	: 1
processor	: 2
processor	: 3
processor	: 4
processor	: 5
processor	: 6
processor	: 7
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 wp half thumb fastmult vfp edsp neon vfpv3 tlsi vfpv4 idiva idivt 
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

Hardware	: Amlogic
Serial		: 220a82006da41365fedf301742726826

M8SPRO:/ # free
		total        used        free      shared     buffers
Mem:       2876604416  2210639872   665964544           0    31326208
-/+ buffers/cache:     2179313664   697290752
Swap:       524283904           0   524283904

M8SPRO:/ # df
ilesystem        1K-blocks    Used Available Use% Mounted on
mpfs               1404592     504   1404088   1% /dev
tmpfs               1404592       0   1404592   0% /mnt
/dev/block/system   2031440  973788   1057652  48% /system
/dev/block/data    26969964 3050864  23919100  12% /data
/dev/block/cache     507848    2860    504988   1% /cache
/dev/block/tee         5115      45      5070   1% /tee
/dev/fuse          26969964 3050864  23919100  12% /mnt/runtime/default/emulated
/dev/fuse          26969964 3050864  23919100  12% /mnt/runtime/read/emulated
/dev/fuse          26969964 3050864  23919100  12% /mnt/runtime/write/emulated

</pre>
<br /><h1 id="recovery_sd">recovery sd</h1>
<p>
<a target="_blank" title="(external link)" href="https://www.cnx-software.com/2016/11/19/how-to-create-a-bootable-recovery-sd-card-for-amlogic-tv-boxes/">https://www.cnx-software.com/2016/11/19/how-to-create-a-bootable-recovery-sd-card-for-amlogic-tv-boxes/</a></p>
<h1 id="amlogic_info">amlogic info</h1>
<p>
<a target="_blank" title="(external link)" href="http://www.linux-meson.com/doku.php">http://www.linux-meson.com/doku.php</a></p>
<h1 id="armbian">armbian</h1>
<p>
<a target="_blank" title="(external link)" href="https://forum.armbian.com/topic/12162-single-armbian-image-for-rk-aml-aw-aarch64-armv8/">https://forum.armbian.com/topic/12162-single-armbian-image-for-rk-aml-aw-aarch64-armv8/</a></p>
<pre>
dpavlin@nuc:~/Downloads$ xzcat Armbian_20.09_Arm-64_bullseye_current_5.8.5.img.xz | dd iflag=fullblock oflag=direct conv=fsync status=progress bs=1M of=/dev/sdb
dpavlin@nuc:~/Downloads$ sudo mount /dev/sdb1 /mnt/sdb1/
dpavlin@nuc:~/Downloads$ cd /mnt/sdb1/

root@nuc:/mnt/sdb1# cp u-boot-s905x-s912 u-boot.ext

root@nuc:/mnt/sdb1# vi extlinux/extlinux.conf

root@nuc:/mnt/sdb1# grep -v '^#' extlinux/extlinux.conf
LABEL Armbian
LINUX /zImage
INITRD /uInitrd

FDT /dtb/amlogic/meson-gxm-q201.dtb
APPEND root=LABEL=ROOTFS rootflags=data=writeback rw console=ttyAML0,115200n8 console=tty0 no_console_suspend consoleblank=0 fsck.fix=yes fsck.repair=yes net.ifnames=0

</pre>
<br /><p>
Note that this board uses <strong>meson-gxm-q201.dtb</strong> which is internal rmii to make ethernet work!</p>
<p>
issue <tt>reboot update</tt> from android shell to boot from sdcard</p>
<h2 id="ath10k_wifi_sdio_firmware">ath10k wifi sdio firmware</h2>
<p>
After booting, you will get error message about missing firmware:</p>
<pre>
[    7.861827] ath10k_sdio mmc2:0001:1: Failed to find firmware-N.bin (N between 2 and 6) from ath10k/QCA9377/hw1.0: -2
[    7.861838] ath10k_sdio mmc2:0001:1: could not fetch firmware files (-2)
</pre>
<br /><p>
Package <tt>firmware-atheros</tt> is installed, so it's a bit puzzeling what file is missing, however, if we go to</p>
<p>
<a target="_blank" title="(external link)" href="https://github.com/kvalo/ath10k-firmware.git">https://github.com/kvalo/ath10k-firmware.git</a></p>
<p>
we can find sdio firmware at <a target="_blank" title="(external link)" href="https://github.com/kvalo/ath10k-firmware/tree/master/QCA9377/hw1.0/untested">https://github.com/kvalo/ath10k-firmware/tree/master/QCA9377/hw1.0/untested</a></p>
<pre>
dpavlin@m8s:~/ath10k-firmware$ git remote -v
origin	https://github.com/kvalo/ath10k-firmware.git (fetch)
origin	https://github.com/kvalo/ath10k-firmware.git (push)

dpavlin@m8s:~/ath10k-firmware$ sudo cp QCA9377/hw1.0/untested/firmware-sdio-5.bin_WLAN.TF.1.1.1-00061-QCATFSWPZ-1 /lib/firmware/ath10k/QCA9377/hw1.0/firmware-sdio-5.bin
</pre>
<br /><p>
After running <tt>nmtui</tt> and configuring wifi it's available but dies after a while under load.</p>
<h2 id="kernel_source">kernel source</h2>
<p>
<a target="_blank" title="(external link)" href="https://github.com/150balbes/Amlogic_s905-kernel">https://github.com/150balbes/Amlogic_s905-kernel</a></p>
<p>
currently, I'm using</p>
<pre>
dpavlin@m8s:~/linux$ git remote -v
origin	https://github.com/xdarklight/linux (fetch)
origin	https://github.com/xdarklight/linux (push)
dpavlin@m8s:~/linux$ git branch
  master
  meson-mx-integration-5.11-20210124
  meson-mx-integration-5.13-20210503
* meson-mx-integration-5.13-20210523
dpavlin@m8s:~/linux$ cat mason-build.sh
# https://github.com/SLAzurin/armbian-aml-s8xx-kernel-build-steps

# https://github.com/xdarklight/linux

make -j 8 Image dtbs modules &amp;&amp; sudo make modules_install dtbs_install install
</pre>
<br /><p>
Installing armbian kernel package doesn't work because /boot partition is vfat and not ext2/4</p>
<h2 id="u_boot_source">u-boot source</h2>
<p>
<a target="_blank" title="(external link)" href="https://github.com/150balbes/Amlogic_S905-u-boot">https://github.com/150balbes/Amlogic_S905-u-boot</a></p>
<h2 id="balbes150_updates">balbes150 updates</h2>
<p>
installing linux image and headers does return error, but works</p>
<p>
<a target="_blank" title="(external link)" href="https://users.armbian.com/balbes150/">https://users.armbian.com/balbes150/</a></p>
<h1 id="gpiod">gpiod</h1>
<pre>
sudo apt install gpiod
</pre>
<br /><h2 id="button_gpio_2">button - gpio 2</h2>
<pre>
root@arm-64:~# gpioget gpiochip0 2 # not pressed
1
root@arm-64:~# gpioget gpiochip0 2 # pressed
0
</pre>
<br /><h2 id="led_gpio_9">led - gpio 9</h2>
<pre>
root@arm-64:~# gpioset gpiochip0 9=0 # red

root@arm-64:~# gpioset gpiochip0 9=1 # blue (default)
</pre>
<br /><h1 id="u_boot">u-boot</h1>
<p>
old <a target="_blank" title="(external link)" href="https://github.com/endlessm/u-boot-meson">https://github.com/endlessm/u-boot-meson</a></p>
<p>
I wanted serial console which seems to be missing from armbian build above</p>
<p>
wiki seems to suggest repository</p>
<p>
<a target="_blank" title="(external link)" href="https://gitlab.denx.de/u-boot/custodians/u-boot-amlogic">https://gitlab.denx.de/u-boot/custodians/u-boot-amlogic</a></p>
<p>
but we are going to use upstream u-boot</p>
<pre>
dpavlin@m8s:~/u-boot-amlogic$ git remote -v
github	https://github.com/u-boot/u-boot (fetch)

dpavlin@m8s:~/u-boot-amlogic$ libretech-cc_defconfig
dpavlin@m8s:~/u-boot-amlogic$ make -j 8
dpavlin@m8s:~/u-boot-amlogic$ cp u-boot.bin /boot/
</pre>
<br /><p>
abort u-boot with key press and boot new one with</p>
<pre>
fatload mmc 1 0x1000000 u-boot.bin
go 0x1000000
</pre>
<br /><h1 id="2020_10_status_for_amlogic">2020-10 status for amlogic</h1>
<p>
U-Boot: Porting and Maintaining a Bootloader for a Multimedia SoC Family - Neil Armstrong, BayLibre SAS</p>
<p>
<a target="_blank" title="(external link)" href="https://youtu.be/u0-swEMDFp0">https://youtu.be/u0-swEMDFp0</a></p>
</div>
<hr/><div>Attachments: IMG_20200911_205538.jpg, m8s-android-bootlog.txt.gz, M8S-PRO.jpg</div>]]></description>
<author>Dobrica Pavlinu&#x161;i&#x107;</author>
<category>arm</category>
<guid isPermaLink="true">https://saturn.ffzg.hr/rot13/index.cgi?m8s_pro</guid>
<pubDate>Thu, 24 Jun 2021 19:02:32 -0000</pubDate>
</item>
</channel>
</rss>