July 3, 2020

Install TC/BSD Beta

FreeBSD instead of Linux. It was already known last year, and it was possible to try but not buy. So, it is good time to cook some slices, which from the last 2019 is not so fresh, but as is.



News


PC-Control, April 2019, pg. 7: "Automation highlights: TwinCAT, beating heart of the system Beckhoff is lifting the wraps on an important innovation in the automation segment: TwinCAT will now, for the first time, also be available on an operating system other than Windows. "TwinCAT/BSD runs on FreeBSD, an established, exceptionally robust and advanced open source OS that can trace its roots all the way back to the 1980s," says the managing director. It can also run a large number of Linux programs. However, TwinCAT/BSD is not subject to Linux GPL licensing terms. From the company's perspective, BSD licensing allows the automation software to be distributed to vendors and users in the industry’s usual manner because there is no requirement to release the software’s source code."


Youtube, 10 February 2020: "TwinCAT/BSD combines the TwinCAT 3 runtime XAR with FreeBSD, an industrially tested and reliable open source operating system. TwinCAT/BSD supports all TC3 functions and additionally enables the use of the modern HTML5-based TwinCAT HMI.".



Now


Accessories → CX2900-0026: 20 GB CFast card, 3D flash, extended temperature range (only for Windows CE or TwinCAT/BSD operating systems)
TwinCAT/BSD: Operating System for IPC Features, estimated market release 2nd quarter 2020.

There was enough rumors. And I decided to try beta.


Jack in The Box


Make a physical USB flash drive using .iso image and Etcher (this is an official recommendation). Plug the USB flash drive into the laptop.

cd %programfiles%\oracle\virtualbox

Find out what drive number is assigned to the flash drive. Only a number is needed. Replace the `#` symbol in \\.\PhysicalDrive# with that number.

VBoxManage internalcommands createrawvmdk -filename "%USERPROFILE%\.VirtualBox\usb.vmdk" -rawdisk \\.\PhysicalDrive1

You will get an image-link to the flash drive. Do not remove the flash drive, leave it plugged in during all the operations followed below. (!) Launch VirtualBox as Administrator.

For the virtual machine, disconnect all disks and add one IDE controller Master disk with a link to `usb.vmdk`, created earlier. And one SATA disk (at least 16 GB size, dynamically expandable type is acceptable).

Remember the size of the SATA disk (or make it different of the size of the flash drive). This will help you to distinguish it later from the flash drive when you will be installing BSD. Let suppose that flash drive is 8GB drive size, and the SATA drive is 10GB or 20GB.



Disable booting from all sources. System → Boot Order have to be empty and all options switched off. In the virtual machine, enable support of the EFI: System → Enable EFI.

Boot from the USB flash drive.



Install OS to the SATA drive (see picture above). Disable Virtual Box and remove the IDE controller along with a link to the vmdk-image of a flash drive. Turn on the virtual machine then boot.

login: Administrator
passwd: 1


Command Line and Hotkeys

  • Scroll Lock on/off vertical scroll. Vertical scroll by PgUp/PgDown.
  • Alt+F1..F13 — switch current terminal.
  • dmesg — boot devices.
  • `#` at the start of the line means root privileges. Ex.: doas ps -a
  • `%` at the start of the line means plain user.
  • Easy text editor EasyEditor. Starts with `ee` from command line. Ex.: # ee <filename.ext>


Another Packets

`doas` before commands is for root privileges. Like a `sudo` in Linux.
Repository list currently available by # pkg -vv (with double `vv` on the tail).
Official packets are in the /etc/pkg/Train.conf, but it contains necessary packets only.
To append additional packets: # cp /etc/pkg/FreeBSD.conf /usr/local/etc/pkg/repos/FreeBSD.conf
If you remove /etc/pkg/Train.conf then, the official repository becomes unavailable.



Guest Additions VirtualBox



# pkg install emulators/virtualbox-ose-additions
# pw groupmod wheel -m Administrator — clipboard and etc GUI stuff.
# ee /etc/rc.conf — when a simple text editor opens, append the following lines to the end of the file:

vboxguest_enable="YES"
vboxservice_enable="YES"



To close the editor press Escape → a → a. Escape works slowly, do not rush.
Finally, reboot: doas reboot


Midnight Commander


Two-panels file manager, like Norton/Total Commander but from *nix world.

Installation: # pkg install mc
Command line: mc


XFCE4


The simplest installation description. The man ate shit on the forums then reduced everything to a simple list of actions. Thank you man!
Graphics drivers AMD-Intel-Noname: # pkg install drm-kmod

but (!)

Graphics drivers for VirtualBox: # pkg install emulators/virtualbox-ose-kmod

doas ee /etc/rc.conf
append next lines
kld_list="/boot/modules/i915kms.ko" — Intel adapters.
kld_list="/boot/modules/vboxdrv.ko" — vbox virtual graphics adapter.
dbus_enable="YES"

Reboot: doas reboot

# pkg install xorg
# pkg install xfce

If the installation was interrupted by any reason, just repeat the commands and installation continues from the interrupted part.
Start from command line: startxfce4


Shared Folders


In the virtual machine settings configure a directory for sharing files between the host and the guest.
Under the xfce4 start a terminal session. Enter next:

# mount_vboxvfs -w myshare /mnt, where

myshare — share name (not a folder path!);
/mnt — target path to mount to. Folder have to be already present. 

Share name (here is `myshare`) should be defined when you setup virtual machine Shared Folder → Add Share → Mount point.
Now you are ready to move files between Windows and Tc/BSD and back again. 



Git


# pkg install git


.NET Core 3


.Net-Core-3.0.0-for-FreeBSD — download all of you needed.


Necessary Packets


# pkg install libunwind lttng-ust icu curl openssl111 bash git llvm60 cmake krb5
# ln -s /usr/local/bin/bash /bin/bash


.NET Core 3.0.0 prebuilt SDK


Download dotnet-sdk-3.0.100-freebsd-x64.tar.gz then copy to the virtual machine through the shared folder. Extract into the ~/dotnet-sdk

mkdir ~/dotnet-sdk
tar xf dotnet-sdk-3.0.100-freebsd-x64.tar.gz -C ~/dotnet-sdk


Essential .Net NuGet Base Packages


Download dotnet_pkgs-3.0.0-freebsd.tar. then copy to the virtual machine through the shared folder. Extract into the ~/dotnet_pkgs

mkdir ~/dotnet_pkgs
tar xf dotnet_pkgs-3.0.0-freebsd.tar -C ~/dotnet_pkgs


NuGet


Create or edit if existed settings file ~/.nuget/NuGet/NuGet.Config. Then append

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>     <add key="local_pkgs" value="/home/Administrator/dotnet_pkgs" />     <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>

`Administrator` have to be replaced with the name of the current user. You can stay it unchangeable if you are the Administrator (not a `root`, but your name is `Administrator`).


Failed to initialize CoreCLR, HRESULT: 0x8007001F


Issue described there: linux-dotnet-cli

# ee /etc/sysctl.conf

Append line: vm.max_wired=1333000
Or you can try to execute next command from the command line: # sysctl vm.max_wired=1333000


Testing

mkdir ~/testapp
cd ~/testapp
~/dotnet-sdk/dotnet new console -o myApp
cd myApp
~/dotnet-sdk/dotnet run


Disk Image



List of the disk drives: # camcontrol devlist. We are going to use `ada0` and `da0`, or select what you want. 

For example:
# camcontrol devlist
    <VBOX HARDDISK 1.0>   at scbus0 target 0 lun 0 (ada0,pass0)
    <VBOX CD-ROM 1.0>     at scbus1 target 0 lun 0 (pass1,cd0)
  
Switch on shared folder (see above `Shared Folders`).
Start the duplicator `dd`: # dd if=/dev/da0 of=/mnt/cfdisk-image-backup.dd bs=128K conv=noerror,sync status=progress

Finnaly, please wait... it will take some time...


Putty


If error: SSH Shell fail - Couldn't agree a key exchange algorithm.
Should update Putty. No errors in version 0.73.


VNC


TightVnc# pkg install net/tightvnc
Freeware client under the Windows — VncViewer
...

3 comments

  1. Where can the image be downloaded to install?

    ReplyDelete
    Replies
    1. Some of the Beckhoff customers have got the beta version. Should try to ask local Beckhoff support.

      Delete
  2. Tried this, but got an error related to loading the kernel. I can see TcBSD is being booted from the USB stick but after install procedure and a reboot, the kernel fails to load. Any ideas of what the reason for this?

    ReplyDelete

Note: Only a member of this blog may post a comment.