commit | 9008ef82fc6509b8144fdb3f655a0d78b89f26cd | [log] [tgz] |
---|---|---|
author | Jan Kundrát <jan.kundrat@cesnet.cz> | Wed Oct 23 00:35:05 2024 +0200 |
committer | Jan Kundrát <jan.kundrat@cesnet.cz> | Wed Oct 23 01:07:25 2024 +0200 |
tree | db759d22f4f6fb7c2026fe14f757f38ec0f483c2 | |
parent | 72df60760452e0ca3b9495b104ae2e20a3f60e7d [diff] |
clearfog: build a preemptible kernel ...because I really want to cut these 200ms+ latencies (as reported by `rtla timerlat`) down a *lot*, and because the description of this config option sounds like something that I absolutely want to have. Also, it's one step before going the full PREEMPT_RT route. On a box where the I2C-2 bus (the bit-banged one) is locked up, I used to see latencies of about 200ms -- that was prior to the recent optimizations of I2C retries in [1] and [2]. With these two patches, it went down to about 80ms. With this one, I'm at less than 0.5ms, and that's with a running `perf`. (The other difference is that the cla-sysrepod is not crashing with UART RX FIFO overruns. This is the desired outcome, but it "might" affect the performance measurements because there are no extra instances of the systemd-coredump@.service, which means that there are fewer updates to the ietf-alarms' operational DS, etc. Did I mention that this is a moving target where everything affects everything else?) [1] https://gerrit.cesnet.cz/c/CzechLight/br2-external/+/7879 [2] https://gerrit.cesnet.cz/c/CzechLight/velia/+/7884 Change-Id: I72b2857288dcf370d03161a8a58985893f17c4d6
This repository contains CzechLight-specific bits for Buildroot. Buildroot is a tool which produces system images for flashing to embedded devices. They have a nice documentation which explains everything that one might need.
The system architecture is described in another document. This is a quick build HOWTO.
Everything is in Gerrit. One should not need to clone anything from anywhere else. The build will download source tarballs of various open source components, though.
By default, each change of this repo uploaded to Gerrit causes the CI system to produce a firmware update. On Gerrit, the change will get a comment from Zuul with a link to the CI log server. Next to the logs, a file named artifacts/update.raucb
can be used for updating devices.
Behind the scenes, the system uses Zuul with a configuration tracked in git.
Here's how to reproduce the build on a developer's workstation:
git clone ssh://$YOUR_LOGIN@cesnet.cz@gerrit.cesnet.cz:29418/CzechLight/br2-external czechlight pushd czechlight git submodule update --init --recursive popd mkdir build-clearfog cd build-clearfog ../czechlight/dev-setup-git.sh make czechlight_clearfog_defconfig make -j8
A full rebuild takes about half an hour on a modern laptop.
WARNING: Buildroot is fragile. It is not safe to perform incremental builds after changing an "important" setting. Please check their manual for details.
Apart from the traditional way of re-flashing the SD card or the eMMC from scratch, it's also possible to use RAUC to update. This method preserves the U-Boot version and the U-Boot's environment. Apart from that, everything starting with the kernel and the DTB file and including the root FS is updated. Configuration stored in /cfg
is brought along and preserved as well.
To install an update:
# build node make rsync -avP images/update.raucb somewhere.example.org:path/to/web/root # target, perhaps via an USB console or over SSH rauc install http://somewhere.example.org/update.raucb reboot
Once the updated FW slot boots, the configuration in /cfg
will be automatically upgraded ("migrated") to the newest layout. A downgrade to an incompatible OS version might therefore fail during the next reboot. Completely removing all data in the newly updated slot's cfg
partition will restore functionality, but it is effectively a factory reset.
On a regular Clearfog Base with an eMMC, one has to bootstrap the device first. If recovering a totally bricked board (or one that is fresh from factory), use the kwboot
command to upload the initial, new enough U-Boot via the console. Power the system down, and ensure that the jumpers are set to 0 1 0 0 1
(default for eMMC boot is 0 0 1 1 1
):
Prepare a USB flash disk with a raw bootable image, images/usb-flash.img
. Use a tool such as dd
to overwrite the raw block device, do not copy the image file. Plug the USB flash disk in. Then, use U-Boot's kwboot
tool:
./host/bin/kwboot -b ./u-boot-spl.kwb -t -p /dev/ttyUSB0
...and turn the power on. Once in U-Boot, execute:
usb start; fatload usb 0:1 00800000 boot.scr; source 00800000
The system will boot and flash the eMMC from the USB drive. Once the status LED starts blinking in yellow, data are being transferred to the eMMC. The light changes to solid yellow in later phases of the flashing process. Once everything is done, the status LED shows a solid white light and the system reboots automatically.
Turn off power, remove the USB flash, re-jumper the board (0 0 1 1 1
), power-cycle, and configure MAC addresses at the U-Boot prompt. The MAC addresses are found on the label at the front panel.
=> setenv eth1addr 00:11:17:01:XX:XX => setenv eth2addr 00:11:17:01:XX:YY => setenv eth3addr 00:11:17:01:XX:ZZ
Also set up the system type:
Model | czechlight variable value |
---|---|
ROADM Line Degree | sdn-roadm-line-g2 |
ROADM Flex Add/Drop | sdn-roadm-add-drop-g2 |
ROADM Hi-Res Add/Drop | sdn-roadm-hires-add-drop-g2 |
ROADM Coherent Add/Drop | sdn-roadm-coherent-a-d-g2 |
Inline Amplifier | sdn-inline-g2 |
BiDi Amplifier C-Band + 1572nm | sdn-bidi-cplus1572-g2 |
BiDi Amplifier C-Band + 1572nm with OCM | sdn-bidi-cplus1572-ocm-g2 |
=> setenv czechlight sdn-roadm-line-g2 => saveenv Saving Environment to MMC... Writing to redundant MMC(0)... OK => boot
Once the system boots (which currently requires a reboot for some unknown reason -- fsck, perhaps?), configure hostname, plug in the network cable, and update SW:
# hostnamectl set-hostname line-XYZSERIALNO # cp /etc/hostname /cfg/etc/ # rauc install http://somewhere.example.org/update.raucb # reboot
Obtain a reasonable Linux distro image for BBB and flash it to a µSD card. Unlock eMMC boot partitions (echo 0 > /sys/class/block/mmcblk1boot0/force_ro; echo 0 > /sys/class/block/mmcblk1boot1/force_ro
). Clean the eMMC data (blkdiscard /dev/mmcblk1
). Flash the content of images/emmc.img
to device's /dev/mmcblk1
. Flash what fits into /dev/mmcblk1boot0
and /dev/mmcblk1boot1
. Fetching the image over web (python3 -m http.server
and wget http://...:8000/emmc.img -O - | dd of=/dev/mmcblk1 conv=sparse
) works well.