Tuesday, May 14, 2024

Slackware64 in a Raspberry Pi 3 Model B

Slackware also provides a version for ARM processors. The installation depends on the ARM implementation and system you are using. Here I'm installing Slackware on an RP3B, to use it as a file server (NFS) and a media server over DLNA.

My main source of information is from Sarpi, this post is just a summary of their "How to ...". 

Installation

First, download:

- Installer image: sarpi3_64-installer_slackcurrent_03May24_sp1.img.xz

- Slackware: rsync -Pravv --delete slackware.uk::slackwarearm/slackwareaarch64-current .

Then, a micro SD card is used to boot the RP and start the Slackware installer. The Slackware root directory (installation files) is stored in a USB stick. 

- Write the installer image to a micro SD card.

- Write the Slackware files to a USB stick.

Alternatively, if you have used the micro SD card to boot the RP before, you can just copy the boot files from the image and delete the old files in your micro SD. This is handy if you are reinstalling Slackware over the same system.

Slackware will be installed in the same micro SD card used to boot the installer. Then, we need to create the partitions to hold the system. That is the boot, swap and root. The boot partition was already created when writing the installer, so you only need to make the other two.

To enable the network interface from the boot and start an SSH server, edit the file 'cmdline.txt' appending the following:

kbd=de nic=e1000:eth0:static:192.168.2.7:24:192.168.2.254

I used a static IP address because my router is slow in assigning it dynamically. So slow that the installer cancels the SSH server start before getting an IP.

When connecting to the installer via SSH, it is common to get the message "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!" and the connection is closed. To avoid that, delete the keys for that IP from your ~/.ssh/known_hosts file.

Connect to the RP's SSH server: ssh root@192.168.2.7

# setup

After installation, don't reboot immediately.

At this point, the future root tree of Slackware is mounted in /mnt. So, if for some reason you reboot the RP and the installer boots up again (ups...), you have to mount, manually, the partition containing / (/dev/mmcblk0p3 for example) in /mnt. By doing so, you can continue with the configuration.

Now, remove some unnecessary packages:

# ROOT=/mnt removepkg kernel_armv8 kernel-*-armv8

Next, remove the initramfs file from the boot partition. Mount the boot partition in /mnt/boot and then:

#  rm /mnt/boot/initramfs.xz

Install some extra RP exclusive packages:

# ROOT=/mnt installpkg /rpi-extra/kernel* /rpi-extra/sarpi*

Now you can update your config files.

And finally, reboot the system.




References: 

https://sarpi.penthux.net

https://alien.slackbook.org/blog/remote-installation-of-slackware-using-ssh/

MSP430 development in Linux

There are a couple of options for programming an MSP430 microcontroller in Linux without having to buy a license. By programming I mean the minimum steps you need to do when developing with microcontrollers, these are:

  • Writing the code
  • Compile
  • Flashing
  • Debug

For each task you need specific tools compatible with the microcontroller you are using. 



Writing the code

Although seems obvious, you need a text editor to write your code. A simple text editor will do the job, but a special IDE can make your life easier and will help you to code precise and faster. Pure IDEs for you to choose from are Eclipse or Kdevelop, for example. Usually, you need to install an additional plugin for the architecture you are working with. Another option is to use a complete IDE which includes the complete toolchain in one place, this is the easier and safer option. These are discussed in the next section.



Compile

Here I'm grouping compiling and linking, of course. As far as I know, for the MSP430 you have three free options:

  • Energia
  • Code Composer Studio (CCStudio)
  • GCC - Open Source Compiler for MSP Microcontrollers

In short, Energia is oriented to Arduino users, it has its own set of functions to simplify common tasks at the expense of flexibility and low-level control. It seems a good option for quick and dirty projects. CCStudio is the official IDE from TI. The offline version is based on Eclipse and they also provide an online IDE with similar capabilities. To use the online version, you need to install a plugin in your browser to provide access to your development platform. The offline version is probably the best and safer option you can take but also take into account that it depends on 32 bits libraries. So, if you use a pure 64 bits distribution you will have to find a way to install the libraries or skip this IDE. In my case, I use Slackware64 without the compat32 packages from AlienBob because I don't need software that requires 32bit compatibility, then I took the third option from the list.


The GCC Compiler for MSP Microcontrollers is free and open source. It doesn't provide a text editor, so you have to find one which fits your preference. 



Flashing

Aside the flashing tools provided by the IDE there are a couple of way to load your bits to the microcontroller memory. 


...


Debug

A simplest way to debug your code is to use the peripherals of the micro to send signals and messages, but using a real time debugger provides quick access to memory and registers and allows you to dig deeper into the code to find that elusive exception. Energia and CCStudio have their own debugger embedded in the  IDE. 



Workaround:

The precompiled version of GCC-MSP430 is linked to the libtinfo.so.5 but Slackware64 is using libtinfo.so.6. Compiling the GCC-MSP430 will solve the conflict, but you have to install gdb_agent_console by yourself. The quick and dirty solution is to create a link in /lib64/ to libtinfo.so.6 with the name libtinfo.so.5.


MSPFlasher shows the error "error while loading shared libraries: libmsp430.so: cannot open shared object file: No such file or directory". The error is solved copying the file libmsp430.so in the root of the MSPFlasher installation directory to /usr/lib64/. Creating a link to the file is not sufficient, you need to copy the file. 




 References: 
1. https://43oh.com/2010/11/a-step-by-step-guide-msp430-programming-under-linux/

Basic Git workflow

 Initial situation

You have code in a folder and now you want to uploaded it to a Git repository.

I. Git configuration

$ git config --global user.name UserName
$ git config --global user.email email@example.com

II. Create the local Git repository

$ cd ~/Project01
$ git init
$ touch .gitignore

Write in .gitignore the filenames not to control. For example:

# Compiled source #
######################
*.map
*.o
*.out

will ignore any file with extension .map, .o and .out from the commit.

$ git add .
git status
$ git commit -m "Initial commit"

Sunday, October 21, 2018

Office 365 and Wine

from: https://appdb.winehq.org/objectManager.php?sClass=version&iId=35527


Minimum software requirements:
sudo pacman -Sy wine wine-mono wine_gecko winetricks samba smbclient libwbclient
sudo pacman -Sy alsa-lib alsa-plugins gnutls libpng libpulse libglvnd libxcomposite libxinerama libxml2
sudo pacman -Sy lib32-alsa-lib lib32-alsa-plugins lib32-gnutls lib32-libpng lib32-libpulse lib32-libglvnd lib32-libxcomposite lib32-libxinerama lib32-libxml2
Additional nice-to-have software (to get rid of other warning/errors which do not/may not directly impact the usability of Office 365):
sudo pacman -Sy gconf gst-plugins-base gst-plugins-base-libs gst-plugins-good gstreamer lcms2 libcanberra libcanberra-pulse libva libva-intel-driver libva-vdpau-driver libvdpau libx11 libxmu libxrandr libxslt libxss libxt libxtst libxv mesa mesa-vdpau mpg123 p11-kit vulkan-intel
sudo pacman -Sy lib32-gconf lib32-gst-plugins-base lib32-gst-plugins-base-libs lib32-gst-plugins-good lib32-gstreamer lib32-lcms2 lib32-libcanberra lib32-libcanberra-pulse lib32-libva lib32-libva-intel-driver lib32-libva-vdpau-driver lib32-libvdpau lib32-libx11 lib32-libxmu lib32-libxrandr lib32-libxslt lib32-libxss lib32-libxt lib32-libxtst lib32-libxv lib32-mesa lib32-mesa-vdpau lib32-mpg123 lib32-p11-kit lib32-vulkan-intel
Installation Instructions:
1. Create a 32bit Wine Prefix
export WINEARCH=win32
export WINEPREFIX=~/.msoffice
wineboot -i
2. Change the Wine Windows version to Windows 7
winetricks winecfg
3a. Install fonts
winetricks corefonts
3b. Or if you have Windows fonts installed in Linux, you can also try to symlink them
cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; done
4. Install DLLs/components
winetricks dotnet20 gdiplus msxml6 riched20
5. Set the library overrides
winetricks winecfg
gdiplus (native)
msxml6 (native,builtin)
riched20 (native,builtin)
6. Ensure the Wine Windows version is still Windows 7
winetricks winecfg
7. Install Office 365 Pro Plus 32-bit
wine ~/Downloads/Setup.X86.en-us_O365ProPlusRetail_********-****-****-****-************_TX_PR_b_32_.exe
8. Once complete, you will see a taskbar notification indicating the setup is complete, but it installer will not automatically exit. You can close the installer at this point.
9. Copy missing DLLs (AppvIsvSubsystems32 & C2R32)
cp -iv "${WINEPREFIX:-~/.wine}/drive_c/Program Files/Common Files/Microsoft Shared/ClickToRun/AppvIsvSubsystems32.dll" "${WINEPREFIX:-~/.wine}/drive_c/Program Files/Microsoft Office/root/Office16/AppvIsvSubsystems32.dll"
cp -iv "${WINEPREFIX:-~/.wine}/drive_c/Program Files/Common Files/Microsoft Shared/ClickToRun/C2R32.dll" "${WINEPREFIX:-~/.wine}/drive_c/Program Files/Microsoft Office/root/Office16/C2R32.dll"
9. Run an Office 365 program like Access, Excel, Powerpoint, Publisher or Word
Registry workarounds for black screen/graphic issues (All may not be needed. Try combinations. I only needed workaround 1.):
1. Limiting maximum Direct2D factory version:
[HKEY_CURRENT_USER\Software\Wine\Direct2D]
"max_version_factory"=dword:00000000
2. Enabling Direct3D CSMT:
[HKEY_CURRENT_USER\Software\Wine\Direct3D]
"csmt"=dword:00000001
3. Forcing a higher OpenGL version 3.2:
[HKEY_CURRENT_USER\Software\Wine\Direct3D]
"MaxVersionGL"=dword:00030002
Possible registry workaround for font readability issues (if needed):
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]
"ClientSideWithRender"="N"
Prevent wine from creating any file associations:
1. For a single Wine Prefix
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices]
"winemenubuilder"="C:\\windows\\system32\\winemenubuilder.exe -r"
2. Using an environment variable (across multiple Wine Prefixes)
export WINEDLLOVERRIDES="winemenubuilder.exe=d"

Saturday, September 29, 2018

Bluetooth headphones in OSMC

Check this first: https://www.instructables.com/id/Enhance-your-Raspberry-Pi-media-center-with-Blueto/

---
Then this: https://wiki.debian.org/BluetoothUser

---
apt update Bluetooth
apt dist-upgrade
apt install a2dp-app-osmc
add hdmi_ignore_edid_audio=1 to config.txt
apt install alsa-utils
connect with headphones without pin
choose audio output in kodi setting: ALSA
pactl list
pactl set-card-profile bluez_card.A3_E5_xx_xx_xx a2dp_sink
reboot
Now it works. I only have to switch manually from HDMI to ALSA. But that is no big deal.

from: https://discourse.osmc.tv/t/connecting-bluetooth-headphones-to-osmc/20478/34

---
0 alsa_card.platform-soc_audio module-alsa-card.c
osmc@osmc:~$ pactl list cards short
0 alsa_card.platform-soc_audio module-alsa-card.c
1 bluez_card.00_23_01_0A_14_5C module-bluez5-device.c
osmc@osmc:~$ pactl set-card-profile 1 a2dp_sink
osmc@osmc:~$

from: https://discourse.osmc.tv/t/problem-with-bluetooth-headphones/73666/50




Saturday, March 24, 2018

NFS share in OSMC

To configure a NFS server to share a folder.

1. Fix the IP address to a static one. This can be done directly in the network menu of the 'My OSMC' application. The configuration is stored in the file: /var/lib/connman/[interface]/settings

2. Create a mount point in /mnt for the directory from a USB drive. 
$ sudo mkdir ./TheBlackHole

$ sudo chmod 777 ./TheBlackHole

3. Mount the drive at the boot time. Edit fstab file adding the following line.
LABEL=TheBlackHole      /mnt/TheBlackHole       ext4    defaults,users,exec     0       0

4. Download server: sudo apt-get install nfs-kernel-server portmap

5. Edit the /etc/exports file adding the following line:
/mnt/TheBlackHole        192.168.1.0/255.255.255.0(rw,sync,no_root_squash,no_subtree_check)


Saturday, March 03, 2018

Working with MIDI in Slackware

If you want to play MIDI files in Slackware you do need to install special software (synth, mixer, sequencer, etc.). There is a great page where it is explained clearly how to set up a basic environment in order to start working whit MIDI in Linux. All the software mentioned in that webpage is available for Slackware in Slackbuilds.org. Instead of copy-paste what is already clearly explained in the mentioned site, here, I highlight the differences I have observed.

Basically, the MIDI instructions are generated by reading a midi file, by a virtual instrument or by a hardware MIDI controller (as a keyboard), then the synth interprete the instructions a convert them into a sound signal. Several signals can be mixed (Jack), decoded and put in the speakers. 

1. I had by default a low latency kernel and a audio group in my Slackware box. 
2. I don't know how to modify the group limits, but I have realised that it is not strictly necessary. IT is possible to follow the procedure skipping this configuration and using the option -r when you run jackd (jackd -r ...), you will see a warning message. In my case, the performance is ok for what I want to do.
3. Considering that, at the end, you want to be able to use a MIDI sequencer (Rosegarden in this case). You will need to install the following set of software.
- Rosegarden : Sequencer
- liblo, liblrdf, dssi, lilypond : Rosegarden dependencies
- jack-audio-connection-kit, lirc, perl-xml-twig : Optional Rosegarden dependencies.
- fluidsynth : Softsynth
- fluid-soundfont : Base sound samples
- vmpk : Virtual piano keyboard. Used for testing purposes.
- qjackctl : GUI front end to configure Jack
- Qsynth : GUI front end to configure Fluidsynth.

4. Strictly, you don't need to use Jack to use MIDI, but it is recommended if you want to do more than very basic thinks. You do need Alsa and fluidsynth.

5. It is important to remark that Slackware is currently using Pulseaudio as sound engine. When Jack is running, Pulseaudio is shouted down.

Wednesday, January 24, 2018

OSMC in Raspberry Pi 3

To install OSMC in Raspberry Pi 3:

1. Download the image to install from the OSMC website. You need to choose the image for Raspberry Pi 2 / 3.

2. Unpack the image from the downloaded file:
gzip -d OSMC_TGT_rbp2_20180109.img.gz

4. Write the image into the SD card:
dd if=OSMC_TGT_rbp2_20180109.img of=/dev/sdb     

5. Insert the SD card in the Raspberry Pi and power it on. The installation should start automatically.

Thursday, July 27, 2017

Slackware 14.2

Slackware 14.2 was released two days ago and, although I'm running an updated -current version, I want to use this milestone to do a complete new, fresh and clean installation. But with some customisation of course. This first post is only to organise the installation and system configuration.

There are two major tuning I want to do. First is installing multilib capabilities, which I need mainly to run Skype and Wine, and second to change KDE 4.x with Plasma 5. I'm using the Plasma 5 packages made by AlienBob for a wile and I could say that it works pretty ok. There are still some small details still laying around but the performance is most than acceptable and I like the new look of Plasma 5

Another change I want to do this time is to move Slackware to Unicode UTF-8. This is not something that I really need, but I just want to try it.

There are a couple of thinks to which I want to set special care. One is a problem I have already with the Suspend to Ram feature. I have not spent so much time in this, but now is time to solve it. Second is the HDMI port sound. Now I have to change manually the sound device output to the HDMI port, otherwise, the sound still remains flowing by the computer speakers. I guess I need to recheck this because Slackware 14.2 adds Pulseaudio, and I guess that could change a bit the sound cards configuration.

[Update] I had to change my laptop and now I have one with a Kaby Lake Intel processor (Asus UX330U). This detail did a big difference in Slackware, the current kernel version used in Slackware64 14.2 and -current (4.4.x) are not compatible with this microarchitecture. Although the computer was able to boot, Xorg failed, showing the error message "(EE) no screens found (EE)". The problem was discussed in the Slackware forum, where I was suggested to upgrade the kernel to one above 4.5. After building the 4.8.10 version, the problem was solved. I have added a new item in the list below considering this additional step in the Slackware 14.2 setting up.

Details for the step by step process, problems solving and comments are in another posts:

- Booting the Slackware installer from a USB drive in UEFI mode.
- Packages selection and extra software.
Keyboard configuration.
Internationalisation.
- Kernel upgrade.
Elilo configuration.
- Fine tuning.
- Adding Plasma 5.
- Adding Mutilib.
- Setting Hidpi.
- Bluetooth configuration.
- Sound configuration.
- Installing Wine and MS Office 2010. (What is the devil doing here!??)