Site Tools


Sidebar

software:switch:fedora_streamlined_inst

Installing Fedora 30

Draft for the more streamlined/automated installation, which no longer requires an existing L4T setup. The packages are not yet published, but you could build your own packages and use them to speed up your Fedora/switch deployments. Not sure about license for distributing such RPMs..

I am installing Fedora for the switch on the microsd card, using a Fedora30 x86_64 as host. I created DOS style partitions on a 32GB card, and partitions. For installing the Fedora30 aarch64 userland for the switch, I used Fedora-Server-30-1.2.aarch64.raw.xz.

This page here shows usage/deployment with the packages. Many other parts could be converted into an Ansible playbook.

microsd card preparations

### remove existing partitions, create new ones.
parted /dev/mmcblk0 -s mklabel msdos
parted /dev/mmcblk0 -s mkpart p fat32 1         999423s
parted /dev/mmcblk0 -s mkpart p ext4  999424s   31250431s
parted /dev/mmcblk0 -s mkpart p ext4  31250432s 61439999s

### preparing the new partition
mkfs.vfat /dev/mmcblk0p1
mkfs.ext4 /dev/mmcblk0p3
mount /dev/mmcblk0p1 /mnt/tmp1
mount /dev/mmcblk0p3 /mnt/tmp3

### deploying the image
xz -d Fedora-Server-30-1.2.aarch64.raw.xz
kpartx -av Fedora-Server-30-1.2.aarch64.raw
vgscan 
vgchange -ay
mount /dev/fedora/root /mnt/tmp
cd /mnt/tmp
tar cfp - *|pv|(cd /mnt/tmp3 && tar xfp -)

### preparations
cd /mnt/tmp3
vi etc/fstab
# only need this: /dev/mmcblk0p3 / ext4 defaults 0 0

# set a root password, for example one from your /etc/shadow
vi etc/shadow
# Use the following as first line, to set root-pw to 'fedora'
root:$6$YT9Fr0TXR26XZwIc$3AahTmO9k48T1dmj.A5y9CSuZpDH2eXTuhrkUjfbW.2AcfqU3EUPI48z5TziTIUw7zONhZ82dwQodtNKJePd2.:17879:0:99999:7:::

echo switch.local >etc/hostname
echo '127.0.0.1   switch.local switch' >>etc/hosts

# disable console on tty1.  We have no input anyway, and can
# see debugmessages that way - via HDMI
mv etc/systemd/system/getty.target.wants/getty@tty1.service root/

### prepare wlan
# I have my wlan already setup on my Fedora30 host system,
# so I can simply copy over the files
cp /etc/sysconfig/network-scripts/keys-mynetwork \
   /etc/sysconfig/network-scripts/ifcfg-mynetwork \
    etc/sysconfig/network-scripts/
    
# future: prepare L4T kernel on /mnt/tmp1
# for now: I provide the L4T kernel via usb, 
# and boot from /dev/mmcblk0p3

cd
umount /mnt/tmp1
umount /mnt/tmp3

# Now we can boot the system from that microSD-card.

finishing setup on booted Fedora

# After the reboot, wlan should work.  Login via ssh into
# root, run dnf upgrade, remove and install packages
dnf remove iscsi-initiator-utils-iscsiuio iscsi-initiator-utils \
  clevis-luks atmel-firmware
dnf install -y langpacks-ja upower screen
dnf update -y

for i in auditd smartd pcscd ModemManager multipathd mdmonitor \
         dmraid-activation initial-setup lvm2-monitor zram-swap \
         plymouth-start lm_sensors udisks2 ; do
    systemctl disable $i
done

### tuning, seen in the L4T scripts
cat >/etc/rc.local<<EOT
#!/usr/bin/bash
echo 2048 > /sys/block/mmcblk0/queue/read_ahead_kb
echo 0 > "/proc/sys/vm/lazy_vfree_pages"
EOT
chmod +x /etc/rc.local
/etc/rc.local
ln -s /etc/rc.local /etc/rc.d/rc.local

### if you want rpmfusion
dnf install -y \
  https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
  https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

Fedora Xorg/LXDM autologin

ssh root@switch

# Install the basic environment.
dnf -y groupinstall 'Basic Desktop' 'LXDE Desktop'

# Install
# - xvkbd, a virtual keyboard.  'florence' is a further option.
# - synergy, so I can use mouse/keyboard of my linux box
# - f29-backgrounds, because they are awesome :)
dnf install -y xvkbd synergy f29-backgrounds-base mplayer

# Now installing drivers and libraries, packaged from L4T
dnf localinstall t1-xorg-0.1-3.aarch64.rpm

# the rpm also places 2 symlinks in 
# /etc/ld.so.conf.d and calls ldconfig.

# special xorg config
cat >/etc/X11/xorg.conf<<EOT
Section "Module"
    Disable     "dri"
    SubSection  "extmod"
        Option  "omit xfree86-dga"
    EndSubSection
EndSection

Section "Device"
    Identifier  "Tegra0"
    Driver      "nvidia"
    # Allow X server to be started even if no display devices are connected.
    Option      "AllowEmptyInitialConfiguration" "true"
    Option      "Rotate" "CW"
EndSection

Section "InputClass"
    Identifier "evdev touchscreen catchall"
    MatchIsTouchscreen "on"
    MatchDevicePath "/dev/input/event*"
    Driver "evdev"
    Option "InvertX" "no"
    Option "InvertY" "no"
    Option "SwapAxes" "no"
    Option "Calibration" "0 1279 0 719"
EndSection

Section "Monitor"
    Identifier "DFP-0"
    Option "Rotate" "left"
EndSection 
EOT

# MYUSER="lxde"
MYUSER="chris"
useradd -m $MYUSER

mkdir -p /home/$MYUSER/.config/lxsession/LXDE
cat >/home/$MYUSER/.config/lxsession/LXDE/autostart<<EOT
@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@synergy-core --client 192.168.0.3
EOT
chown -R $MYUSER /home/$MYUSER/.config

# configure autologin
vi /etc/lxdm/lxdm.conf
# autologin=username  # <- insert the username which you use
# session=/usr/bin/startlxde

# We need to ensure that our user later appears in the 'who' output.
# That is important for the /usr/bin/dock-hotplug script, for
# switching screens.
echo 'sessreg -a -l $DISPLAY -x /etc/X11/xdm/Xservers $USER &' >> \
  /etc/lxdm/PostLogin
echo 'sessreg -d -l $DISPLAY -x /etc/X11/xdm/Xservers $USER &' >> \
  /etc/lxdm/PostLogout

rm -f /etc/systemd/system/display-manager.service
systemctl enable --now lxdm
systemctl set-default graphical.target

Fedora sound

# Now copying drivers from an L4T installation on partition2.
mount /dev/mmcblk0p2 /mnt/tmp2/
cd /mnt/tmp2

dnf install -y alsa-ucm alsa-plugins-pulseaudio alsa-utils \
  pulseaudio pulseaudio-module-x11 pulseaudio-utils pavucontrol

rpm -ivh t1-sound-0.1-1.aarch64.rpm

# ensure that /etc/asound.conf is linked to
# the appropriate file, depending on whether we are docked or not
cat >/etc/udev/rules.d/92-dp-switch.rules<<EOT
SUBSYSTEM!="switch", GOTO="dp_end"
KERNEL!="dp", GOTO="dp_end"
ATTRS{state}=="1", TEST=="/proc/asound/tegrahda", RUN+="/bin/ln -sf /etc/asound.conf.tegrahda /etc/asound.conf"
ATTRS{state}=="1", TEST=="/usr/bin/dock-hotplug", RUN+="/usr/bin/dock-hotplug"
ATTRS{state}=="0", TEST=="/usr/bin/dock-hotplug", RUN+="/usr/bin/dock-hotplug"
ATTRS{state}=="0", TEST=="/proc/asound/tegrasndt210ref", RUN+="/bin/ln -sf /etc/asound.conf.tegrasndt210ref /etc/asound.conf"
LABEL="dp_end"
EOT

# reboot

# for playing via alsa, this has to be active:
alsamixer # I2S1 Mux -> ADMAIF1

# we should now be able to start X, and have sound output:
mplayer <something> 

# When the switch is docked, the screen should switch to HDMI
# output automatically, via profile switch in /usr/bin/dock-hotplug .
# The profile can also be selected via 'pavucontrol' from X.

# also for output testing: 
# speaker-test –channels 2 –rate 48000 –device hw:0,3​
software/switch/fedora_streamlined_inst.txt · Last modified: 2022/11/13 12:06 by 127.0.0.1