FreeBSD Development - bobbybudnick/SFS-Mobile-Internet-Device GitHub Wiki

FreeBSD Software

FreeBSD ZFS Tips
zfs can use whole disk and be bootable solaris-style
this is not as good for specialty configurations
but this is better for quick disk replacement
otherwise it needs a gpt configuration with zfs partition
/////
setup zfs mirror on second drive
step 1 - setup partitions
reformat drive with 2 gpt partitions (boot/zfs)
or
gpart backup ada0 | gpart restore -F ada1
step 2 - setup freebsd-zfs partition as mirror in zfs
zpool attach zroot originaldeviceorpartition newdeviceorpartition
step 3 - setup bootcode
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
or
gpart bootcode -p /boot/gptzfsboot -i 1 ada0

FreeBSD Image Mastering
install ports tree
compile pkg
xorg kf5-frameworks plasma5-plasma kde-baseapps ark vlc mpv kmplayer
falkon otter-browser chromium firefox konqueror sudo bash screen
once packages are installed then setup xorg.conf/setup xinitrc/dbus start
be sure to disable kwin and then relogin

FreeBSD Compile Natively
compile portmaster only - do not install anything from packages
portmaster -K -D -b -g x11-wm/xfce4 (optional -G for no make config)

FreeBSD Cross Compile with Poudriere
tutorial requires precise copy and paste so is made into a file:
https://github.com/bobbybudnick/SFS-Mobile-Internet-Device/releases/download/R17-Extra/POUDRIERE
llvm takes 68 hours to compile on 3 ghz cpu (was using one thread)
webkit2-gtk3 takes 66 hours to compile on 3 ghz cpu (was using one thread)
xfce4 in total takes 146 hours to compile on 3ghz cpu

FreeBSD gpart Tips
gpart show - list disk divisions
disk divisions will be marked with a p for partition with GPT
disk divisions will be marked with a s for slice with MBR
gpart destroy -F nameofdevice - completely wipes drive
gpart create -s GPT nameofdevice - sets up drive
gpart add -t freebsd-zfs nameofdevice - add a zfs slice on whole drive
gpart add -t freebsd-ufs nameofdevice -s 32G - add a ufs slice of 32G

FreeBSD General Tips
kern.cam.boot_delay=10000 for SSD over USB
newfs for format
pkg install to install packages
portsnap fetch to fetch latest ports tree
portsnap extract to extract ports tree
headers after install - git clone --branch releng/10.3 https://git.FreeBSD.org/src.git /usr/src
blacklist module - rename module in /boot/kernel to anything else
load kernel module from folder - specify exact path with kldload
kldstat and kldunload are the other useful kernel module commands

FreeBSD 11 to 12-CURRENT
done with source because there is no binary way
svnlite co https://svn.freebsd.org/base/head
cd head
su root
make buildworld
make buildkernel
make installkernel
make installworld
reboot

FreeBSD SMS Options
modemmanager is not available
gammu can be scripted
gnokii has frontend xgnokii
device web interface may work in some cases
sms over voip will work with a proper client

FreeBSD and KDE Dbus Errors
error: Could not start D-Bus. Can you call qdbus?
must start dbus once before starting kde
dbus can be shutdown once it creates machine-id
/etc/machine-id
/var/db/dbus/machine-id
/var/lib/dbus/machine-id

FreeBSD 10 with Samba
cannot install Samba with packages because it deletes many others
Version 4.7 in ports has build errors
Version 4.4 builds but will not install, with this error:
samba44-4.4.16 conflicts with samba36-libsmbclient-3.6.25_2
pkg delete smbclient wants to remove kde4-runtime
make deinstall reinstall to overwrite has the same conflict error
make
make package
find package at /usr/ports/port_name/work/pkg/
pkg install -f nameofpackage to force overwrite all conflicting files
server cannot access itself with graphical tools but smbclient works
map to guest in config is important for not displaying authentication
[config]
workgroup = WORKGROUP
server string = Samba Server Version %v
netbios name = ExampleMachine
wins support = No
security = user
Map to Guest = Bad User
[MISC]
path = /home/jason/MISC
public = yes
only guest = yes
writable = yes
[/config]

FreeBSD NFS Tips
showmount -e ipofserver
must mount exact path showmount says
linux will mount a looser path but freebsd must be exact
a working internet connection may be required for name server resolution

Simple Upgrade
freebsd-update -r 12.1-RELEASE upgrade
freebsd-update install - several times
sudo pkg update -f
sudo pkg upgrade
use networkmgr for network-manager to give ethernet icon as knemo replacement
pkg autoremove removes old packages
pkg clean removes packages for currently installed software

Udoo x86 Ultra FreeBSD xorg issues
rotation within xorg causes screen to lose signal
scfb starts well but has no rotation capability
modesetting has the strange black screen hang
fbdev driver not available
dbus start/xinitrc/rc.conf/xorg.conf all should be checked
ultimately it looks like there is poor support for rotation with current setup
a package upgrade of xorg was needed for this and to test the intel driver
after the upgrade neither left or right but normal and inverted work
ultimately the device can just be oriented sideways for this application

Boot failure on Lattepanda FreeBSD
Drop to boot loader
Set hint.uart.0.disabled="1"
Set hint.uart.1.disabled="1"
Setup in /boot/device.hints

ZFS mount failure on Lattepanda FreeBSD
Unique disk ids are not used so usb install is da0 and usb target is da1
When installer is removed then da1 becomes da0 but fstab references da1
Recovery can be done without the installer
At failed boot shell - mount -u /
At failed boot shell - zfs mount -a
Edit fstab with vi changing da1 to da0

xorg start failure on Lattepanda FreeBSD
/dev/dri/card0: No such file or directory errors
Install drm-kmod and edit rc.conf to load i915kms

KDE start failure on Lattepanda FreeBSD
Only a black screen with mouse cursor appears
onestart dbus to create /var/lib/dbus/machine-id
Now dbus can be stopped permanently and KDE will start
This used to be the way it works but sadly now dbus must always run

FreeBSD KDE favorites failure
Delete kactivitymanager stuff in config and local
Switch launchers with show alternatives to have changes take effect

FreeBSD KDE failures
Log out glitches mouse/KDE hyper slow/screen flicker worse/USB drive access errors
Disable baloo in /usr/local/etc/xdg/autostart
This was only a workaround and the real problem was low Lattepanda 5v voltage

FreeBSD CPU speed unpredictability
CPU speed jumps around even when set to 480 mhz with sysctl dev.cpu.0.freq
Disable powerd from starting in rc.conf

FreeBSD network monitoring failure with 1366x768
Knemo does not work anymore
Ksysguard shows network but all widgets except netspeed widget do not work
A very roundabout way can be used to show a decent network monitor
Add a spacer in the panel in the position the monitor will go
Add a tab in kysguard with 1 column and 2 rows and add re0 download and upload
Turn off status bar
The tab can be named network
Force position to 975x700
Force size to 125x75 - this will not fully shrink the window yet
Force no titlebar and frame
Force keep above other windows
Force skip taskbar
Cycle between no menubar and menubar with ctrl-m - this should fully shrink the window

FreeBSD network monitoring 2 failure with 1024x600
Same as before but with 125x65 size and 690 x 530 position
No cycling menu on and off tricks this time either
Simply turn menu bar off along with status bar

FreeBSD ethernet trickery failure
Sometimes after a switch goes offline ethernet will get confused
Physically disconnect interface
Bring up interface and set IP manually
Physically reconnect and set gateway if necessary

KDE start failure on AMD Ryzen Pro 2400GE on FreeBSD
gpu-firmware-kmod-somethingsomethingsomething was installed
xf86-video-amdgpu-somethingsomethingsomething was installed
xorg.conf specified modesetting as driver with no busid field
rc.conf specified kld_list="/boot/modules/amdgpu.ko"
xinitrc specified exec ck-launch-session startplasma-x11


FreeBSD Hardware

New Device Assembly
barrel connector is center positive
it was best to mount board and screen hole to hole
most sturdy and leaves connector room
thus the only battery practical was 12v 4200mah
zfs mirror with micro sd and emmc works fine
onboard analog audio out works fine

Power Usage
with udoo x86 ultra
.7a at 12v with screen on cellular device on
.4a at 12v with screen on cellular on device asleep
.2a with screen backlight off cellular on device asleep
.8a at 12v with screen backlight off cellular on device on
sleep seems to work with sudo zzz
onboard usb does not seem to power down
attached 3 port hub does power down
turns back on with power button with no ill effects
much more power could be saved with switches for screen and cellular
there may be reliability problems with going to sleep from xorg

New Screen Testing
all issues with 5" screen
720p readability - improved with 7"
power usage while running - not improved with 7"
signal off power usage - not improved with 7"
signal off behavior - improved with 7"
uncertainty about screen tuning - improved with 7"

New Screen Development
7" does not turn off when not receiving a signal
it does not turn on and off like terrible 5" behavior
wire a power switch for screen - not ideal with 2 switches
make backlight switch more accessible - not ideal with 2 switches
see if bios can power down usb when sleeping - does not seem like it
use a hub for screen which goes off at sleep like 3 port - no room
backlight off does not require as much work/space/needs testing anyway

New Screen Thoughts
the larger 7" screen makes business work extremely easier
devices with 5" screen should probably be considered obsolete
such is the march of time
if 5" devices are not carried regularly anyway they are of less value
the 5" screen is not ideal for gaming in addition to other negatives
the 5" screen is not ideal for showing off mid devices

Bluetooth
seems like a lost cause and waste of time with this os
hciconfig not installed and bluedevil not compatible and no bluetooth in dmesg
small keyboard/mouse and 2.4 ghz wireless dongle can replace microphone

On the Lack of USB Power Switches
as mentioned even udoo x86 ultra cannot power down usb while asleep
currently the device does not employ usb power switches
this is not good as it means that while asleep it is not saving the most power
ideally need to go back to usb power switches of some kind
the screen does not use that much power so maybe a hub solution would work
with that said this device is not very portable anyway
also startup and shutdown is pretty fast
there seems like little use for sleep mode with this device
thus the very arduous task of making switching gear can be avoided for now