[SOLVED] Support for NanoPC-T3 (very similar to NanoPi-M2)

I don’t think that I’ve really done that much to receive explicit credit. In case you really feel like you need to mention me, please simply use “awl” or “awl29” (without a full real name).

And another difference in naming: While the “M” models are called Nano**Pi, the “T” models are called NanoPC**, so you may want to change the models’ long description texts one more time…!?

Yup, I know. I had already done so in my image with which I was able to successfully boot DietPi.

Regarding the full model patch for NanoPi3, would it be possible for you to please also modify the finalise script until Wednesday: It must be changed in a way that it also post-processes /etc/fstab in order not to end up with an unbootable system (an unpatched finalise script for HW_MODEL=62 currently ends up with a boot partition of type vfat and resulting boot failure).

Also, I’ve already noted some issue with serial console, which I seem to be unable to switch between disabled and enabled state.

Finally, the tty1 console does not seem to have a getty spawned (no login prompt after the last kernel boot log message), while virtual consoles tty2 up to tty6 do exist and show a login prompt, even though only tty1 and tty2 should really exist. Will look into this on Wednesday or later when I have more time…

Thanks again for your help in putting me on track quite fast :wink:

Best,
awl

While the “M” models are called NanoPi, the “T” models are called NanoPC, so you may want to change the models’ long description texts one more time…!?

Its mainly a visual thing.
We need to use short descriptions, so the dietpi-banner lines fit on single lines with 320x240 > displays. The purple lines are the max width in 320xXXX
Untitled.png

Regarding the full model patch for NanoPi3, would it be possible for you to please also modify the finalise script until Wednesday: It must be changed in a way that it also post-processes /etc/fstab in order not to end up with an unbootable system (an unpatched finalise script for HW_MODEL=62 currently ends up with a boot partition of type vfat and resulting boot failure).

Done. But with a twist.
We now use the auto filesystem type in /etc/fstab. So we never have to define it :wink:
Heres the updated fstab file https://github.com/Fourdee/DietPi/blob/dev/dietpi/conf/fstab#L3-L4

Also, I’ve already noted some issue with serial console, which I seem to be unable to switch between disabled and enabled state.

Are there any “other” config files in /boot/* that are not dietpi.txt or config.txt?

Finally, the tty1 console does not seem to have a getty spawned (no login prompt after the last kernel boot log message), while virtual consoles tty2 up to tty6 do exist and show a login prompt, even though only tty1 and tty2 should really exist. Will look into this on Wednesday or later when I have more time…

Strange, never experienced this myself, try:

systemctl enable getty@tty[1-2].service
systemctl disable getty@tty[3-6].service
reboot

Hello again,

Ah, I see… Ouch… :roll_eyes:

Great - thanks! :smiley:

No, none.

Bingo - that resolved this one! :slight_smile:

Good news: I have now created the following alpha build based on the current state of the v131/git “testing” branch:

-rw-r--r--   1 root  root   84378941 Sep 16 00:00 DietPi_NanoPiM3T3-armv7-(Jessie).7z



Listing archive: DietPi_NanoPiM3T3-armv7-(Jessie).7z

--
Path = DietPi_NanoPiM3T3-armv7-(Jessie).7z
Type = 7z
Method = LZMA
Solid = +
Blocks = 1
Physical Size = 84378941
Headers Size = 234

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2016-09-15 23:55:05 ....A         6372     84378707  README.md
2016-09-15 23:57:15 ....A    540016640               DietPi_v131_NanoPiM3T3-armv7-(Jessie).img
------------------- ----- ------------ ------------  ------------------------
                             540023012     84378707  2 files, 0 folders

From cursorily testing, it looks ok! :smiley:

Although with one small known issue:
I still can neither disable the serial console nor switch it from disabled to enabled nor vice-versa.
How can I debug the menu scripts/files? There seems to be some error messages when I select Enable/Disable, but I am unable to read them as they are displayed only for a few milliseconds before the screen gets blue again and the menu window displayed.

Where do you want me to upload the 7z file? Please advise!
Or should I rather wait until you officially released v131, and then rebuild from the real “master” branch as soon as v131 has been integrated?

Thanks & best regards,
awl

Hi awl,

Great work, looks good :slight_smile:

Although your 1st image is probably fine, it wouldn’t be a bad idea, just to make sure there are no “kinks”. Hoping to release v131 Sunday, so that would be the perfect time to recreate the image if you are able to?
If you do this, make sure you use the current system prep script,https://github.com/Fourdee/DietPi/blob/dev/PREP_SYSTEM_FOR_DIETPI.sh

As I made some changes (mainly the auto filesystem mounts for /boot): History for PREP_SYSTEM_FOR_DIETPI.sh - Fourdee/DietPi · GitHub

I still can neither disable the serial console nor switch it from disabled to enabled nor vice-versa.
How can I debug the menu scripts/files? There seems to be some error messages when I select Enable/Disable, but I am unable to read them as they are displayed only for a few milliseconds before the screen gets blue again and the menu window displayed.

Try running the function script itself:

/DietPi/dietpi/func/dietpi-set_hardware serialconsole enable
/DietPi/dietpi/func/dietpi-set_hardware serialconsole disable

It should result in:

Where do you want me to upload the 7z file? Please advise!

I’ll setup a dropbox share for the upload, if you could email me daniel.knight@dietpi.com with a simple “hello, give dropbox”, i’ll set one up :slight_smile:

Hello Fourdee,

I will definitely do so in order to ensure that the image becomes official and contains a released state, although I’d still consider it beta state due to potential other issues like with the serial console (see below) that you maybe want to address before releasing v131.

Done, my output is:

root@DietPi:~# /DietPi/dietpi/func/dietpi-set_hardware serialconsole enable

 DietPi-Set_Hardware
âââââââââââââââââââââââââââââââââââââââââââââââââââââ
 Mode: serialconsole (enable)
 Please wait...

Failed to execute operation: Invalid argument
 [Ok] serialconsole enable | Completed

root@DietPi:~# sh -x /DietPi/dietpi/func/dietpi-set_hardware serialconsole enable
/DietPi/dietpi/func/dietpi-set_hardware: 407: /DietPi/dietpi/func/dietpi-set_hardware: Syntax error: "(" unexpected (expecting "}")
root@DietPi:~#

This means that you need to check the brackets in this file in v131 - it may be corrupt!?

I now moved the “-x” to the first line of the script: “#!/bin/bash -x” in order to see more:

root@DietPi:~# /DietPi/dietpi/func/dietpi-set_hardware serialconsole enable     + LANG=en_GB.UTF-8
++ echo -e serialconsole
++ tr '[:upper:]' '[:lower:]'
+ INPUT_DEVICE_NAME=serialconsole
++ echo -e enable
++ tr '[:upper:]' '[:lower:]'
+ INPUT_DEVICE_VALUE=enable
+ '[' enable = 1 ']'
+ '[' enable = 0 ']'
+ EXIT_CODE=0
++ sed -n 1p /DietPi/dietpi/.hw_model
+ HW_MODEL=62
++ sed -n 3p /DietPi/dietpi/.hw_model
+ DISTRO=3
+ PANEL_UPDATE_DIETPITXT=0
+ /DietPi/dietpi/func/dietpi-notify 3 DietPi-Set_Hardware 'serialconsole (enable)'

 DietPi-Set_Hardware
âââââââââââââââââââââââââââââââââââââââââââââââââââââ
 Mode: serialconsole (enable)
 Please wait...

+ '[' serialconsole = soundcard ']'
+ '[' serialconsole = serialconsole ']'
+ Serial_Main
+ '[' enable = enable ']'
+ systemctl enable serial-getty@.service
[b][color=#FF0000]+ systemctl enable serial-getty@ttyAMA0.service
Failed to execute operation: Invalid argument[/color][/b]
+ systemctl enable serial-getty@ttySAC2.service
+ systemctl enable serial-getty@ttyS0.service
+ ((  62 < 10  ))
+ ((  62 == 10  ))
+ ((  62 == 11  ))
+ ((  62 == 12  ))
+ ((  62 >= 40 && 62 < 50  ))
+ sed -i '/^serial_console_enabled=/c\serial_console_enabled=1' /DietPi/dietpi.txt
+ /DietPi/dietpi/func/dietpi-notify -1 0 'serialconsole enable |'
 [Ok] serialconsole enable | Completed

+ exit 0

OK, so even more issues with this on NanoPi3:

  • The serial console device is called /dev/ttySAC0 on this device, not ttySAC2
  • systemctl returns “Invalid argument” for ttyAMA0 (even though the device /dev/ttyAMA0 as such exists)
  • There are the following systemd services in failed/degraded state


root@DietPi:~# systemctl --state=failed
  UNIT                      LOAD   ACTIVE SUB    DESCRIPTION
â hwservice.service         loaded failed failed hwservice
â hwservice_monitor.service loaded failed failed hwservice_monitor
â lcd4linux.service         loaded failed failed daemon for driving LCD based displays

As I am a complete newbie to systemd, please advise! As you seem to have access to a NanoPi2, can you please check whether the same issues also exist there (which, IMO, is quite likely)?

Done! :wink:

Thanks again & best regards
awl

root@DietPi:~# sh -x /DietPi/dietpi/func/dietpi-set_hardware serialconsole enable
/DietPi/dietpi/func/dietpi-set_hardware: 407: /DietPi/dietpi/func/dietpi-set_hardware: Syntax error: “(” unexpected (expecting “}”)

>

Bash and Shell scripts are two different programs. So expected result: http://stackoverflow.com/questions/5725296/difference-between-sh-and-bash
DietPi is all /bin/bash
Although the array init could be =0, then generate the array, i'll take a look.

> ```text
root@DietPi:~# systemctl --state=failed
  UNIT                      LOAD   ACTIVE SUB    DESCRIPTION
â hwservice.service         loaded failed failed hwservice
â hwservice_monitor.service loaded failed failed hwservice_monitor
â lcd4linux.service         loaded failed failed daemon for driving LCD based displays

Not sure what these are, try running the following to get more information:

systemctl status hwservice.service -l
systemctl status hwservice_monitor.service -l
systemctl status cd4linux.service -l



The serial console device is called /dev/ttySAC0 on this device, not ttySAC2

Aha! Lets see if this has any effect on the serial console. Please try running:

systemctl enable serial-getty@ttySAC0.service
reboot
ps aux > /root/attach_enabled.txt

Then same again with disable:

systemctl disable serial-getty@ttySAC0.service
reboot
ps aux > /root/attach_disabled.txt

You should have two files in /root (attach_*.txt), please copy/paste or attach them.


As you seem to have access to a NanoPi2, can you please check whether the same issues also exist there (which, IMO, is quite likely)?

Doubtful, we use ARMbian to build that image. But i’ll make a note to check it either way.

Sorry, I had planned to respond tonight, but I have just found that the SD card in my NanoPC-M3 seems to have crashed, and the image I created last week seems corrupt (partition table has a filesystem size that is much smaller than the correct size in the superblock), so I need to rebuild the image… :frowning:

Will report back hopefully tomorrow night…

Best,
awl

No worries and no rush, it happens :slight_smile:

Hello again,

I have finally found some time to use a proper SD card to rebuild the image - this time based on the official released v131 codebase - and try again:

Oh, I see. Sorry, I should have done “bash -x /DietPi/dietpi/func/dietpi-set_hardware serialconsole enable” (which indeed works fine).



root@DietPi:~# systemctl status hwservice.service -l
● hwservice.service - hwservice
   Loaded: loaded (/lib/systemd/system/hwservice.service; enabled)
   Active: failed (Result: exit-code) since Thu 2016-09-22 15:25:44 BST; 5h 15min ago
  Process: 591 ExecStart=/etc/init.d/hwservice start (code=exited, status=127)
 Main PID: 591 (code=exited, status=127)

Sep 22 15:25:44 DietPi systemd[1]: Starting hwservice...
Sep 22 15:25:44 DietPi hwservice[591]: /etc/init.d/hwservice: line 16: /usr/sbin/hwservice: No such file or directory
Sep 22 15:25:44 DietPi systemd[1]: hwservice.service: main process exited, code=exited, status=127/n/a
Sep 22 15:25:44 DietPi systemd[1]: Failed to start hwservice.
Sep 22 15:25:44 DietPi systemd[1]: Unit hwservice.service entered failed state.



root@DietPi:~# systemctl status hwservice_monitor.service -l
● hwservice_monitor.service - hwservice_monitor
   Loaded: loaded (/lib/systemd/system/hwservice_monitor.service; enabled)
   Active: failed (Result: exit-code) since Thu 2016-09-22 15:25:44 BST; 5h 17min ago
  Process: 584 ExecStart=/etc/init.d/hwservice_monitor start (code=exited, status=127)
 Main PID: 584 (code=exited, status=127)

Sep 22 15:25:44 DietPi hwservice_monitor[584]: /etc/init.d/hwservice_monitor: line 16: /usr/sbin/hwservice_monitor: No such file or directory
Sep 22 15:25:44 DietPi systemd[1]: hwservice_monitor.service: main process exited, code=exited, status=127/n/a
Sep 22 15:25:44 DietPi systemd[1]: Failed to start hwservice_monitor.
Sep 22 15:25:44 DietPi systemd[1]: Unit hwservice_monitor.service entered failed state.



root@DietPi:~# systemctl status lcd4linux.service -l
● lcd4linux.service - daemon for driving LCD based displays
   Loaded: loaded (/lib/systemd/system/lcd4linux.service; enabled)
   Active: failed (Result: exit-code) since Thu 2016-09-22 15:25:44 BST; 5h 17min ago
  Process: 524 ExecStart=/usr/sbin/lcd4linux $ARGS (code=exited, status=127)

Sep 22 15:25:44 DietPi lcd4linux[524]: /usr/sbin/lcd4linux: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory
Sep 22 15:25:44 DietPi systemd[1]: lcd4linux.service: control process exited, code=exited status=127
Sep 22 15:25:44 DietPi systemd[1]: Failed to start daemon for driving LCD based displays.
Sep 22 15:25:44 DietPi systemd[1]: Unit lcd4linux.service entered failed state.

For the first two, it is very interesting that /usr/sbin/hwservice does indeed exist, but on the NanoPi3 is a dangling relative link:

root@DietPi:~# ls -l /usr/sbin/hwservice
lrwxrwxrwx 1 root root 6 Jun 29 12:53 /usr/sbin/hwservice -> bin/ls

and of course, /usr/sbin/bin/ls does not exist. But I have no clue why “hwservice” should even link to “/bin/ls”…!?

Regarding the second one, it first looked like at least Debian packages libx11-6, libgd-3, libmysqlclient18 and libpython2.7.so.1.0 (including their dependencies) are missing, as the lcd4linux binary on my NanoPi3 was dynamically linked against those libraries. But even installing all library dependencies did not help - now lcd4linux failed differently:

root@DietPi:~# systemctl status -l lcd4linux.service
● lcd4linux.service - daemon for driving LCD based displays
   Loaded: loaded (/lib/systemd/system/lcd4linux.service; enabled)
   Active: failed (Result: resources) since Thu 2016-09-22 21:14:16 BST; 3s ago
  Process: 2149 ExecStart=/usr/sbin/lcd4linux $ARGS (code=exited, status=0/SUCCESS)

Sep 22 21:14:16 DietPi LCD4Linux[2151]: LCD2USB: could not find a LCD2USB USB LCD
Sep 22 21:14:16 DietPi LCD4Linux[2151]: Error initializing driver LCD2USB: Exit!
Sep 22 21:14:16 DietPi systemd[1]: PID file /var/run/lcd4linux.pid not readable (yet?) after start.
Sep 22 21:14:16 DietPi systemd[1]: lcd4linux.service never wrote its PID file. Failing.
Sep 22 21:14:16 DietPi systemd[1]: Failed to start daemon for driving LCD based displays.
Sep 22 21:14:16 DietPi systemd[1]: Unit lcd4linux.service entered failed state.

I then noticed that “my” lcd4linux binary was not from Debian, but seemingly from FriendlyARM, as the Debian package “lcd4linux” was not even installed. I then did an “apt-get install lcd4linux”, which indeed finally made the errors go away, and the lcd4linux service is now running, but still has suspicious output:

root@DietPi:~# systemctl status -l lcd4linux.service
● lcd4linux.service - daemon for driving LCD based displays
   Loaded: loaded (/lib/systemd/system/lcd4linux.service; enabled)
   Active: active (running) since Thu 2016-09-22 21:24:59 BST; 54s ago
  Process: 2620 ExecStart=/usr/sbin/lcd4linux $ARGS (code=exited, status=0/SUCCESS)
 Main PID: 2622 (lcd4linux)
   CGroup: /system.slice/lcd4linux.service
           └─2622 /usr/sbin/lcd4linux

Sep 22 21:24:59 DietPi systemd[1]: lcd4linux.service: Supervising process 2622 which is not our child. We'll most likely not notice when it exits.
Sep 22 21:24:59 DietPi systemd[1]: Started daemon for driving LCD based displays.
Sep 22 21:24:59 DietPi LCD4Linux[2622]: widget 'Rain': class 'icon' not supported

Any ideas? :roll_eyes:

Results attached - the ZIP contains both the enabled and the disabled case.

I think you mixed up NanoPi2 (i.e. NanoPi-M2/NanoPC-T2 - for which no Armbian exists) with NanoPi NEO or NanoPi-M1 (for which indeed Armbian images are available). But in case you have indeed created the NanoPi2 image from an Armbian build for the Samsung/Nexell S5P4418 SoC, it would also be possible to use this exact build for NanoPi3 - except both the initramfs and the kernels on the /boot partition, which must be specific to S5P6818.

Additional news:
Even though I think the above issues should probably be fixed before the NanoPi3 image becomes official, I have nevertheless uploaded my new v131 master branch image for NanoPi3 to your dropbox. What do you think?

Thanks again, sorry for all those new (but truly minor!) issues & best regards,
awl
attach_output.zip (2.99 KB)

Hi Awl,

Thanks for the update.
I’ve not had a chance to go through your full post yet, so i’ve created a git ticket to remind me. Hopefully get back to you within a few days: https://github.com/Fourdee/DietPi/issues/530

lcd4linux.service
hwservice.service
hwservice_monitor.service

As far as I can tell, these are non-standard services. Probably something FriendlyARM manually added to their images.

I think for now, we should try disabling them with:

systemctl disable name.service

We can do this with a patch/update. Are those services still enabled on the dropbox uploaded image?

I think you mixed up NanoPi2 (i.e. NanoPi-M2/NanoPC-T2 - for which no Armbian exists) with NanoPi NEO or NanoPi-M1 (for which indeed Armbian images are available).

As yes, correct. M2 image is based on the FriendlyARM image. So many images, hard to keep track lol :slight_smile:

Great work on a image/zip, looks good :slight_smile:

Ok, i’ve uploaded the image here: Index of /downloads/images

I’ll release it under beta, once we can check a few things:

  • Onboard WiFi and Bluetooth. Is this functional at the moment?
    I’ll need to code this into dietpi-set_hardware. Can you run the following commands for me please:
/DietPi/dietpi/func/dietpi-set_hardware wifi enable
cat /etc/modules
ls -lha /etc/modprobe.d/
cat /etc/modprobe.d/*
  • Serial console. if systemctl disable serial-getty@ttySAC0.service has no effect, I believe this may be hard coded as enabled in the /boot binary files. Cant see any config files we can edit. So not much we can do this about this for now.

Hello again,

Yes, unfortunately they are. If they have been created by FriendlyARM (and not Debian or even DietPi), I feel like we should even remove them fully instead of simply disabling them:

systemctl stop [servicename]
systemctl disable [servicename]
rm /etc/systemd/system/[servicename]
rm /etc/systemd/system/[servicename] symlinks that might be related
systemctl daemon-reload
systemctl reset-failed



Thanks, but it’s mostly due to your great instructions on how to do so (including shrinking the image).

WiFi: Yes, Bluetooth: No.

It looks like Bluetooth support (CONFIG_BT) is missing in the Debian/Linux kernel as opposed to the Android kernel. Also, there is a file /etc/modprobe.d/disable_bt.conf that blacklists the respective kernel modules. I will try to work around this, remove the blacklist file and compile a kernel with BT support on my own (based on FriendlyARM’s source: GitHub - friendlyarm/linux-3.4.y: Linux kernel source tree for FriendlyARM NanoPi 2, NanoPi 3) during the next couple of days and report back here.

WLAN is fully functional:

root@DietPi:~# iwconfig wlan0
wlan0     IEEE 802.11bg  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on



/DietPi/dietpi/func/dietpi-set_hardware wifi enable

root@DietPi:~# /DietPi/dietpi/func/dietpi-set_hardware wifi disable

 DietPi-Set_Hardware
âââââââââââââââââââââââââââââââââââââââââââââââââââââ
 Mode: wifi (disable)
 Please wait...

 [Ok] wifi disable | Completed

root@DietPi:~# /DietPi/dietpi/func/dietpi-set_hardware wifi enable

 DietPi-Set_Hardware
âââââââââââââââââââââââââââââââââââââââââââââââââââââ
 Mode: wifi (enable)
 Please wait...

 [Info] Please wait, enabling WiFi Modules...
 [Ok] wifi enable | Completed

cat /etc/modules

root@DietPi:~# cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

ls -lha /etc/modprobe.d/

root@DietPi:~# ls -lha /etc/modprobe.d
total 28K
drwxr-xr-x  2 root root 4.0K Sep 29 21:02 .
drwxr-xr-x 80 root root 4.0K Sep 22 23:46 ..
-rw-r--r--  1 root root   68 Sep  1  2009 bcmdhd.conf
-rw-r--r--  1 root root   37 Sep 29 13:41 cfg80211.conf
-rw-r--r--  1 root root  102 Sep 22 10:57 disable_bt.conf
-rw-r--r--  1 root root  390 May 26  2015 fbdev-blacklist.conf
-rw-r--r--  1 root root  349 Apr  1 04:44 matrix-blacklist.conf

cat /etc/modprobe.d/bcmdhd.conf

options bcmdhd firmware_path=/lib/firmware/ap6212/fw_bcm43438a0.bin

cat /etc/modprobe.d/cfg80211.conf

options cfg80211 ieee80211_regdom=GB

cat /etc/modprobe.d/disable_bt.conf

blacklist hci_uart
blacklist hidp
blacklist rfcomm
blacklist btbcm
blacklist bnep
blacklist bluetooth

cat /etc/modprobe.d/fbdev-blacklist.conf

# This file blacklists most old-style PCI framebuffer drivers.

blacklist arkfb
blacklist aty128fb
blacklist atyfb
blacklist radeonfb
blacklist cirrusfb
blacklist cyber2000fb
blacklist kyrofb
blacklist matroxfb_base
blacklist mb862xxfb
blacklist neofb
blacklist pm2fb
blacklist pm3fb
blacklist s3fb
blacklist savagefb
blacklist sisfb
blacklist tdfxfb
blacklist tridentfb
blacklist vt8623fb

cat /etc/modprobe.d/matrix-blacklist.conf

blacklist adxl34x
blacklist adxl34x_i2c
blacklist bmp085
blacklist dht11
blacklist fbtft_device
blacklist leds_pwm
blacklist matrix_ads7846
blacklist matrix_gpio_int
blacklist matrix_hcsr04
blacklist matrix_ir_recv
blacklist matrix_pwm
blacklist matrix_rotary_encoder
blacklist pcf8591
blacklist rtc_ds1307
blacklist w1-gpio
blacklist w1-gpio-board



I think that not all hope is lost: For testing purpose, I had already successfully changed and repackaged the initramfs in file /boot/root.img.gz in order to avoid the call to resize2fs, so I can also have a look whether I can find anything that is responsible for the serial console to be activated on every boot and comment it out…

Many thanks so far, I will report back shortly - as time permits - regarding Bluetooth and serial console in initramfs.

Best,
awl

I feel like we should even remove them fully instead of simply disabling them:

Yep agree. I also found these services on the NanoPi M2 image (based on FriendlyARM). I’ll add a patch to remove them during dietpi-update on both M2 and M3 images.

rm /lib/systemd/system/lcd4linux.service
rm /lib/systemd/system/hwservice.service
rm /lib/systemd/system/hwservice_monitor.service
systemctl daemon-reload



WiFi: Yes, Bluetooth: No.

WiFi, excellent.
I’ve added the module (bcmdhd) to the dietpi-set_hardware wifi script. So when wifi is disabled, the module wont be loaded into memory.

Many thanks so far, I will report back shortly - as time permits - regarding Bluetooth and serial console in initramfs.
Excellent, no rush, great work :slight_smile:

Hi again,

There are even more systemd services that must be removed, as they address non-existing devices:

rm /etc/systemd/system/getty.target.wants/serial-getty@ttyAMA0.service
rm /etc/systemd/system/getty.target.wants/serial-getty@ttySAC2.service
rm /etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service



OK, so after two days of digging really deep into the pitfalls of Broadcom Bluetooth device initialisation (the NanoPi-M2/NanoPC-T2 and NanoPi-M3/NanoPC-T3 both use a combination of AP6212/BCM43438), I have good news: I have finally managed to find out how to reliably initialize and attach Bluetooth on the NanoPi/NanoPC devices! :smiley:

For the full nasty details :roll_eyes: , please see my thread over on the FriendlyARM forums: http://www.friendlyarm.com/Forum/viewtopic.php?f=44&p=958#p958 and its file attachment “nanopi_bluetooth_fix.tar.bz2”: http://www.friendlyarm.com/Forum/download/file.php?id=23.

With regards to DietPi for the NanoPi-M3/NanoPC-T3, this means that I will update “my” image soon to include the steps as described in my posting. Please note that you may want to do the same for your image for NanoPi-M2/NanoPC-T2 in order to get a working Bluetooth for this SoC as well.

And finally, regarding serial console: I have now found that it is not initramfs, but the u-boot default environment “bootargs” variable containing a kernel parameter “console=ttySAC0,115200,8n1” that causes a serial console to be created on every boot, and disabling serial console from DietPi to fail.

Unfortunately, I think that there is not much that we can do about this in a DietPi image, as the u-boot environment seems to be stored directly on the device in NVRAM and not on the DietPi SD card. So I think that every NanoPi2/NanoPi3 owner will have to remove this on his own to disable serial console.

Base line:
I would like to rebuild “my” image one more time to include all changes mentioned so far, and to incorporate the new September Debian image by FriendlyARM (my previous DirectPi image was still based on their June Debian image). What would be the best time to do so? Right now, again based on v131, or would you like me to wait for your next release?

Thanks & best regards,
awl

What would be the best time to do so? Right now, again based on v131, or would you like me to wait for your next release?

If you use the master branch (default stable), you can do the image at anytime. DietPi will always update to the latest version on 1st run. So if there are any additional “fixes” we need to add, that can be done easily and before the image is released to the public.

OK, so after two days of digging really deep into the pitfalls of Broadcom Bluetooth device initialisation (the NanoPi-M2/NanoPC-T2 and NanoPi-M3/NanoPC-T3 both use a combination of AP6212/BCM43438), I have good news: I have finally managed to find out how to reliably initialize and attach Bluetooth on the NanoPi/NanoPC devices! > :smiley: >

Great work, although sounds like a nightmare few days lol.

I’ll try your fix with the NanoPi M2, and, the BPi M2+ (has a AP6212 chip).

variable containing a kernel parameter “console=ttySAC0,115200,8n1” that causes a serial console to be created on every boot, and disabling serial console from DietPi to fail.

Yep no worries. If the option isn’t available as a var we can change on the fly, not much we can do about it. If we start having to compile various kernels/uboot just to toggle 1 option, we would dig ourselves into a never ending loop.

Ok, great stuff. I’ll take a look at the bluetooth/wifi fix you made.

Hi again,

unforeseen problems:

I have done so and used the exact same prepping script (especially with regards to the “apt-get purge” commands) on the FriendlyARM September Debian Jessie image that I had previously used on the June image, but at the end of the script, I have much more space still being occupied on the rootfs (nearly 600M) than I had on the June Debian Jessie image (immediately before calling finalise):

root@NanoPi3:~# df -kv
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/mmcblk0p2   3683736 595496   3088240  17% /
udev              434004      0    434004   0% /dev
tmpfs              87236   5244     81992   7% /run
tmpfs             436164      0    436164   0% /dev/shm
tmpfs               5120      0      5120   0% /run/lock
tmpfs             436164      0    436164   0% /sys/fs/cgroup
/dev/mmcblk0p1     64496  21340     43156  34% /boot
tmpfs              87236      4     87232   1% /run/user/1000
tmpfs              87236      0     87236   0% /run/user/0

“apt-get clean”, “apt-get update”, “apt-get upgrade” and “apt-get -y --purge autoremove” report that they won’t change anything…

Can you please look into the attached “dpkg -l” output one more time, and tell me what still needs to be uninstalled?

Thanks a million in advance & best regards
awl
dpkg-l_output.zip (8.73 KB)

600MB, ouch lol.

Overall looks fine. Maybe a few additions that we can remove.

Ok so these can be removed.
But double check deps and if additional items would be removed. If unsure, paste list here:

apt-get purge dconf-gsettings-backend dconf-service libfm-* libsecret-* vim-common vim-tiny

You can check whats using the largest sizes with:

cd /
treesize

Then follow the chain/folders until you find a culprit :slight_smile:

example:

root@DietPi:/# cd /
root@DietPi:/# treesize

du: cannot access ‘./proc/2848/task/2848/fd/3’: No such file or directory
du: cannot access ‘./proc/2848/task/2848/fdinfo/3’: No such file or directory
du: cannot access ‘./proc/2848/fd/4’: No such file or directory
du: cannot access ‘./proc/2848/fdinfo/4’: No such file or directory
1.1 GB .
595.2 MB ./mnt
201.5 MB ./usr
143.5 MB ./lib
106.9 MB ./var
22.3 MB ./boot
7.9 MB ./bin
6.8 MB ./sbin
6.4 MB ./run
4.8 MB ./opt
3.4 MB ./etc
1.2 MB ./DietPi
28.0 KB ./root
16.0 KB ./lost+found
4.0 KB ./srv
0.0 KB ./tmp
0.0 KB ./sys
0.0 KB ./proc
0.0 KB ./dev

root@DietPi:/# cd usr
root@DietPi:/usr# treesize

201.5 MB .
105.5 MB ./share
70.9 MB ./lib
21.7 MB ./bin
3.2 MB ./sbin
184.0 KB ./include
44.0 KB ./local
4.0 KB ./src
4.0 KB ./games

Hi,

well, when we had ~440MB with the FriendlyARM June build, I think that 600MB with the September build would mean that DietPi did not follow its diet plan… :wink:

Fine, but frees only an additional 5MB.

Thanks, sorry - I should clearly have suspected other files/locations than Debian packages at the first place…

Ran “du -k /” and indeed found out about a /usr/nexell tree, about additional unmatching kernel modules for s5p4418 and some other files which did not belong there. I also cleared /var/cache and got back to about the level of the FriendlyARM June image…

So stay tuned - there will be hopefully a new build by the end of tomorrow (Mon)… :wink:

Thanks & best regards
awl

Excellent, great work! :slight_smile:

Hi again,

unfortunately, it looks as if we need an update to dietpi-set_hardware in order to properly support Bluetooth:

Currently, the brcm_patchram_plus service was set to be started on boot, but the way that you have set up things means that with modprobe file “disable_bt.conf” active, the firmware upload to the Broadcom device simply can not happen during boot.

Therefore, it looks to me like the most simple way out of this is to start with brcm_patchram_plus service disabled, and only start and enable the service when “dietpi-set_hardware bluetooth enable” is called, and stop and disable things again when “dietpi-set_hardware bluetooth disable” is called.

Please note that I think I have found a small bug: During disable, you’ll also need to stop and disable the systemd bluetooth service first, and not only/simply force unload “modprobe -rf” the modules… :thinking:

I have attached an updated version of dietpi-set_hardware that seems to do the job for me and would like to ask you to integrate this fix into v134. I will only then create a new build, as otherwise, I cannot make Bluetooth work out-of-the-box.

I have also found out that - specifically for DietPi (not needed for plain Debian or Ubuntu) - I need to remove the dependency of the systemd “brcm_patchram_plus.service” to “syslog.service”, because a systemd service for logging does not seem to exist with DietPi - am I correct?

If you find some time, can you please also check whether (with an updated service file as stated above) my brcm_patchram_plus service does indeed also make Bluetooth work for NanoPi-M2/NanoPC-T2 (and possibly, BPi M2+ as you mentioned)?

Thanks & best regards
awl
dietpi-set_hardware.zip (6.87 KB)