<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>segments: Yifei Zhan's blog</title>
    <link>https://segments.zhan.science/</link>
    <description>Recent content on Yifei Zhan's blog</description>
    <generator>vim, hugo, and OpenBSD httpd</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 18 Apr 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://segments.zhan.science/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>CommBank hardware MFA token</title>
      <link>https://segments.zhan.science/posts/physical-netcode-token/</link>
      <pubDate>Sat, 18 Apr 2026 00:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/physical-netcode-token/</guid>
      <description>&lt;p&gt;A while ago, CommBank started asking for MFA confirmation on its mobile app for every NetBank login on a browser. Previously, there was an option to use SMS for MFA, which isn&amp;rsquo;t as secure as I would like, but it was at least usable. Since I&amp;rsquo;m switching away from Android to Mobian and won&amp;rsquo;t be able to use the CommBank app for much longer, I applied for a physical NetCode token.&lt;/p&gt;
&lt;p&gt;The hardware is made by Digipass and looks disposable. It is a small, battery powered gadget with a screen and a button. When pressed, it shows a temporary NetCode for authentication. Such a NetCode is required both for NetBank logins and approving online transactions.&lt;/p&gt;
&lt;p&gt;The letter that came with it has the wrong link for activation, the correct link is under NetBank -&amp;gt; Settings -&amp;gt; NetCode (under the Security section)&lt;/p&gt;
&lt;p&gt;To apply for a physical token, call the NetBank team, mention you can&amp;rsquo;t use the app and need a physical NetCode token, and make sure they actually submit your request for a token. It took me 2 calls to get them to ship me a token. The hardware is free of charge but can only be applied for via phone call; unfortunately staff members at my local branch are unable to do anything in relation to NetBank. I was told privately by a CommBank employee that they are deprecating the hardware token in favor of the mobile app, I hope that won&amp;rsquo;t happen anytime soon, or that they add support for passkeys before they do. The last time I checked, the CommBank app was LineageOS-friendly, but I don&amp;rsquo;t want to configure WayDroid just to do online banking.&lt;/p&gt;
&lt;p&gt;PayID, the thing that allows you to receive payment via a phone number or email address, is not compatible with the hardware token, and existing PayID will be silently deactivated if you use hardware token. This looks to be an artificial restriction; I don&amp;rsquo;t see why it has to be this way.&lt;/p&gt;
&lt;p&gt;Regular CommBank mobile app sessions will also be de-activated once the hardware token is activated (I was told so but my sessions weren&amp;rsquo;t deactivated until I wiped my Android phone), and you won&amp;rsquo;t be able to sign into mobile app again until you manually disable the NetCode token.&lt;/p&gt;
&lt;p&gt;Online banking has been getting progressively more invasive and anti-user over the last decade, from demanding remote attestation to requiring real time location data, each time locking certain features when those demands are not satisfied; all based on the flawed assumptions that everyone owns a phone running a certain flavor of iOS or Android, and has it ready all the time. I&amp;rsquo;m not sure what can be done to reverse this trend, but on the personal level I will use NetBank less and go back to cash.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Fix Pixel 3A XL Screen Unresponsiveness After First Lock</title>
      <link>https://segments.zhan.science/posts/fix_pixel3axl_screen_unresponsive_after_screenlock/</link>
      <pubDate>Fri, 29 Nov 2024 00:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/fix_pixel3axl_screen_unresponsive_after_screenlock/</guid>
      <description>&lt;p&gt;I recently replaced the screen of a Google Pixel 3A XL, the new panel is made by tianma and worked well under Andoird, until it doesn&amp;rsquo;t. On every boot up the screen will work until the phone went to sleep, and then the screen will stop responding to touch, until another reboot. After the screen became unresponsive, the rest of the phone would remain responsive during the locked state and it&amp;rsquo;s possible to unlock the screen with fingerprint, but there is no way to make the touchscreen responsive again without reboot.&lt;/p&gt;
&lt;p&gt;To fix this, go to Settings -&amp;gt; System -&amp;gt; Gestures and disable &lt;code&gt;Double-tap to check phone&lt;/code&gt;. After which the screen should no longer stuck into unresponsive state. This seems to be &lt;a href=&#34;https://support.google.com/mail/thread/26404710/pixel-3a-xl-touch-not-working-after-locking-phone&#34;&gt;a common problem&lt;/a&gt; affecting many phones with replaced screen.&lt;/p&gt;
&lt;p&gt;Google will surely shutdown their support forum one day and I encourage everyone to put their notes somewhere reliable, like a selfhosted blog :)&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Don&#39;t buy a Kindle</title>
      <link>https://segments.zhan.science/posts/dont_buy_a_kindle/</link>
      <pubDate>Sat, 05 Oct 2024 00:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/dont_buy_a_kindle/</guid>
      <description>&lt;p&gt;I believe buying a Kindle in 2024 is a bad idea, even if you only intend to use it for reading DRM-free locally stored ebooks. Basic functions such as organizing books into folders/collections are locked until the device is registered and with each system update the interface has became slower and more bloated.&lt;/p&gt;
&lt;p&gt;Initially I purchased this device because Amazon book store isn&amp;rsquo;t too bad and it&amp;rsquo;s one of the easier way to buy Japanese books outside of Japan, but with all the anti-features Amazon add in I don&amp;rsquo;t think it&amp;rsquo;s still worth using.&lt;/p&gt;
&lt;p&gt;Using a recent exploit and with &lt;a href=&#34;https://www.mobileread.com/forums/showthread.php?t=347165&#34;&gt;this downgrader thread&lt;/a&gt; on the mobileread forum, I&amp;rsquo;m able to downgrade my paperwhite to an older 5.11.2 firmware which has a simpler interface while being much more responsive. If you already have a Kindle perhaps this is worth doing.&lt;/p&gt;
&lt;h4 id=&#34;alternatives&#34;&gt;
  Alternatives?
  &lt;a class=&#34;anchor&#34; href=&#34;#alternatives&#34;&gt;#&lt;/a&gt;
&lt;/h4&gt;
&lt;p&gt;It&amp;rsquo;s possible to install alternative UI and custom OS to many Kindle models but they generally run slower than the default launcher. On the open hardware side Pine64 is making an e-ink tablet called the &lt;a href=&#34;https://pine64.org/documentation/PineNote/&#34;&gt;PineNote&lt;/a&gt; with an Rockchip RK3566 and 4G of RAM it should be fast enough to handle most documents/ebooks, but currently there is no usable Linux distribution for it.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Change or Set PIN for FIDO2 Token on Linux</title>
      <link>https://segments.zhan.science/posts/change_reset_pin_for_fido2_token/</link>
      <pubDate>Fri, 05 Jul 2024 00:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/change_reset_pin_for_fido2_token/</guid>
      <description>&lt;p&gt;The easiest way to change/set PIN for FIDO2 token seems to be with Chromium/Chrome:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Plug in the token&lt;/li&gt;
&lt;li&gt;Launch Chromium, navigate to &lt;code&gt;chrome://settings/securityKeys&lt;/code&gt;, or click Settings -&amp;gt; Privacy and Security -&amp;gt; Security -&amp;gt; Manage security keys&lt;/li&gt;
&lt;li&gt;Click &lt;code&gt;Create a PIN&lt;/code&gt;, if you don’t have a PIN set already, a new PIN will be created, otherwise you will be asked to change the existing pin&lt;/li&gt;
&lt;li&gt;Alternatively you can also wipe the token with the Reset option&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>More than smartphone, not yet laptop: Swmo on the PinePhone Pro</title>
      <link>https://segments.zhan.science/posts/swmo_pinephone_pro/</link>
      <pubDate>Tue, 07 May 2024 00:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/swmo_pinephone_pro/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve been daily driving the PinePhone Pro with &lt;a href=&#34;https://sxmo.org/&#34;&gt;swmo&lt;/a&gt; for some times now, it&amp;rsquo;s not perfect but I still find it be one of the most enjoyable devices I&amp;rsquo;ve used. Probably only behind &lt;a href=&#34;https://en.wikipedia.org/wiki/BlackBerry_Passport&#34;&gt;BlackBerry Q30/Passport&lt;/a&gt; which also has a decent keyboard and runs an unfortunately locked-down version of &lt;a href=&#34;https://en.wikipedia.org/wiki/QNX&#34;&gt;QNX&lt;/a&gt;. For me it&amp;rsquo;s less like a phone and more like a portable terminal for times when using a full size laptop is uncomfortable or impractical, and with the keyboard it&amp;rsquo;s possible to write lengthy articles on the go.&lt;/p&gt;
&lt;p&gt;This isn&amp;rsquo;t the only portable Linux terminal I owned, before this I used a Nokia N900 which till this day is still being maintained by the maemo leste team, but the shutdown of 3G network in where I live made it significantly less usable as a phone and since it doesn&amp;rsquo;t have a proper USB port I cannot use it as a serial console easily.&lt;/p&gt;
&lt;p&gt;The overall experience on the PPP now as of 2024 isn&amp;rsquo;t as polished as that of the BlackBerry Passport, and adhoc hacks are often required to get the system going, however as the ecosystem progress the experience will also improve with new revisions of hardware and better software.&lt;/p&gt;
&lt;h2 id=&#34;initial-setup&#34;&gt;
  Initial Setup
  &lt;a class=&#34;anchor&#34; href=&#34;#initial-setup&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;I use &lt;code&gt;sxmo&lt;/code&gt; and &lt;code&gt;swmo&lt;/code&gt; interchangeably in this post, they refer to the same framework running under Xorg and wayland, the experience is pretty much the same.&lt;/p&gt;
&lt;p&gt;Sxmo is packaged for Debian:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo apt install sway sxmo-util
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Allow access to LED/brightness:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo usermod -aG feedbackd user
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;scaling-under-wayland&#34;&gt;
  Scaling Under Wayland
  &lt;a class=&#34;anchor&#34; href=&#34;#scaling-under-wayland&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;The default scaling of sxmo doesn&amp;rsquo;t allow the many desktop applications to display their window properly, especially when such application is written under the assumption of being used on a larger screen. To set the scaling to something more reasonable, add the following line to &lt;code&gt;~/.config/sxmo/sway&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;exec wlr-randr --output DSI-1 --scale 1.3
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;When using swmo environment initialization is mostly done in &lt;code&gt;~/.config/sxmo/sway&lt;/code&gt; and &lt;code&gt;~/.config/sxmo/xinit&lt;/code&gt; is not used.&lt;/p&gt;
&lt;p&gt;Scaling for Firefox needs to be adjusted separately by first enabling compact UI and then set &lt;code&gt;settings -&amp;gt; default zoom&lt;/code&gt; to your liking.&lt;/p&gt;
&lt;h2 id=&#34;landscape-setup&#34;&gt;
  Landscape Setup
  &lt;a class=&#34;anchor&#34; href=&#34;#landscape-setup&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;I used lightdm as my session manager, to launch lightdm in landscape mode, change the &lt;code&gt;display-setup-script&lt;/code&gt; line in the &lt;code&gt;[Seat:*]&lt;/code&gt; section of /etc/lightdm/lightdm.conf to:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;display-setup-script=sh -c &amp;#39;xrandr -o right; exit 0&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To rotate to swmo to landscape mode on start:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ echo exec sxmo_rotate.sh &amp;gt;&amp;gt; ~/.config/sxmo/sway
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To rotate Linux framebuffer, add &lt;code&gt;fbcon=rotate:1&lt;/code&gt; to the &lt;code&gt;U_BOOT_PARAMETERS&lt;/code&gt; line in &lt;code&gt;/usr/share/u-boot-menu/conf.d/mobian.conf&lt;/code&gt; and run &lt;code&gt;u-boot-update&lt;/code&gt; to apply.&lt;/p&gt;
&lt;p&gt;I also removed &lt;code&gt;quiet splash&lt;/code&gt; from &lt;code&gt;U_BOOT_PARAMETERS&lt;/code&gt; to disable polymouth animation as it isn&amp;rsquo;t very useful on landscape mode.&lt;/p&gt;
&lt;h2 id=&#34;password-lockable-screen&#34;&gt;
  Password-Lockable Screen
  &lt;a class=&#34;anchor&#34; href=&#34;#password-lockable-screen&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Swmo doesn&amp;rsquo;t come with a secure screen locker. but swaylock works fine and it can be bind to a key combination with sway&amp;rsquo;s configure file. To save some battery life, &lt;code&gt;systemctl suspend&lt;/code&gt; can be triggered after swaylock, to bind that to Meta+L:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# .config/sxmo/sway
bindsym $mod+l exec &amp;#39;swaylock -f -c 000000 &amp;amp;&amp;amp; systemctl suspend&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In suspend mode, the battery discharge at a rate of about 1% per hour, I consider this to be more than acceptable.&lt;/p&gt;
&lt;p&gt;To unlock from a shell, just kill &lt;code&gt;swaylock&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Before you can suspend the system as a non-root user, the following polkit rule needs to be written to &lt;code&gt;/etc/polkit-1/rules.d/85-suspend.rules&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;polkit.addRule(function(action, subject) {
    if (action.id == &amp;#34;org.freedesktop.login1.suspend&amp;#34; &amp;amp;&amp;amp;
        subject.isInGroup(&amp;#34;users&amp;#34;)) {
        return polkit.Result.YES;
    }
});
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It would be better if there can be a universal interactive user group which automatically grant such permission to the desktop/mobile user.&lt;/p&gt;
&lt;h2 id=&#34;extra-keymaps&#34;&gt;
  Extra Keymaps
  &lt;a class=&#34;anchor&#34; href=&#34;#extra-keymaps&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;The default keymap for the PinePhone keyboard is missing a few useful keys, namely F11/F12 and PgUp/PgDown. To create those keys I used evremap(1) to make a custom keymap. Unfortunately the Fn key cannot be mapped as a layer switcher easily, so I opted to remap AltG and Esc as my primary modifiers.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m working on a Debian package for evremap and it will be made available for Debian/Mobian soon.&lt;/p&gt;
&lt;h2 id=&#34;isolate-workload-with-incus-containers&#34;&gt;
  Isolate workload with incus containers
  &lt;a class=&#34;anchor&#34; href=&#34;#isolate-workload-with-incus-containers&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/lxc/incus&#34;&gt;Incus&lt;/a&gt; is a container/VM manager for Linux, it&amp;rsquo;s available for Debian from bookworm/backports and is a fork of LXD by the original maintainers behind LXD. It works well for creating isolated and unprivileged containers. I have multiple incus containers on the PinePhone Pro for Debian packaging and it&amp;rsquo;s a better experience than manually creating and managing chroots. In case there is a need for running another container inside an unprivileged incus container, it&amp;rsquo;s possible to configure incus to &lt;a href=&#34;https://linuxcontainers.org/incus/docs/main/syscall-interception/&#34;&gt;intercept certain safe system calls&lt;/a&gt; and forward them to the host, removing the need for using privileged container.&lt;/p&gt;
&lt;h2 id=&#34;convergence&#34;&gt;
  Convergence
  &lt;a class=&#34;anchor&#34; href=&#34;#convergence&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Sway is decently usable in convergence mode, in which the phone is connected to a dock that outputs to an external display and keyboard and mouse are used as primary controls instead of the touchscreen.&lt;/p&gt;
&lt;p&gt;This isn&amp;rsquo;t surprising since sway always had great support for multi monitor, however another often overlooked convergence mode is with waypipe. In this mode another Linux machine (e.g. a laptop) can be used to interact with applications running on the phone and the phone will be kept charged by the laptop. This is particularly useful for debugging phone applications or for accessing resources on the phone (e.g. sending and receiving sms). One thing missing in this setup is that graphic applications cannot roam between the phone and the external system (e.g. move running applications from one machine to another). &lt;a href=&#34;https://github.com/Xpra-org/xpra&#34;&gt;Xpra&lt;/a&gt; does this for Xorg but doesn&amp;rsquo;t work with wayland.&lt;/p&gt;
&lt;h2 id=&#34;security&#34;&gt;
  Security
  &lt;a class=&#34;anchor&#34; href=&#34;#security&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Due to the simplicity of the swmo environment it&amp;rsquo;s not too difficult to get the system running with SELinux in Enforcing mode, and I encourage everyone reading this to try it. If running debian/mobian a good starting point is the &lt;a href=&#34;https://wiki.debian.org/SELinux/Setup&#34;&gt;SELinux/Setup page on Debian wiki&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Note: selinux-activate won&amp;rsquo;t add the required &lt;code&gt;security=selinux&lt;/code&gt; kernel option to u-boot (it only deals with GRUB) so you have to manually add it to the &lt;code&gt;U_BOOT_PARAMETERS&lt;/code&gt; line in &lt;code&gt;/usr/share/u-boot-menu/conf.d/mobian.conf&lt;/code&gt; and run &lt;code&gt;u-boot-update&lt;/code&gt; after &lt;code&gt;selinux-activate&lt;/code&gt;. The file labeling process can easily take 10 minutes and the progress won&amp;rsquo;t be displayed on the framebuffer (only visible via the serial console).&lt;/p&gt;
&lt;p&gt;SELinux along with the reference policy aren&amp;rsquo;t enough for building a reasonably secure interactive system, but let&amp;rsquo;s leave that for a future post.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Troubles with the PinePhone Keyboard and a disappointing mitigation</title>
      <link>https://segments.zhan.science/posts/troubles_with_the_pinephone_keyboard/</link>
      <pubDate>Tue, 23 Apr 2024 10:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/troubles_with_the_pinephone_keyboard/</guid>
      <description>&lt;h2 id=&#34;the-melting-plastic-and-the-smoke&#34;&gt;
  The melting plastic and the smoke
  &lt;a class=&#34;anchor&#34; href=&#34;#the-melting-plastic-and-the-smoke&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;The PinePhone keyboard contains a battery, which will be used to charge the PinePhone when the keyboard is attached. Althrough there are existing warnings on the pine64 wiki which sums up to &amp;lsquo;don&amp;rsquo;t charge or connect anything to your pinephone&amp;rsquo;s type C interface when the keyboard is attached&amp;rsquo;, my two pinephone keyboards still managed to fry themselves, with one releasing stinky magic smoke and the other melting the plastic around the pogo pins on the pinephone backplate.&lt;/p&gt;
&lt;p&gt;This all happened while the pinephone&amp;rsquo;s type C interface being physically block when attached to the keyboard. In the first case, the keyboard&amp;rsquo;s controller PCB blew up when I tried to charge it, in the latter case the keyboard somehow overheated and melted the plastic near the pogo interface on the phone side.&lt;/p&gt;
&lt;p&gt;Pine64 provided me a free replacement keyboard after multiple emails back and forth, but according to Pine64 there will be no more free replacement for me in future, and there is no guarantee that this will not happen to my replacement keyboard.&lt;/p&gt;
&lt;p&gt;The cost for replacing all the fried parts with spare parts from the Pine64 store is about 40 USD (pogo pins + backplate + keyboard PCB), and considering this problem is likely to happen again, I don&amp;rsquo;t think purchasing those parts is a wise decision.&lt;/p&gt;
&lt;h2 id=&#34;mitigation&#34;&gt;
  Mitigation
  &lt;a class=&#34;anchor&#34; href=&#34;#mitigation&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Both the melting plastic and the magic smoke originated from the fact that charges are constantly shuffled around when the keyboard is attached to the pinephone, and since the keyboard can function independently from the battery, we can disconnect and remove the battery from the keyboard case to make sure it will not blow up again. After such precedure the keyboard will keep functioning althrough the keyboard-attached pinephone might flip over much more easily due to the lightened keyboard base. Be aware that the keyboard isn&amp;rsquo;t designed to be taken apart, and doing so will likely result in scratches on the case. As for me, I&amp;rsquo;d much rather have a keyboard case without builtin battery than have something that can overheat or blow up.&lt;/p&gt;
&lt;h3 id=&#34;disable-the-ip5xxx-kernel-module&#34;&gt;
  Disable the ip5xxx kernel module
  &lt;a class=&#34;anchor&#34; href=&#34;#disable-the-ip5xxx-kernel-module&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;To prevent the kernel module from flooding the dmesg and reporting bogus battery level after the battery removal, blacklist the &lt;code&gt;ip5xxx_power&lt;/code&gt; module:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# echo blacklist ip5xxx_power &amp;gt; /etc/modprobe.d/blacklist.conf
&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>Everything Open 2024 Quick Notes :: Day 2 and 3</title>
      <link>https://segments.zhan.science/posts/everything_2024_quick_notes_day2_3/</link>
      <pubDate>Sat, 20 Apr 2024 11:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/everything_2024_quick_notes_day2_3/</guid>
      <description>&lt;p&gt;I didn&amp;rsquo;t take as much notes on day 2 and 3, so I merged them into a single article.&lt;/p&gt;
&lt;hr&gt;
&lt;h1 id=&#34;wednesday-17-apr-2024&#34;&gt;
  Wednesday, 17 Apr 2024
  &lt;a class=&#34;anchor&#34; href=&#34;#wednesday-17-apr-2024&#34;&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;h2 id=&#34;keynote-how-adversaries-use-aihttps2024everythingopenauschedulepresentation59&#34;&gt;
  &lt;a href=&#34;https://2024.everythingopen.au/schedule/presentation/59/&#34;&gt;Keynote: How Adversaries Use AI&lt;/a&gt;
  &lt;a class=&#34;anchor&#34; href=&#34;#keynote-how-adversaries-use-aihttps2024everythingopenauschedulepresentation59&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Adversaries:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Nation States&lt;/li&gt;
&lt;li&gt;Ecrime&lt;/li&gt;
&lt;li&gt;Hactivism
&lt;ul&gt;
&lt;li&gt;Not always clearly separated&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;LLM can help eliminate common language mistakes, perform better social enginerring&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Many adversaries are trying to integrate LLMs into their workflow, with varying results&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Time frame from initial foothold to lateral movements is getting shorter, due to better toolings?&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;golanghttps2024everythingopenauschedulepresentation53&#34;&gt;
  &lt;a href=&#34;https://2024.everythingopen.au/schedule/presentation/53/&#34;&gt;GoLang&lt;/a&gt;
  &lt;a class=&#34;anchor&#34; href=&#34;#golanghttps2024everythingopenauschedulepresentation53&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;IDE setup / difference with C and other common language&lt;/li&gt;
&lt;li&gt;Compile down to single binary for many arch/platforms&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;rootless-networking-from-possible-to-practicalhttps2024everythingopenauschedulepresentation37&#34;&gt;
  &lt;a href=&#34;https://2024.everythingopen.au/schedule/presentation/37/&#34;&gt;Rootless networking: From possible to practical&lt;/a&gt;
  &lt;a class=&#34;anchor&#34; href=&#34;#rootless-networking-from-possible-to-practicalhttps2024everythingopenauschedulepresentation37&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;libslirp is too slow&lt;/li&gt;
&lt;li&gt;passt &amp;amp; pasta
&lt;ul&gt;
&lt;li&gt;much faster than libslirp&lt;/li&gt;
&lt;li&gt;same binary, different command&lt;/li&gt;
&lt;li&gt;translate between layer 2 network interface and native layer 4 sockets on a host&lt;/li&gt;
&lt;li&gt;unprivileged, no capability needed, good fit for container &amp;amp; VM&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://passt.top/passt/about/&#34;&gt;https://passt.top/passt/about/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;running-a-particle-accelerator-on-open-sourcehttps2024everythingopenauschedulepresentation67&#34;&gt;
  &lt;a href=&#34;https://2024.everythingopen.au/schedule/presentation/67/&#34;&gt;Running a Particle Accelerator on Open Source&lt;/a&gt;
  &lt;a class=&#34;anchor&#34; href=&#34;#running-a-particle-accelerator-on-open-sourcehttps2024everythingopenauschedulepresentation67&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;One of the best talk!&lt;/li&gt;
&lt;li&gt;Software design &amp;amp; activity planning&lt;/li&gt;
&lt;li&gt;Synchrotron
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Synchrotron&#34;&gt;https://en.wikipedia.org/wiki/Synchrotron&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Australian_Synchrotron&#34;&gt;https://en.wikipedia.org/wiki/Australian_Synchrotron&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;What&amp;rsquo;s happening there
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.ansto.gov.au/about/locations/visit-australian-synchrotron&#34;&gt;https://www.ansto.gov.au/about/locations/visit-australian-synchrotron&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;No more open days for now :(
&lt;ul&gt;
&lt;li&gt;maybe after mid 2024?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h1 id=&#34;thursday-18-apr-2024&#34;&gt;
  Thursday, 18 Apr 2024
  &lt;a class=&#34;anchor&#34; href=&#34;#thursday-18-apr-2024&#34;&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;h2 id=&#34;keynote-intelligent-interfaces-challenges-and-opportunitieshttps2024everythingopenauschedulepresentation60&#34;&gt;
  &lt;a href=&#34;https://2024.everythingopen.au/schedule/presentation/60/&#34;&gt;Keynote: Intelligent Interfaces: Challenges and Opportunities&lt;/a&gt;
  &lt;a class=&#34;anchor&#34; href=&#34;#keynote-intelligent-interfaces-challenges-and-opportunitieshttps2024everythingopenauschedulepresentation60&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Another great talk, we don&amp;rsquo;t get HID talk often unfortunately&lt;/li&gt;
&lt;li&gt;Sensing: what can we sense more?
&lt;ul&gt;
&lt;li&gt;Eye tracking: figure out when the user is not paying attention and then when the user look back, show a diff/changelog&lt;/li&gt;
&lt;li&gt;Change Blindness, proximity-based experience: change how detailed the UI is based on proximity&lt;/li&gt;
&lt;li&gt;RadarCat, Radar and Categorization: better privacy than having camera everywhere
&lt;ul&gt;
&lt;li&gt;obtain infomation via wave reflection and absorption (can this be abused&amp;hellip;?)&lt;/li&gt;
&lt;li&gt;use ML trainning for better accuracy&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;MicroCam and SpeCam: placement based action: detect which surface is under/over the device&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;foss-from-building-websites-to-changing-societyhttps2024everythingopenauschedulepresentation51&#34;&gt;
  &lt;a href=&#34;https://2024.everythingopen.au/schedule/presentation/51/&#34;&gt;FOSS: From Building Websites to Changing Society&lt;/a&gt;
  &lt;a class=&#34;anchor&#34; href=&#34;#foss-from-building-websites-to-changing-societyhttps2024everythingopenauschedulepresentation51&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Echo chamber: FOSS run on different social/economic structure than commercial proprietary software, it takes effort to convince people&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;adventures-in-fuzzing-the-kernel-on-powerhttps2024everythingopenauschedulepresentation20&#34;&gt;
  &lt;a href=&#34;https://2024.everythingopen.au/schedule/presentation/20/&#34;&gt;Adventures in fuzzing the kernel on Power&lt;/a&gt;
  &lt;a class=&#34;anchor&#34; href=&#34;#adventures-in-fuzzing-the-kernel-on-powerhttps2024everythingopenauschedulepresentation20&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;porting syzcaller to run on Power&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;general fuzzinng engines&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;universal eginee: AFL++&lt;/li&gt;
&lt;li&gt;domain specific fuzzer: syzkaller&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Unsupervised: no human input required&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Coveraged-guided: fuzz and measures which codepath is fuzzed&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Things to fuzz: syscalls/dxrivers/fs/ebpf/kvm/network stacks&amp;hellip;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;KVM: guest-host / host-guest&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Simple kernel fuzzers existed est. 1991&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;but not coverage based&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Hosted version on Google Cloud: &lt;a href=&#34;https://syzkaller.appspot.com/upstream&#34;&gt;https://syzkaller.appspot.com/upstream&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Sanitisers: print errors on memory corruption/UB/concurrency problems etc&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;KMSAN isn&amp;rsquo;t on Power yet&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Hardware:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/PowerPC&#34;&gt;https://en.wikipedia.org/wiki/PowerPC&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;many more modern Power system&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;New architecture enablement&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Parse arch-specific details of kernel error&lt;/li&gt;
&lt;li&gt;Enable kcov (but not everywhere)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Stack traces are printed differently across archs&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;use regex, 2.5KLoC ;)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;instruction fuzzing&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;generate and mutate PPC64 PowerISA machine code&lt;/li&gt;
&lt;li&gt;More coverage for KVM related pathways&lt;/li&gt;
&lt;li&gt;Only for x86 and power at the moment&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;QEMU/KVM on bare metal Open Power systems&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Bug found:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;KVM guests can crash/hang the host, race conditions?&lt;/li&gt;
&lt;li&gt;Bugs in KUAP&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;PowerVM&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Type 1 hypervisor&lt;/li&gt;
&lt;li&gt;Runs Linux/AIX/IBM I VMs&lt;/li&gt;
&lt;li&gt;Need a separate machine as management console&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;PowerVC&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Forked from openstack&lt;/li&gt;
&lt;li&gt;Mostly OpenStack API&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.ibm.com/products/powervc&#34;&gt;https://www.ibm.com/products/powervc&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;lightning-talks&#34;&gt;
  Lightning Talks
  &lt;a class=&#34;anchor&#34; href=&#34;#lightning-talks&#34;&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;FileSender&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/filesender/filesender&#34;&gt;https://github.com/filesender/filesender&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://filesender.org/&#34;&gt;https://filesender.org/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;end-to-end encrypted data transter, from web.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;radio::console&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/gm-stack/radioconsole&#34;&gt;https://github.com/gm-stack/radioconsole&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;control radios, remotely, good fit for stations in remote areas.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;AgOpenGPS&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/farmerbriantee/AgOpenGPS&#34;&gt;https://github.com/farmerbriantee/AgOpenGPS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;self steering system (hardware, software, firmware) for tractors&lt;/li&gt;
&lt;li&gt;only on Windows&amp;hellip;?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Everything Open 2024 Quick Notes :: Day 1</title>
      <link>https://segments.zhan.science/posts/everything_2024_quick_notes_day1/</link>
      <pubDate>Tue, 16 Apr 2024 00:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/everything_2024_quick_notes_day1/</guid>
      <description>&lt;h2 id=&#34;sched_ext---write-your-own-linux-thread-scheduler-in-bpfhttps2024everythingopenauschedulepresentation53&#34;&gt;
  &lt;a href=&#34;https://2024.everythingopen.au/schedule/presentation/53/&#34;&gt;sched_ext - Write your own Linux thread scheduler in BPF&lt;/a&gt;
  &lt;a class=&#34;anchor&#34; href=&#34;#sched_ext---write-your-own-linux-thread-scheduler-in-bpfhttps2024everythingopenauschedulepresentation53&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;BPF made creating new scheduler simpler&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;with strong safety guarantee to not break the system, the side effects of bad scheduler are confined.&lt;/li&gt;
&lt;li&gt;run a binary to enable your scheduler, stop the binary to revert to default&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Scheduling problem is now more complicated due to increasing complexity of workload/CPU design&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;BPF provides reliable access to critical data structures inside the kernel&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;exploring-mobile-linux-security-with-pinephone-pro-op-tee-sec-enclave-virtualization-and-beyondhttps2024everythingopenauschedulepresentation24&#34;&gt;
  &lt;a href=&#34;https://2024.everythingopen.au/schedule/presentation/24/&#34;&gt;Exploring mobile linux security with PinePhone Pro: OP-TEE sec enclave, Virtualization and beyond&lt;/a&gt;
  &lt;a class=&#34;anchor&#34; href=&#34;#exploring-mobile-linux-security-with-pinephone-pro-op-tee-sec-enclave-virtualization-and-beyondhttps2024everythingopenauschedulepresentation24&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;This is my talk ;)&lt;/li&gt;
&lt;li&gt;See the &lt;a href=&#34;https://segments.zhan.science/posts/everything_2024_gladstone_links/&#34;&gt;readings page&lt;/a&gt; for slides/demos and more.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;presenting-n3n---a-simple-peer-to-peer-vpnhttps2024everythingopenauschedulepresentation54&#34;&gt;
  &lt;a href=&#34;https://2024.everythingopen.au/schedule/presentation/54/&#34;&gt;Presenting n3n - A simple Peer to Peer VPN&lt;/a&gt;
  &lt;a class=&#34;anchor&#34; href=&#34;#presenting-n3n---a-simple-peer-to-peer-vpnhttps2024everythingopenauschedulepresentation54&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Forked from n2n to avoid CLA&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Protocol level compatibility with n2n is maintained&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Peer-to-peer VPN at network layer, acting like a distributed virtual switch&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Layer 2 over Layer 3&lt;/li&gt;
&lt;li&gt;Only route packets through a server/supernode when required, p2p by default&lt;/li&gt;
&lt;li&gt;Better latency due to being p2p&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;NAT piecing&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Written in C, should have good cross-platform supports (more testing wanted on &lt;code&gt;*BSD&lt;/code&gt;)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Relatively small codebase for a VPN&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;TunTap interface support is expected from the OS side, shouldn&amp;rsquo;t be a problem for common Unix-likes&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Modern macOS is dropping support for TunTap, need to use NetworkExtension?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Packaging and distro submission are still WIP&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Framework for a debian package exists but not in an upstreamable shape&lt;/li&gt;
&lt;li&gt;OpenBSD?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Future roadmap&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;n3n over IPv6&lt;/li&gt;
&lt;li&gt;Code cleanup&lt;/li&gt;
&lt;li&gt;Multiple network driver support (e.g. something other than TunTap)&lt;/li&gt;
&lt;li&gt;Better NAR piecing&lt;/li&gt;
&lt;li&gt;Mobile support?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Useful for&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;LAN gaming with old/modern systems&lt;/li&gt;
&lt;li&gt;Remote access&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Simpler than wireguard/openvpn but offers OK security (not for security-critical apps?)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Easier to configure, use INI style config files&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;running-your-own-mailserverhttps2024everythingopenauschedulepresentation11&#34;&gt;
  &lt;a href=&#34;https://2024.everythingopen.au/schedule/presentation/11/&#34;&gt;Running your own Mailserver&lt;/a&gt;
  &lt;a class=&#34;anchor&#34; href=&#34;#running-your-own-mailserverhttps2024everythingopenauschedulepresentation11&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;90% of all incoming mails are low-effort spams.&lt;/li&gt;
&lt;li&gt;Setup DMARC/SPF records&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;lions-os&#34;&gt;
  Lions OS
  &lt;a class=&#34;anchor&#34; href=&#34;#lions-os&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;seL4 is bad at usability, Lions OS intends to solve this&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Still in early stage of development&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Composable components for build custom OS for a single task&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Runs on seL4 Microkernel&lt;/li&gt;
&lt;li&gt;For things like IoT, embedded, cars etc&amp;hellip;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Focus on simplicity&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;0.1.0 just released, still in its early stage&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;high performance&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Only for Arm64/aarch64 now, riscv64 in future?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://trustworthy.systems/projects/drivers/sddf-design.pdf&#34;&gt;Device Driver Model&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://www.lionsos.org/docs/use/language_support/&#34;&gt;Multi Language Support&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;A reference system called &lt;a href=&#34;https://www.lionsos.org/docs/kitty/&#34;&gt;Kitty&lt;/a&gt; exists&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A Linux running inside VMM is used for framebuffer, but any OS should do&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Links and Further Readings for My Everything Open 2024 Talk </title>
      <link>https://segments.zhan.science/posts/everything_2024_gladstone_links/</link>
      <pubDate>Fri, 12 Apr 2024 00:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/everything_2024_gladstone_links/</guid>
      <description>&lt;p&gt;Here you can find a list of links related to my topic which I find useful or just interesting.&lt;/p&gt;
&lt;h2 id=&#34;meta&#34;&gt;
  Meta
  &lt;a class=&#34;anchor&#34; href=&#34;#meta&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Info page
&lt;a href=&#34;https://2024.everythingopen.au/schedule/presentation/24/&#34;&gt;https://2024.everythingopen.au/schedule/presentation/24/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Slides
&lt;a href=&#34;https://segments.zhan.science/talks/EO2024/EO2024.Slides.exploring.mobile.linux.security.odp&#34;&gt;EO2024.Slides.exploring.mobile.linux.security.odp&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Recording
XXX to be processed&lt;/p&gt;
&lt;p&gt;VerityMobile
&lt;a href=&#34;https://github.com/ZhanYF/veritymobile/tree/dev-wip&#34;&gt;GitHub :: ZhanYF/veritymobile&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;demo&#34;&gt;
  Demo
  &lt;a class=&#34;anchor&#34; href=&#34;#demo&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://segments.zhan.science/talks/EO2024/BootToSystemAccessMeasurements.mp4&#34;&gt;Access Measurements from Linux Userland&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://segments.zhan.science/talks/EO2024/SigninToGitLabWithFTPM.mp4&#34;&gt;Sign in to GitLab with fTPM-backed FIDO token&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://segments.zhan.science/talks/EO2024/ftpmBackedSSHIdentity.mp4&#34;&gt;fTPM-backed SSH Identity&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://segments.zhan.science/talks/EO2024/BrowserSession.mp4&#34;&gt;Disposable Web Session&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;op-tee&#34;&gt;
  OP-TEE
  &lt;a class=&#34;anchor&#34; href=&#34;#op-tee&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id=&#34;docs-index-and-high-level-introduction&#34;&gt;
  Docs Index and high level introduction
  &lt;a class=&#34;anchor&#34; href=&#34;#docs-index-and-high-level-introduction&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://optee.readthedocs.io/en/latest/general/about.html&#34;&gt;https://optee.readthedocs.io/en/latest/general/about.html&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;secure-storage&#34;&gt;
  Secure Storage
  &lt;a class=&#34;anchor&#34; href=&#34;#secure-storage&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://optee.readthedocs.io/en/latest/architecture/secure_storage.html&#34;&gt;https://optee.readthedocs.io/en/latest/architecture/secure_storage.html&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;globalplatform-api&#34;&gt;
  GlobalPlatform API
  &lt;a class=&#34;anchor&#34; href=&#34;#globalplatform-api&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://optee.readthedocs.io/en/latest/architecture/globalplatform_api.html#globalplatform-api&#34;&gt;https://optee.readthedocs.io/en/latest/architecture/globalplatform_api.html#globalplatform-api&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;talks-and-demos-about-op-tee&#34;&gt;
  Talks and Demos about OP-TEE
  &lt;a class=&#34;anchor&#34; href=&#34;#talks-and-demos-about-op-tee&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://optee.readthedocs.io/en/latest/general/presentations.html&#34;&gt;https://optee.readthedocs.io/en/latest/general/presentations.html&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;other-tees&#34;&gt;
  Other TEEs
  &lt;a class=&#34;anchor&#34; href=&#34;#other-tees&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id=&#34;android-trusty&#34;&gt;
  Android Trusty
  &lt;a class=&#34;anchor&#34; href=&#34;#android-trusty&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://source.android.com/docs/security/features/trusty&#34;&gt;https://source.android.com/docs/security/features/trusty&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;apple-secure-enclave&#34;&gt;
  Apple Secure Enclave
  &lt;a class=&#34;anchor&#34; href=&#34;#apple-secure-enclave&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://support.apple.com/en-sg/guide/security/sec59b0b31ff/web&#34;&gt;https://support.apple.com/en-sg/guide/security/sec59b0b31ff/web&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;tpm-and-desktopmobile-linux&#34;&gt;
  TPM and Desktop/Mobile Linux
  &lt;a class=&#34;anchor&#34; href=&#34;#tpm-and-desktopmobile-linux&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id=&#34;what-can-you-do-with-a-tpm-by-michael-peters&#34;&gt;
  What Can You Do with a TPM by Michael Peters
  &lt;a class=&#34;anchor&#34; href=&#34;#what-can-you-do-with-a-tpm-by-michael-peters&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;This also covers Measured Boot and Secure Boot&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://next.redhat.com/2021/05/13/what-can-you-do-with-a-tpm/&#34;&gt;https://next.redhat.com/2021/05/13/what-can-you-do-with-a-tpm/&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;a-webauthnu2f-token-protected-by-a-tpm-golinux-by-peter-sanford&#34;&gt;
  A WebAuthn/U2F token protected by a TPM (Go/Linux) by Peter Sanford
  &lt;a class=&#34;anchor&#34; href=&#34;#a-webauthnu2f-token-protected-by-a-tpm-golinux-by-peter-sanford&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/psanford/tpm-fido&#34;&gt;https://github.com/psanford/tpm-fido&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;setup-tpm-backed-ssh-identity&#34;&gt;
  Setup TPM-backed SSH identity
  &lt;a class=&#34;anchor&#34; href=&#34;#setup-tpm-backed-ssh-identity&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://www.ledger.com/blog/ssh-with-tpm&#34;&gt;https://www.ledger.com/blog/ssh-with-tpm&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;secure-boot-on-embedded-devices&#34;&gt;
  Secure Boot on embedded devices
  &lt;a class=&#34;anchor&#34; href=&#34;#secure-boot-on-embedded-devices&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id=&#34;secure-boot-in-embedded-linux-systems-by-thomas-perrot&#34;&gt;
  Secure boot in embedded Linux systems by Thomas Perrot
  &lt;a class=&#34;anchor&#34; href=&#34;#secure-boot-in-embedded-linux-systems-by-thomas-perrot&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://bootlin.com/pub/conferences/2021/lee/perrot-secure-boot/perrot-secure-boot.pdf&#34;&gt;https://bootlin.com/pub/conferences/2021/lee/perrot-secure-boot/perrot-secure-boot.pdf&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;shadow-box&#34;&gt;
  Shadow-box
  &lt;a class=&#34;anchor&#34; href=&#34;#shadow-box&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id=&#34;shadow-box-for-arm-using-op-tee&#34;&gt;
  Shadow-box for ARM using OP-TEE
  &lt;a class=&#34;anchor&#34; href=&#34;#shadow-box-for-arm-using-op-tee&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;h4 id=&#34;highlevel-description&#34;&gt;
  Highlevel description
  &lt;a class=&#34;anchor&#34; href=&#34;#highlevel-description&#34;&gt;#&lt;/a&gt;
&lt;/h4&gt;
&lt;p&gt;&lt;a href=&#34;https://www.blackhat.com/asia-18/briefings.html#shadow-box-v2-the-practical-and-omnipotent-sandbox-for-arm&#34;&gt;https://www.blackhat.com/asia-18/briefings.html#shadow-box-v2-the-practical-and-omnipotent-sandbox-for-arm&lt;/a&gt;&lt;/p&gt;
&lt;h4 id=&#34;source-code-and-build-instructions&#34;&gt;
  Source code and build instructions
  &lt;a class=&#34;anchor&#34; href=&#34;#source-code-and-build-instructions&#34;&gt;#&lt;/a&gt;
&lt;/h4&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kkamagui/shadow-box-for-arm&#34;&gt;https://github.com/kkamagui/shadow-box-for-arm&lt;/a&gt;
&lt;a href=&#34;https://github.com/kkamagui/manifest&#34;&gt;https://github.com/kkamagui/manifest&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;older-version-of-shadow-box-for-x86&#34;&gt;
  Older version of Shadow-box for x86
  &lt;a class=&#34;anchor&#34; href=&#34;#older-version-of-shadow-box-for-x86&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kkamagui/shadow-box-for-x86&#34;&gt;https://github.com/kkamagui/shadow-box-for-x86&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;rk3399&#34;&gt;
  RK3399
  &lt;a class=&#34;anchor&#34; href=&#34;#rk3399&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id=&#34;enabling-secure-boot-on-rockchip-socs-by-artur-kowalski&#34;&gt;
  Enabling Secure Boot on RockChip SoCs by Artur Kowalski
  &lt;a class=&#34;anchor&#34; href=&#34;#enabling-secure-boot-on-rockchip-socs-by-artur-kowalski&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://blog.3mdeb.com/2021/2021-12-03-rockchip-secure-boot/&#34;&gt;https://blog.3mdeb.com/2021/2021-12-03-rockchip-secure-boot/&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;rpmb&#34;&gt;
  RPMB
  &lt;a class=&#34;anchor&#34; href=&#34;#rpmb&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id=&#34;rpmb-a-secret-place-inside-the-emmc-by-sergio-prado&#34;&gt;
  RPMB, a secret place inside the eMMC by Sergio Prado
  &lt;a class=&#34;anchor&#34; href=&#34;#rpmb-a-secret-place-inside-the-emmc-by-sergio-prado&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://sergioprado.blog/rpmb-a-secret-place-inside-the-emmc/&#34;&gt;https://sergioprado.blog/rpmb-a-secret-place-inside-the-emmc/&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;virtualization&#34;&gt;
  Virtualization
  &lt;a class=&#34;anchor&#34; href=&#34;#virtualization&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id=&#34;firecracker&#34;&gt;
  Firecracker
  &lt;a class=&#34;anchor&#34; href=&#34;#firecracker&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/firecracker-microvm/firecracker&#34;&gt;https://github.com/firecracker-microvm/firecracker&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;firectl1&#34;&gt;
  firectl(1)
  &lt;a class=&#34;anchor&#34; href=&#34;#firectl1&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/firecracker-microvm/firectl&#34;&gt;https://github.com/firecracker-microvm/firectl&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;run-general-purpose-arm64-vms-with-kvm-on-rk3399&#34;&gt;
  Run general purpose arm64 VMs with KVM on RK3399
  &lt;a class=&#34;anchor&#34; href=&#34;#run-general-purpose-arm64-vms-with-kvm-on-rk3399&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://segments.zhan.science/posts/kvm_on_pinehone_pro/&#34;&gt;https://segments.zhan.science/posts/kvm_on_pinehone_pro/&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Monitor Upstream Updates for OpenBSD Packages</title>
      <link>https://segments.zhan.science/posts/monitor_upstream_update_for_openbsd_package/</link>
      <pubDate>Wed, 01 Nov 2023 00:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/monitor_upstream_update_for_openbsd_package/</guid>
      <description>&lt;p&gt;As an OpenBSD package maintainer, I often need to watch for updates on packages I maintain. I used to do this using &lt;a href=&#34;https://repology.org/&#34;&gt;repology.org&lt;/a&gt;, which has the benefit of tracking package updates in many distros, but it can be unreliable for OpenBSD packages due to network delay and parsing problems.&lt;/p&gt;
&lt;p&gt;One better way to watch for upstream update is using OpenBSD&amp;rsquo;s &lt;a href=&#34;https://portroach.openbsd.org&#34;&gt;portroach&lt;/a&gt; service, it monitors new upstream release and provides a JSON API that can be combined with jq(1) to produce clear information.&lt;/p&gt;
&lt;h3 id=&#34;querying-portroach&#34;&gt;
  Querying portroach
  &lt;a class=&#34;anchor&#34; href=&#34;#querying-portroach&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;To find all packages that can be updated for a given maintainer, first find the maintainer page on &lt;a href=&#34;https://portroach.openbsd.org&#34;&gt;portroach&lt;/a&gt;, you can search by maintainer name and the page&amp;rsquo;s URL should be similar to the following:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;https://portroach.openbsd.org/yifei%20zhan%20%3Copenbsd@zhan.science%3E.html
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now to get JSON output, add &lt;code&gt;/json/&lt;/code&gt; to the URL and change the suffix from &lt;code&gt;.html&lt;/code&gt; to &lt;code&gt;.json&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;https://portroach.openbsd.org/json/yifei%20zhan%20%3Copenbsd@zhan.science%3E.json 
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This endpoint will return all the packages maintained by a given maintainer, regardless of having an update or not. To only show packaged that can be updated, jq(1) can be used as a powerful filter and formatter:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ ftp -Vo - https://portroach.openbsd.org/json/yifei%20zhan%20%3Copenbsd@zhan.science%3E.json\
| jq -r &amp;#39;.[] | select(.newver!=null) | (.fullpkgpath)+&amp;#34;: &amp;#34;+(.ver)+&amp;#34; -&amp;gt; &amp;#34;+(.newver)&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Which prints a nice list of package I need to work on:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;converters/opencc: 1.1.6 -&amp;gt; er.1.1.7
inputmethods/fcitx: 5.0.23 -&amp;gt; 5.1.1
inputmethods/fcitx-chinese-addons: 5.0.17 -&amp;gt; 5.1.1
inputmethods/fcitx-config-qt: 5.0.17 -&amp;gt; 5.1.1
inputmethods/fcitx-gtk: 5.0.23 -&amp;gt; 5.1.0
inputmethods/fcitx-lua: 5.0.10 -&amp;gt; 5.0.11
inputmethods/fcitx-qt: 5.0.17 -&amp;gt; 5.1.1
inputmethods/fcitx-table-extra: 5.0.13 -&amp;gt; 5.1.0
inputmethods/libime: 1.0.17 -&amp;gt; 1.1.2
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;closing-note&#34;&gt;
  Closing note
  &lt;a class=&#34;anchor&#34; href=&#34;#closing-note&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;Please be mindful that portroach is not infaillible, it may produce inaccurate result for some upstreams. The hosted version is a community resource, so please don&amp;rsquo;t abuse it, If you want, you can selfhost it with source code from &lt;a href=&#34;https://github.com/jasperla/portroach&#34;&gt;its GitHub repository&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Encrypted and Version Controlled File Sync with git-annex(1)</title>
      <link>https://segments.zhan.science/posts/quick_encrypted_git_annex/</link>
      <pubDate>Sat, 21 Oct 2023 00:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/quick_encrypted_git_annex/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://git-annex.branchable.com/&#34;&gt;git-annex(1)&lt;/a&gt; is a versatile and cross-platform tool build on top of git, it can sync, backup, archive files and provides many useful primitives for building customized workflow and storage system, for example, by combining git-annex with gcrypt, it&amp;rsquo;s possible to fully encrypt data stored on a remote.&lt;/p&gt;
&lt;p&gt;Partially due to its versatility, it has a steeper learning curve than some other tools in this field and it took me some time to figure out how to make it work for me, here is a quick guide that documents my journey.&lt;/p&gt;
&lt;h3 id=&#34;prerequisite-and-installation&#34;&gt;
  Prerequisite and Installation
  &lt;a class=&#34;anchor&#34; href=&#34;#prerequisite-and-installation&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;git-annex and git-remote-gcrypt is &lt;a href=&#34;https://git-annex.branchable.com/install/&#34;&gt;available from many package manager&lt;/a&gt;, to install them on Debian:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# apt-get install git-annex git-remote-gcrypt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;git-annex supports &lt;a href=&#34;https://git-annex.branchable.com/encryption/&#34;&gt;multiple encryption mode&lt;/a&gt;, I will be going with the default &lt;a href=&#34;https://git-annex.branchable.com/design/encryption/&#34;&gt;hybrid mode&lt;/a&gt; since it allows more keys to be added in future. In this mode, data is encrypted with gpg using a symmetric key generated during remote initialization, the key then is encrypted by a gpg public key specified during &lt;code&gt;initremote&lt;/code&gt;. After that, the symmetric key is checked into the git repository. This is useful when multiple users wish to access the same encrypted repository, but doing so is outside the scope of this post, for doing that and other advanced operations, read &lt;a href=&#34;https://git-annex.branchable.com/tips/fully_encrypted_git_repositories_with_gcrypt/&#34;&gt;git-annex&amp;rsquo;s gcrypt guide&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;I opt to create a new key for this use case, but any gpg key will do.&lt;/p&gt;
&lt;h3 id=&#34;setup-local-repository&#34;&gt;
  Setup Local Repository
  &lt;a class=&#34;anchor&#34; href=&#34;#setup-local-repository&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;The first step is to create a local repository as base, which will then be synced to remotes:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;laptop$ git init myrepo
laptop$ cd myrepo
laptop$ git annex init
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To checkin and commit some file into it:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;laptop$ touch example
laptop$ git annex .
laptop$ git commit -a -m &amp;#39;test&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;setup-encrypted-remote&#34;&gt;
  Setup Encrypted Remote
  &lt;a class=&#34;anchor&#34; href=&#34;#setup-encrypted-remote&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;First, create a bare repository on the server, it will hold encrypted data later:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;server$ git init --bare myrepo-remote
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then, on the local machine, add the newly created repository on the server as an encrypted remote, it&amp;rsquo;s a good practice to give it a descriptive name:&lt;/p&gt;
&lt;p&gt;(To find the KEYID, run &lt;code&gt;gpg --list-key&lt;/code&gt;)&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;laptop$ git annex initremote homeserver type=gcrypt gitrepo=rsync://server_hostname/path/to/myrepo-remote keyid=$KEYID
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;gcrypt: Repository not found: rsync://server_hostname/path/to/myrepo-remote
gcrypt: Setting up new repository
gcrypt: Remote ID is :id:XXX
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Compressing objects: 100% (3/3), done.
Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
gcrypt: Encrypting to:  -r XXX
gcrypt: Requesting manifest signature
To gcrypt::rsync://server_hostname/path/to/myrepo-remote
 * [new branch]      git-annex -&amp;gt; git-annex
ok
(recording state in git...)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;With this done, it should now be possible to sync local repository to the remote:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;laptop$ git annex sync --content
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;work-with-multiple-local-machines&#34;&gt;
  Work with Multiple Local Machines
  &lt;a class=&#34;anchor&#34; href=&#34;#work-with-multiple-local-machines&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;To accecss this encrypted repository from another machine (e.g. a desktop PC), first setup the gpg key on such machine, then clone and decrypt the repository:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;desktop$ git clone gcrypt::rsync://server_hostname/path/to/myrepo-remote myrepo
Cloning into &amp;#39;myrepo&amp;#39;...
gcrypt: Decrypting manifest
gpg: Good signature from &amp;#34;omnirepo (annex)&amp;#34; [unknown]
gcrypt: Remote ID is :id:XXX
Receiving objects: 100% (5/5), done.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Sync command will also work on the new machine for sending modified files to the remote:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;desktop$ git annex sync --content
commit 
[master cec51a4] git-annex in XXX
 1 file changed, 1 insertion(+)
ok
pull origin 
gcrypt: Decrypting manifest
ok
push origin 
gcrypt: Decrypting manifest
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Compressing objects: 100% (4/4), done.
Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
gcrypt: Encrypting to: --throw-keyids --default-recipient-self
gcrypt: Requesting manifest signature
To gcrypt::rsync://server_hostname/path/to/myrepo-remote
   bbed528..cec51a4  master -&amp;gt; synced/master
   c387409..575869a  git-annex -&amp;gt; synced/git-annex
ok
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;troubleshooting&#34;&gt;
  Troubleshooting
  &lt;a class=&#34;anchor&#34; href=&#34;#troubleshooting&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;h4 id=&#34;cannot-write-to-annex-file&#34;&gt;
  Cannot write to annex file
  &lt;a class=&#34;anchor&#34; href=&#34;#cannot-write-to-annex-file&#34;&gt;#&lt;/a&gt;
&lt;/h4&gt;
&lt;p&gt;Annexed file is set to readonly (locked) to prevent accidental modification, run &lt;code&gt;git annex unlock locked_file&lt;/code&gt; to unlock the file first.&lt;/p&gt;
&lt;h4 id=&#34;remove-unwanted-remote&#34;&gt;
  Remove Unwanted Remote
  &lt;a class=&#34;anchor&#34; href=&#34;#remove-unwanted-remote&#34;&gt;#&lt;/a&gt;
&lt;/h4&gt;
&lt;p&gt;git-annex manages its remotes via git, to delete a remote, run &lt;code&gt;git remote remove oldremote&lt;/code&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Make you own 3.5mm serial cable</title>
      <link>https://segments.zhan.science/posts/make_your_own_3.5mm_serial_cable/</link>
      <pubDate>Thu, 17 Aug 2023 00:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/make_your_own_3.5mm_serial_cable/</guid>
      <description>&lt;p&gt;Doing anything close to the kernel/bootloader on PinePhone almost always requires a serial cable, Pine64 store has &lt;a href=&#34;https://pine64.com/product/pinebook-pinephone-pinetab-serial-console/&#34;&gt;premade serial cable&lt;/a&gt; available for 7$ USD, but making your own serial cable can be both cheaper and more flexible as a DIY cable can support multiple logic level and pinout configuration.&lt;/p&gt;
&lt;h2 id=&#34;parts-overview&#34;&gt;
  Parts Overview
  &lt;a class=&#34;anchor&#34; href=&#34;#parts-overview&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;You will need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A 3.5mm audio cable, I got mine from a pair of broken headphone&lt;/li&gt;
&lt;li&gt;A multimeter for continuity test&lt;/li&gt;
&lt;li&gt;A USB-Serial adapter, you can get one online for around 3$ USD, make sure it supports 3.3v logic level if you want to use it with PinePhone&lt;/li&gt;
&lt;li&gt;3 &lt;a href=&#34;https://en.wikipedia.org/wiki/Jump_wire&#34;&gt;jump wires&lt;/a&gt;, for TX/RX/GND. Make sure those cables have &lt;a href=&#34;https://upload.wikimedia.org/wikipedia/commons/thumb/c/c4/JUMP-40-FF_03_%2814337822984%29.jpg/640px-JUMP-40-FF_03_%2814337822984%29.jpg&#34;&gt;female endings&lt;/a&gt; for connecting to serial adapter&lt;/li&gt;
&lt;li&gt;(Optional) Soldering iron, some flux core solder and heat shrink tubing for making proper connection. You can skip this and instead use twisted wires and electrical tape to make connection&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;make-connection&#34;&gt;
  Make Connection
  &lt;a class=&#34;anchor&#34; href=&#34;#make-connection&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;The serial pinout of PinePhone is available from &lt;a href=&#34;https://wiki.pine64.org/index.php/PinePhone#Serial_console&#34;&gt;this Pine64 Wiki wiki&lt;/a&gt;, to put it simply:&lt;/p&gt;
&lt;p&gt;If your 3.5mm plug has 3 rings:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;|=|=|=|)   &amp;lt;-Plug Tip 
 | | |_RX
 | |_Tx
 GND

Tip Ring (rightmost): Rx
Middle Ring: Tx
Last (Leftmost): GND
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If your 3.5mm plug has 4 rings:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;|=|=|=|=|)  &amp;lt;-Plug Tip
 | | | |_RX
 | | |_Tx
 | -GND
 ^---- Not used

Tip Ring (rightmost): Rx
Middle Ring: Tx
Second Middle Ring: GND
Last (leftmost): Unused
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;With the pinout in mind, cut the headphone cable open and split the wires inside, for a cable with 3 rings there should be 3 seperate wires, and 4 if that&amp;rsquo;s a 4 ring plug.&lt;/p&gt;
&lt;p&gt;Next, remove about 1cm of the isolation layer for each wire, and then use multimeter&amp;rsquo;s continuity test mode to find out which wire corresponds to which serial pin, it&amp;rsquo;s likely a good idea to label each wire with pin name at this stage.&lt;/p&gt;
&lt;p&gt;Then, cut a jump wire open, strip about 1cm of the isolation layer like with the headphone cable, and twist it together with a wire from the headphone cable, repeat this process 3 times for Tx/Rx/GND (There are &lt;a href=&#34;https://www.youtube.com/results?search_query=twist&amp;#43;wire&amp;#43;together&#34;&gt;many videos on YouTube&lt;/a&gt; on this topic). You can also use soldering iron to make stronger.&lt;/p&gt;
&lt;p&gt;After finish, test continuity again with multimeter to ensure every wire is properly connected, then protect the joint with electrical tape or heat shrink tubing (which needs to be put on before making connection).&lt;/p&gt;
&lt;p&gt;Now the only step left is connecting the jump wire to the serial adapter. Since the PinePhone and the serial adapter are both considered host device, a cross-over connection is required, so what is transmitted can be received on the other side:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;---------------      ----------------
serial    Tx  |------| Rx   headphone
adapter   Rx  |------| Tx   cable
side      GND |------| GND  side          
---------------      ----------------
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;connect-to-serial-console&#34;&gt;
  Connect to serial console
  &lt;a class=&#34;anchor&#34; href=&#34;#connect-to-serial-console&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Flip the DIP switch 6 (the rightmost, labeled Headphone) on the PinePhone to enable serial access, connect the newly made cable to the PinePhone and a computer, then use any serial console tool to open a session. The following example uses cu(1) on OpenBSD but screen(1) and minicom(1) should also work.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ doas cu -s 115200 -l /dev/cuaU0
&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>OpenBSD on PinePhone Pro: First Impression</title>
      <link>https://segments.zhan.science/posts/first_impression_openbsd_on_pinephone_pro/</link>
      <pubDate>Tue, 15 Aug 2023 00:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/first_impression_openbsd_on_pinephone_pro/</guid>
      <description>&lt;h2 id=&#34;disclaimer&#34;&gt;
  Disclaimer
  &lt;a class=&#34;anchor&#34; href=&#34;#disclaimer&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;OpenBSD does not support PinePhone Pro yet and there are real risks involved in running it on your PinePhone Pro now, as such, I &lt;strong&gt;do not&lt;/strong&gt; recommand anyone to do that. You might fry your device due to unsupported power management IC and in a worse case the battery might catch fire due to unconfigured/untested charging safety features.&lt;/p&gt;
&lt;p&gt;The purpose of this post is to document how to install OpenBSD on arm64 platforms not fully supported by OpenBSD, and much of this post is not PinePhone-specific, if you intend to follow what documented here, please be mindful about the risks and apply common sense.&lt;/p&gt;
&lt;h2 id=&#34;overview&#34;&gt;
  Overview
  &lt;a class=&#34;anchor&#34; href=&#34;#overview&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;OpenBSD installer cannot be used on bare metal if you want to install OpenBSD to an sdcard, because of insufficiant hardware support. However, it&amp;rsquo;s possible to install OpenBSD to a virtual machine and then transfer the installed system to a SD card to boot from&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;This post assumes you have a PinePhone Pro running Mobian with KVM properly configured, and an sdcard to transfer the installed system to&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;As for now the only way to interact with the running system is via a serial console cable, wired and wireless network are not supported, same for screen, keyboard, and USB host mode&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Jump to &lt;a href=&#34;#support-status&#34;&gt;Support Status&lt;/a&gt;  to see what work (not much)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;prepare-disk-image&#34;&gt;
  Prepare Disk Image
  &lt;a class=&#34;anchor&#34; href=&#34;#prepare-disk-image&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;To make full use of the sdcard, we will create a disk image with size equal to our sdcard. We can find precise size of the sdcard with &lt;code&gt;fdisk&lt;/code&gt; on Mobian:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;mobian$ echo p | sudo fdisk /dev/mmcblk1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;A line similar to above should appear, showing the size of sdcard in bytes:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Disk /dev/mmcblk1: 29.72 GiB, 31914983424 bytes, 62333952 sectors
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;We can now create our disk image:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;mobian$ qemu-img create -f qcow2 openbsd.vm.qcow2 31914983424
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;bootstrap-via-virtual-machine&#34;&gt;
  Bootstrap via virtual machine
  &lt;a class=&#34;anchor&#34; href=&#34;#bootstrap-via-virtual-machine&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Installing OpenBSD on VM is relatively strightforward, get the minirootXX.img from &lt;a href=&#34;https://cdn.openbsd.org/pub/OpenBSD/snapshots/arm64/&#34;&gt;OpenBSD mirror&lt;/a&gt; (at the moment I&amp;rsquo;m using &lt;code&gt;miniroot73.img&lt;/code&gt;), and follow instruction from &lt;a href=&#34;https://segments.zhan.science/posts/kvm_on_pinehone_pro/&#34;&gt;my other post&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;add-support-files&#34;&gt;
  Add support files
  &lt;a class=&#34;anchor&#34; href=&#34;#add-support-files&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;A freshly installed OpenBSD/arm64 VM is not bootable on bare metal, to make it bootable, we will need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Device Tree Blob (DTB) for PinePhone Pro, which describes the hardware environment
&lt;ul&gt;
&lt;li&gt;OpenBSD&amp;rsquo;s dtb package is compiled from Linux source tree, you can see how it is compiled &lt;a href=&#34;https://marc.info/?l=openbsd-arm&amp;amp;m=168906116326753&amp;amp;w=2&#34;&gt;here&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Support files for uboot, extracted from installer image&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;(I&amp;rsquo;m not sure if all the uboot files are needed, but it&amp;rsquo;s easy to extract them all)&lt;/p&gt;
&lt;p&gt;This can be done from the VM we prepared:&lt;/p&gt;
&lt;h3 id=&#34;create-mount-point-for-operating-on-disk-image&#34;&gt;
  Create mount point for operating on disk image
  &lt;a class=&#34;anchor&#34; href=&#34;#create-mount-point-for-operating-on-disk-image&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;vm# mkdir /mnt/{img,disk}
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;prepare-dtb-and-installer-image&#34;&gt;
  Prepare dtb and installer image
  &lt;a class=&#34;anchor&#34; href=&#34;#prepare-dtb-and-installer-image&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;vm# pkg_add dtb
vm# ftp https://cdn.openbsd.org/pub/OpenBSD/snapshots/arm64/miniroot73.img
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;prepare-and-mount-boot-partition-of-installer-image&#34;&gt;
  Prepare and mount boot partition of installer image
  &lt;a class=&#34;anchor&#34; href=&#34;#prepare-and-mount-boot-partition-of-installer-image&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;vm# vnconfig vnd0 miniroot73.img
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;vm# mount /dev/vnd0i /mnt/img/
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;mount-vm-boot-partition&#34;&gt;
  Mount VM boot partition
  &lt;a class=&#34;anchor&#34; href=&#34;#mount-vm-boot-partition&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;vm# mount /dev/sd0i /mnt/disk/
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;copy-files-from-installer-boot-partition-to-vm-boot-partition&#34;&gt;
  Copy files from installer boot partition to VM boot partition
  &lt;a class=&#34;anchor&#34; href=&#34;#copy-files-from-installer-boot-partition-to-vm-boot-partition&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;vm# cp -r /mnt/img/* /mnt/disk/
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;copy-dtb&#34;&gt;
  Copy DTB
  &lt;a class=&#34;anchor&#34; href=&#34;#copy-dtb&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;vm# cp /usr/local/share/dtb/arm64/rockchip/rk3399-pinephone-pro.dtb /mnt/disk/
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;clean-up&#34;&gt;
  Clean up
  &lt;a class=&#34;anchor&#34; href=&#34;#clean-up&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;vm# umount /mnt/disk/
vm# umount /mnt/img/
vm# vnconfig -u vnd0
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;disable-ohci&#34;&gt;
  Disable ohci
  &lt;a class=&#34;anchor&#34; href=&#34;#disable-ohci&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;ohci controller is not yet supported by OpenBSD on this device, and the existing driver can prevent the kernel from booting, before the root problem is addressed, we can disable ohci driver in kernel to workaround this.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;vm# config -ef /bsd                                                                                                         
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;ukc&amp;gt; find ohci                                                                                                              
167 ohci* at pci* dev -1 function -1 flags 0x0                                                                              
236 ohci* at apldc*|agintc*|ampintc*|qcdwusb*|imxsrc*|imxdwusb*|mvmdio*|rktcphy*|rkpinctrl*|rkgrf*|rkdwusb*|hidwusb*|amldwus
b*|syscon*|sxisyscon*|simplebus*|mainbus0 early 0 flags 0x0                                                                 
413 ohci* at acpi0 addr -1 flags 0x0                                                                                        
ukc&amp;gt; disable 236                                                                                                            
236 ohci* disabled                                                                                                          
ukc&amp;gt; quit                                                     
Saving modified kernel.               

vm# shutdown -hp now
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;write-image-to-sd-card&#34;&gt;
  Write image to SD card
  &lt;a class=&#34;anchor&#34; href=&#34;#write-image-to-sd-card&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Make sure you VM is properly shutdown, and your sdcard is at &lt;code&gt;/dev/mmcblk1&lt;/code&gt;, then write the VM image to the sdcard.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;mobian$ sudo qemu-img dd -f qcow2 -O raw if=openbsd.vm.qcow2 of=/dev/mmcblk1 bs=20M
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;boot-openbsd-from-tow-boot&#34;&gt;
  Boot OpenBSD from Tow-boot
  &lt;a class=&#34;anchor&#34; href=&#34;#boot-openbsd-from-tow-boot&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;To boot OpenBSD from the sdcard with Tow-boot:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Insert sdcard into PinePhone Pro&lt;/li&gt;
&lt;li&gt;Then flip the DIP switch 6 (the rightmost, labeled Headphone) to enable serial access&lt;/li&gt;
&lt;li&gt;Connect a serial cable and open a console session, the example uses cu(1) since I&amp;rsquo;m using OpenBSD, but minicom can also work, towboot uses 115200 as baudrate but other u-boot build might differ&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ doas cu -s 115200 -l /dev/cuaU0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Something similar to the following output can help you confirm your serial connection is working:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;U-Boot TPL 2021.10 (Oct 04 2021 - 15:09:26)                                                         
Channel 0: LPDDR4, 50MHz                                                                            
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB                                  
Channel 1: LPDDR4, 50MHz                                                                            
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB                                  
256B stride                                                                                         
lpddr4_set_rate: change freq to 400000000 mhz 0, 1                                                  
lpddr4_set_rate: change freq to 800000000 mhz 1, 0                                                  
Trying to boot from BOOTROM                                                                         
Returning to boot ROM...   
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;Repeatedly press ESC to trigger tow-boot&amp;rsquo;s boot menu, select &lt;code&gt;Boot from SD&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;                          Boot from eMMC                                        
                          Boot from SD                                          
                          Boot from USB                                         
                          Boot from PXE                                         
                          Boot from DHCP                                        
                          Boot from (sf0)                                       
                                                                                
                          Rescan USB                                            
                          Firmware Console                                      
                                                                                
                          Reboot                                                
                          Shutdown                                              
                         _          
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;Something silmilar to the following should indicate OpenBSD is booting, and a login prompt will appear soon&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;boot&amp;gt;                                                                                               
booting sd0a:/bsd: 10625552+2504232+292520+843464 [792195+91+1216848+729496]=0x13b2240
[ using 2739408 bytes of bsd ELF symbol table ]                                                     
Copyright (c) 1982, 1986, 1989, 1991, 1993                                                          
        The Regents of the University of California.  All rights reserved.                          
Copyright (c) 1995-2023 OpenBSD. All rights reserved.  https://www.OpenBSD.org                      
                                                  
OpenBSD 7.3-current (GENERIC.MP) #2182: Thu Jul  6 15:02:37 MDT 2023                                
    deraadt@arm64.openbsd.org:/usr/src/sys/arch/arm64/compile/GENERIC.MP                            
real mem  = 4088885248 (3899MB)                                                                     
avail mem = 3883520000 (3703MB)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;support-status&#34;&gt;
  Support status
  &lt;a class=&#34;anchor&#34; href=&#34;#support-status&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th style=&#34;text-align:center&#34;&gt;State&lt;/th&gt;
&lt;th style=&#34;text-align:right&#34;&gt;Note&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Screen&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;No&lt;/td&gt;
&lt;td style=&#34;text-align:right&#34;&gt;Screen lights up but no signal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;USB Host&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;No&lt;/td&gt;
&lt;td style=&#34;text-align:right&#34;&gt;USB port is not powered&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Built-in EMMC&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;Yes&lt;/td&gt;
&lt;td style=&#34;text-align:right&#34;&gt;sd1 at scsibus1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SD Card&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;Yes&lt;/td&gt;
&lt;td style=&#34;text-align:right&#34;&gt;sd0 at scsibus0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WIFI&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;No&lt;/td&gt;
&lt;td style=&#34;text-align:right&#34;&gt;bwfm0 at sdmmc0 needs brcmfmac43455-sdio.pine64,pinephone-pro.bin, loading this can lead to kernel crash&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sensors&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;Partial&lt;/td&gt;
&lt;td style=&#34;text-align:right&#34;&gt;GPU/CPU temperature is reported by rktemp(4), no other sensor detected&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CPU&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;Yes&lt;/td&gt;
&lt;td style=&#34;text-align:right&#34;&gt;All 6 CPU cores are detected and run fine with MP kernel&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Power off&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;No&lt;/td&gt;
&lt;td style=&#34;text-align:right&#34;&gt;Cannot power down system&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reboot&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;Yes&lt;/td&gt;
&lt;td style=&#34;text-align:right&#34;&gt;Reboot from OpenBSD works&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Modem/other usb devices&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;No&lt;/td&gt;
&lt;td style=&#34;text-align:right&#34;&gt;Internal USB bus doesn&amp;rsquo;t seem to work&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;dmesg&#34;&gt;
  dmesg
  &lt;a class=&#34;anchor&#34; href=&#34;#dmesg&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Full dmesg and other hardware info is available from &lt;a href=&#34;https://marc.info/?l=openbsd-arm&amp;amp;m=168906116326753&amp;amp;w=2&#34;&gt;PinePhone Pro installation report&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Virtualization with KVM on the PinePhone Pro</title>
      <link>https://segments.zhan.science/posts/kvm_on_pinehone_pro/</link>
      <pubDate>Fri, 23 Jun 2023 00:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/kvm_on_pinehone_pro/</guid>
      <description>&lt;h2 id=&#34;basic-setup&#34;&gt;
  Basic Setup
  &lt;a class=&#34;anchor&#34; href=&#34;#basic-setup&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;All the tools we need for running VM are already packaged on Mobian, to install them, run:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo apt install virt-manager
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;then add your user to the libvirt group:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo adduser mobian libvirt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Reboot and then run &lt;code&gt;virt-host-validate&lt;/code&gt;, it should indicate /dev/kvm exists and is accessible.&lt;/p&gt;
&lt;h2 id=&#34;trouble-with-heterogeneous-architecture&#34;&gt;
  Trouble with Heterogeneous Architecture
  &lt;a class=&#34;anchor&#34; href=&#34;#trouble-with-heterogeneous-architecture&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Trying to start &lt;code&gt;qemu-system-aarch64&lt;/code&gt; with &lt;code&gt;-enable-kvm&lt;/code&gt; flag can yield the following, rather unhelpfully worded error:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;qemu-system-aarch64: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argument
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Turns out the RK3399s SoC used on this device is built around Arm&amp;rsquo;s heterogeneous big.Little architecture, and contains 4 slower Cortex A53 cores and 2 faster Cortex A72 cores, this allows the kernel to dynamically schedule tasks on different types of cores to improve performance and save energy. However, this configuration is not yet supported by KVM, and when the expected CPU type differs from the scheduled type (e.g. expecting A72 but kernel scheduled a process on an A53 core), it will panic.&lt;/p&gt;
&lt;p&gt;Before KVM is able to work with this setup, we can workaround it by manually set the CPU affinity of qemu by launching it with taskset. To only use A72 cores:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;taskset -c 4,5 qemu-system-aarch64 &amp;lt;qemu options&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To only use the slower A53 cores:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;taskset -c 0,1,2,3 qemu-system-aarch64 &amp;lt;qemu options&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To apply this workaround globally, we need a wrapper.&lt;/p&gt;
&lt;h3 id=&#34;dpkg-divert&#34;&gt;
  dpkg-divert
  &lt;a class=&#34;anchor&#34; href=&#34;#dpkg-divert&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;Simply replacing the qemu-system-aarch64 binary with a wrapper is not a great idea because upstream Debian package can override our warpper when upgrading qemu. To ensure Debian will not override it, we can divert package&amp;rsquo;s version of the binary to another location with &lt;code&gt;dpkg-divert&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo dpkg-divert --rename /usr/bin/qemu-system-aarch64
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The &lt;code&gt;--rename&lt;/code&gt; option ensures the existing binary will be moved to a new name, which by default is &lt;code&gt;qemu-system-aarch64.distrib&lt;/code&gt;. Finally, create the wrapper under &lt;code&gt;usr/bin/qemu-system-aarch64&lt;/code&gt; (I decide to only use faster cores, A53 cores are too slow for most workload):&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;#!/usr/bin/env sh
taskset -c 4,5 /usr/bin/qemu-system-aarch64.distrib &amp;#34;$@&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;launching-vm&#34;&gt;
  Launching VM
  &lt;a class=&#34;anchor&#34; href=&#34;#launching-vm&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;The following scripts will launch VM of different BSD OS, doing the same for Linux distros is similar. I&amp;rsquo;m using [user networking (SLIRP)][1] as network backend which does not require root privileges. This backend has the drawback of lower performance compare to TAP or VDE, but still fast enough for me.&lt;/p&gt;
&lt;h3 id=&#34;openbsd&#34;&gt;
  OpenBSD
  &lt;a class=&#34;anchor&#34; href=&#34;#openbsd&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;Setup&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;mkdir openbsd.vm
cd openbsd.vm
# create disk image
qemu-img create -f qcow2 openbsd.vm.qcow2 32G
# use arm64 uefi firmware from package qemu-efi-aarch64
cp /usr/share/AAVMF/AAVMF_CODE.fd ./
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Boot to installer&lt;/p&gt;
&lt;p&gt;Assume using &lt;code&gt;miniroot73.img&lt;/code&gt; as installer, &lt;code&gt;-smp&lt;/code&gt; is needed for installer to enable MP kernel.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;qemu-system-aarch64 \
        -enable-kvm \
        -m 1024 \
        -cpu host -M virt \
        -nographic \
        -drive if=pflash,file=aavmf_code.fd,format=raw \
        -drive if=virtio,file=miniroot73.img,format=raw \
        -drive if=virtio,file=openbsd.vm.qcow2,format=qcow2 \
        -netdev user,id=obsd \
        -device virtio-net,netdev=obsd \
        -smp 2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Launch VM&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;qemu-system-aarch64 \
        -enable-kvm \
        -m 1024 \
        -cpu host -M virt \
        -nographic \
        -drive if=pflash,file=aavmf_code.fd,format=raw \
        -drive if=virtio,file=openbsd.vm.qcow2,format=qcow2 \
        -netdev user,id=obsd \
        -device virtio-net,netdev=obsd \
        -smp 2
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;netbsd&#34;&gt;
  NetBSD
  &lt;a class=&#34;anchor&#34; href=&#34;#netbsd&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;Setup&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;mkdir netbsd.vm
cd netbsd.vm
# use arm64 uefi firmware from package qemu-efi-aarch64
cp /usr/share/AAVMF/AAVMF_CODE.fd ./
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Launch VM&lt;/p&gt;
&lt;p&gt;NetBSD provides ready to boot image for arm64, the daily snapshot is available at:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;https://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/latest/evbarm-aarch64/binary/gzimg/arm64mbr.img.gz
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;qemu-system-aarch64 \
        -enable-kvm \
        -m 1024 \
        -cpu host -M virt \
        -nographic \
        -drive if=pflash,file=aavmf_code.fd,format=raw \
        -drive if=virtio,file=arm64mbr.img,format=raw \
        -netdev user,id=nbsd \
        -device virtio-net,netdev=nbsd \
        -smp 2
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;virt-manager-and-arm64-uefi-secure-boot&#34;&gt;
  virt-manager and arm64 UEFI secure boot
  &lt;a class=&#34;anchor&#34; href=&#34;#virt-manager-and-arm64-uefi-secure-boot&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Virt-manager seems to use secure boot enabled firmware by default when creating new VM, this might not work for your prefered system (It certainly does not work with OpenBSD) and will yield a &lt;code&gt;Script Error Status: Access Denied&lt;/code&gt; error for unsupported install media. To disable secure boot, select &lt;code&gt;Customize configuration before install&lt;/code&gt; during the last step of creating new VM, go to &lt;code&gt;Overview&lt;/code&gt; section, and change the firmware from &lt;code&gt;AAVMF_CODE.ms.fd&lt;/code&gt; to &lt;code&gt;UEFI aarch64: /usr/share/AAVMF/AAVMF_CODE.fd&lt;/code&gt;. This cannot be changed easily after VM is created.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>A week with Mobian on PinePhone Pro</title>
      <link>https://segments.zhan.science/posts/one_week_with_mobian/</link>
      <pubDate>Thu, 15 Jun 2023 00:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/one_week_with_mobian/</guid>
      <description>&lt;p&gt;It&amp;rsquo;s been a bit more than a week since I start daily driving the PinePhone Pro with Mobian, some parts of my journey are documented here.&lt;/p&gt;
&lt;h2 id=&#34;ime-and-keyboard&#34;&gt;
  IME and Keyboard
  &lt;a class=&#34;anchor&#34; href=&#34;#ime-and-keyboard&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Both Phosh and Plasma provide their own work flow for setting up IME and adding extra language support, but so far I&amp;rsquo;m unable to get Phosh&amp;rsquo;s ibus-based input system to work with PinYin when using on-screen keyboard. I&amp;rsquo;m able to install PinYin and Anthy from Phosh&amp;rsquo;s software center, but those methods only work when used with external keyboard, switching to either of those from on-screen keyboard makes no difference when typing.&lt;/p&gt;
&lt;p&gt;Plasma Mobile uses &lt;a href=&#34;https://maliit.github.io/&#34;&gt;Maliit framework&lt;/a&gt; for on-screen keyboard, a small set of additional input methods including Chinese (PinYin) can be configured from Mobile Plasma Settings -&amp;gt; On-Screen Keyboard -&amp;gt; Configure Languages, then run im-config to make sure maliit is selected. After doing so it works mostly as expected.&lt;/p&gt;
&lt;h2 id=&#34;battery-life&#34;&gt;
  Battery Life
  &lt;a class=&#34;anchor&#34; href=&#34;#battery-life&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;A fully charged battery provides around 1.5 hours of use time consisting of light web browsering via LTE network and messaging, anything intense like watching Youtube via Firefox can drain the battery within 30 minutes. In order to daily drive it, I always attach it to the &lt;a href=&#34;https://wiki.pine64.org/wiki/PinePhone_%28Pro%29_Keyboard&#34;&gt;PinePhone Keyboard&lt;/a&gt; which triples the battery life, combining with power saving tweaks (lowering screen brightness, disable wireless when not in use&amp;hellip;), it&amp;rsquo;s possible to get 8 hours of run time, which is good enough for me.&lt;/p&gt;
&lt;p&gt;At the moment of writing, Pine64 does not sell battery pack, but &lt;a href=&#34;https://old.reddit.com/r/PINE64official/comments/kcof97/pinephone_replacement_battery_found_and_tested/&#34;&gt;someone at Reddit finds out&lt;/a&gt; it&amp;rsquo;s possible to use Samsung&amp;rsquo;s EB-BJ700BBC battery pack (designed for Galaxy J7) on PinePhone, as PinePhone Pro uses the same battery as PinePhone, it should also work on my device, but I haven&amp;rsquo;t tested it. Pine64 is also said to be &lt;a href=&#34;https://www.pine64.org/2020/05/15/may-update-pinetab-pre-orders-pinephone-qi-charging-more/&#34;&gt;exploring a case with extended battery&lt;/a&gt; in 2020, but I haven&amp;rsquo;t heard any update on that.&lt;/p&gt;
&lt;p&gt;I also experienced a few cases of battery not charging despite being connected to the power supply, in such cases the phone will display a very small current draw from the battery. Maybe that&amp;rsquo;s due to a bug between the OS and the &lt;a href=&#34;https://rockchip.fr/RK818%20datasheet%20V1.0.pdf&#34;&gt;RK818 PMIC chip&lt;/a&gt; but I haven&amp;rsquo;t dive deep enough to find the root cause.&lt;/p&gt;
&lt;h2 id=&#34;scale&#34;&gt;
  Scale
  &lt;a class=&#34;anchor&#34; href=&#34;#scale&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;The default display scale is set to 200% under Phosh and similarly high under Plasma Mobile, which might be optimal for touch-focused usage, but is certainly not usable with most desktop applications in landscape mode, for example, Firefox won&amp;rsquo;t display application manu unless I lower the scale to 125%. Many application (e.g. Mumble) would not function correctly with anything higher than 125%, with most controls outside of display area and overflowing text. As such, I set both Phosh and Plasma Mobile to use 125% scale.&lt;/p&gt;
&lt;h2 id=&#34;messaging&#34;&gt;
  Messaging
  &lt;a class=&#34;anchor&#34; href=&#34;#messaging&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id=&#34;install-fluffychat-via-flatpak&#34;&gt;
  Install fluffychat via Flatpak
  &lt;a class=&#34;anchor&#34; href=&#34;#install-fluffychat-via-flatpak&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;I hardly use instant messaging, even less so on mobile devices because I find laptop to perform much better for reading and writing, but maybe the existence of Matrix can change this. As for now, I use &lt;a href=&#34;https://fluffychat.im/&#34;&gt;fluffychat&lt;/a&gt; as my Matrix client. It&amp;rsquo;s not packaged for debian yet, so I decide to install it via flatpak, which seems to be the least intrusive method:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# setup flatpak
apt install flatpak

# optional: use flatpak plugin for Gnome Software manager
apt install gnome-software-plugin-flatpak

# setup flatpak repository
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

# install fluffychat
flatpak install im.fluffychat.Fluffychat
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After using it for a few days I think it&amp;rsquo;s by far the most usable messaging software I tried on mobile.&lt;/p&gt;
&lt;h3 id=&#34;sms-and-mms-apn-setting&#34;&gt;
  SMS and MMS APN Setting
  &lt;a class=&#34;anchor&#34; href=&#34;#sms-and-mms-apn-setting&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;SMS works out of the box, bidirectional messaging is possible and no configuration is required. On the other hand, Mobian doesn&amp;rsquo;t seem to autoconfigure the APN (Access Point Name) for MMS (Multimedia Messaging Service) globally, but both Spacebar (chat client from Plasma Mobile) and Gnome Chatty allow users to set custom MMS APN manually. Most mobile service provides will provide this information on their website, I find mine by searching &lt;code&gt;Provider Name + MMS APN&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;With the same correct APN setup for Spacebar and Gnome Chatty, only Chatty seems to work properly in terms of bidirectional image transfer, Spacebar would attempt to download the media file then fail instantly.&lt;/p&gt;
&lt;h2 id=&#34;network-sharing&#34;&gt;
  Network Sharing
  &lt;a class=&#34;anchor&#34; href=&#34;#network-sharing&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;The mobile LTE connection can be shared to other devices either wirelessly or via USB cable.&lt;/p&gt;
&lt;h3 id=&#34;setup-wireless-hotspot-from-gui&#34;&gt;
  Setup Wireless Hotspot from GUI
  &lt;a class=&#34;anchor&#34; href=&#34;#setup-wireless-hotspot-from-gui&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;Hotspot management is inside Settings -&amp;gt; Hotspot under Plasma mobile and Settings -&amp;gt; WiFi -&amp;gt; &amp;ldquo;Turn on WiFi Hotspot&amp;rdquo; under dots menu. Plasma&amp;rsquo;s wizard default to using WEP encryption with no way of changing it to more secure WPA2/3 but Gnome&amp;rsquo;s wizard does the right thing and default to WPA2. You might want to turn off auto sleep under Phosh Settings -&amp;gt; Power -&amp;gt; Automatic Suspend, otherwise your hotspot will be turn off after a 5 minutes timeout.&lt;/p&gt;
&lt;h3 id=&#34;setup-wireless-hotspot-with-nmcli1&#34;&gt;
  Setup Wireless Hotspot with nmcli(1)
  &lt;a class=&#34;anchor&#34; href=&#34;#setup-wireless-hotspot-with-nmcli1&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;Doing things from GUI is not always desirable, and if you prefer cli, there is &lt;a href=&#34;https://linux.die.net/man/1/nmcli&#34;&gt;nmcli(1)&lt;/a&gt; available:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# setup hotspot
nmcli device wifi hotspot

# show password and SSID
nmcli dev wifi show-password
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;usb-ethernet&#34;&gt;
  USB Ethernet
  &lt;a class=&#34;anchor&#34; href=&#34;#usb-ethernet&#34;&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;PinePhone supports USB Host-to-Host bridges with ethernet subclass, it attaches to my OpenBSD laptop as a cede(4) device and my Debian laptop as an usb0 network interface using &lt;code&gt;cdc_ether&lt;/code&gt; driver.  To enable routing through it:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# turn on frame forward
sysctl net.ipv4.ip_forward=1

# install and enable nftables for forwarding
apt install nftables
systemctl enable nftables.service

# create a table
nft add table nat

# add the prerouting and postrouting chains
# this is required by the nftables framework for NAT
nft -- add chain nat prerouting { type nat hook prerouting priority -100 \; }
nft add chain nat postrouting { type nat hook postrouting priority 100 \; }

# enable masquerade NAT with upstream being wwan0
nft add rule nat postrouting oifname &amp;#34;wwan0&amp;#34; masquerade
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can replace &lt;code&gt;wwan0&lt;/code&gt; with other upstream you wish to use. (e.g. wg0)&lt;/p&gt;
&lt;p&gt;Then set the default gateway of your client device to PinePhone&amp;rsquo;s usb0 IP address and traffic should start to flow, in my case:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;ip route add default via 10.66.0.1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;See &lt;a href=&#34;https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/sec-configuring_nat_using_nftables&#34;&gt;this article from RedHat&lt;/a&gt; for setting up different type of NAT with nftables.&lt;/p&gt;
&lt;p&gt;For adhoc network sharing, socks proxy over ssh might be simpler to setup than NAT.&lt;/p&gt;
&lt;h2 id=&#34;bluetooth-audio&#34;&gt;
  Bluetooth Audio
  &lt;a class=&#34;anchor&#34; href=&#34;#bluetooth-audio&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Bluetooth audio connections mostly work fine with Phosh&amp;rsquo;s setting panel with the exception of bluetooth low-energy protocol, which doesn&amp;rsquo;t seem to pair properly, I&amp;rsquo;m not sure if this is hardware issue or a software one. After the audio device is connected, it&amp;rsquo;s necessary to manually select it as the default output device, otherwise audio stream will continue to play with the internal speaker. Multiple codecs/profiles exist and can be switched on the fly, SBC/SBC-XQ/LDAC all work reasonably well with no difference in sound quality compare to Android devices as far as I can tell, however any profile making use of microphone will cause extremely bad audio play back quality.&lt;/p&gt;
&lt;p&gt;If you cannot, or don&amp;rsquo;t want to run a bluetooth stack, it&amp;rsquo;s also possible to use a bluetooth audio adapter (like the Creative BT-W3 I used on my OpenBSD laptop, since OpenBSD doesn&amp;rsquo;t support bluetooth), such adapter can handle bluetooth codec logic in a dedicate hardware and present a generic audio output device to the OS, which also seems to help with audio jitter under high system load.&lt;/p&gt;
&lt;h2 id=&#34;epilogue&#34;&gt;
  Epilogue
  &lt;a class=&#34;anchor&#34; href=&#34;#epilogue&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;There are many things to be explored and wrote about, from virtualization (KVM for aarch64 should just work) to LoRa backplate, I&amp;rsquo;m not sure what the future of this device would look like, but it&amp;rsquo;s certainly an interesting one.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Mobian and Plasma Mobile on the PinePhone Pro</title>
      <link>https://segments.zhan.science/posts/mobian_pinephone_pro/</link>
      <pubDate>Tue, 06 Jun 2023 00:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/mobian_pinephone_pro/</guid>
      <description>&lt;h2 id=&#34;setup-tow-boot&#34;&gt;
  Setup Tow-boot
  &lt;a class=&#34;anchor&#34; href=&#34;#setup-tow-boot&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Mobian as of now requires Tow-boot bootloader to be installed first, u-boot is no longer supported. To install Tow-boot, see &lt;a href=&#34;https://github.com/Tow-Boot/Tow-Boot/blob/released/boards/pine64-pinephonePro/INSTALLING.md&#34;&gt;this document&lt;/a&gt;, I find it easier to plug in a usb cable to start the phone while holding down the RE button. Be mindful that there will be no graphical boot menu after installation, at the moment tow-boot menu is only available via serial connection.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s also possible you can skip this step, according to the &lt;a href=&#34;https://wiki.pine64.org/wiki/PinePhone_Pro&#34;&gt;PinePhone Pro wiki&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The batches bought after July 2022 come with Tow-Boot flashed to the SPI, which offers additional functionality over U-Boot as bootloader.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;setup-mobian&#34;&gt;
  Setup Mobian
  &lt;a class=&#34;anchor&#34; href=&#34;#setup-mobian&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Since I want to have full disk encrytion (FDE) for all my devices including this, I went with the Mobian installer image that gives me an option to enable FDE. The installation is fairly simple and smooth, taking only around 20 minutes start to finish with very few configure options, if you want to know what the process is like, Mobian wiki has &lt;a href=&#34;https://wiki.mobian-project.org/doku.php?id=install-linux&#34;&gt;an article&lt;/a&gt; with an overview of the installation process as well as links to different images.&lt;/p&gt;
&lt;h2 id=&#34;install-kde-plasma-mobile&#34;&gt;
  Install KDE Plasma Mobile
  &lt;a class=&#34;anchor&#34; href=&#34;#install-kde-plasma-mobile&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;By default Mobian ships with Phosh, a wayland shell for GNOME designed for mobile devices, it works OK, but I prefer KDE Plasma Mobile. Fortunately, Plasma mobile is packaged for Debian and can be installed via:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo apt update
sudo apt install plasma-mobile plasma-mobile-tweaks plasma-settings plasma-phonebook plasma-dialer spacebar angelfish okular-mobile
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The password for user &lt;code&gt;mobian&lt;/code&gt; is the same as the screen unlock password. After &lt;code&gt;apt&lt;/code&gt; done its job, logout current session and there should be an option to login again using Plasma.&lt;/p&gt;
&lt;h2 id=&#34;other-shell&#34;&gt;
  Other Shell
  &lt;a class=&#34;anchor&#34; href=&#34;#other-shell&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Apart from Phosh and Plasma, Swmo, Lomini (from Ubuntu Touch), Desktop Gnome as well as LXDE &lt;a href=&#34;https://wiki.mobian-project.org/doku.php?id=desktopenvironments&#34;&gt;are all available&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;current-state&#34;&gt;
  Current state:
  &lt;a class=&#34;anchor&#34; href=&#34;#current-state&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;I&amp;rsquo;ve been daily driving it for a few days, it most certinaly had a long way to go, but I can live with it as is.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th style=&#34;text-align:center&#34;&gt;State&lt;/th&gt;
&lt;th style=&#34;text-align:right&#34;&gt;Note&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Call&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;Yes&lt;/td&gt;
&lt;td style=&#34;text-align:right&#34;&gt;Poor audio quality heard by other side&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mobile Data&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;Yes&lt;/td&gt;
&lt;td style=&#34;text-align:right&#34;&gt;Plasma&amp;rsquo;s modem setting page cannot enable the modem, after doing it from a Phosh session it seems to be working, APN is autoconfigured&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SMS&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;Yes&lt;/td&gt;
&lt;td style=&#34;text-align:right&#34;&gt;No unified way of storing chat history, history does not sync between different applications&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Camera&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;Partial&lt;/td&gt;
&lt;td style=&#34;text-align:right&#34;&gt;Extremely high latency between frame (3s+), inaccurate color&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WiFi&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;Yes&lt;/td&gt;
&lt;td style=&#34;text-align:right&#34;&gt;Drop-off seems to be more common than other phones, but might just be an isolated case&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WiFi Hotspot&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;Yes&lt;/td&gt;
&lt;td style=&#34;text-align:right&#34;&gt;Plasma&amp;rsquo;s wizard default to WEP which is insecure and I cannot authenticate from other devices, but unprotected hotspot works&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bluetooth&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;No&lt;/td&gt;
&lt;td style=&#34;text-align:right&#34;&gt;Unable to connect to any paired device, seems to be a known issue&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;a href=&#34;https://wiki.pine64.org/wiki/PinePhone_Pro&#34;&gt;The PinePhone Pro Wiki page&lt;/a&gt; also has a list for hardware/software state.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Things I read this month</title>
      <link>https://segments.zhan.science/posts/rx-log-2305/</link>
      <pubDate>Thu, 18 May 2023 00:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/rx-log-2305/</guid>
      <description>&lt;p&gt;RetroBSD: a port of 2.11BSD Unix intended for embedded systems with fixed memory mapping.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/RetroBSD/retrobsd/wiki&#34;&gt;https://github.com/RetroBSD/retrobsd/wiki&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;This might be a good base to build on.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;DarkRiscV: a BSD-licensed RISC-V cpu core implemented in Verilog&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/darklife/darkriscv&#34;&gt;https://github.com/darklife/darkriscv&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;It implements most of the RISC-V RV32E and RV32I instruction set (missing &lt;code&gt;csr*&lt;/code&gt;, &lt;code&gt;e*&lt;/code&gt; and &lt;code&gt;fence*&lt;/code&gt;) and works fine on many low cost FPGA system.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
</description>
    </item>
    
    <item>
      <title>Initial setting for a thinkpad running OpenBSD</title>
      <link>https://segments.zhan.science/posts/thinkpad_openbsd_tricks/</link>
      <pubDate>Mon, 01 May 2023 00:00:00 +0000</pubDate>
      
      <guid>https://segments.zhan.science/posts/thinkpad_openbsd_tricks/</guid>
      <description>&lt;p&gt;Taken from ~/.xsession&lt;/p&gt;
&lt;h2 id=&#34;disable-system-beep&#34;&gt;
  Disable system beep
  &lt;a class=&#34;anchor&#34; href=&#34;#disable-system-beep&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-.xsession&#34; data-lang=&#34;.xsession&#34;&gt;xset b off
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;scrolling-by-dragging-with-the-middle-button-and-trackpoint&#34;&gt;
  Scrolling by dragging with the middle button and trackpoint
  &lt;a class=&#34;anchor&#34; href=&#34;#scrolling-by-dragging-with-the-middle-button-and-trackpoint&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-.xsession&#34; data-lang=&#34;.xsession&#34;&gt;xinput set-prop &amp;#34;/dev/wsmouse&amp;#34; &amp;#34;WS Pointer Wheel Emulation&amp;#34; 1 
xinput set-prop &amp;#34;/dev/wsmouse&amp;#34; &amp;#34;WS Pointer Wheel Emulation Button&amp;#34; 2 
xinput set-prop &amp;#34;/dev/wsmouse&amp;#34; &amp;#34;WS Pointer Wheel Emulation Axes&amp;#34; 6 7 4 5 
xinput set-prop &amp;#34;/dev/wsmouse&amp;#34; &amp;#34;WS Pointer Middle Button Emulation&amp;#34; 3
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;use-caps-lock-as-control-key&#34;&gt;
  Use Caps Lock as Control key
  &lt;a class=&#34;anchor&#34; href=&#34;#use-caps-lock-as-control-key&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-.xsession&#34; data-lang=&#34;.xsession&#34;&gt;setxkbmap -option ctrl:nocaps
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;remap-middle-button-to-perform-right-click&#34;&gt;
  Remap middle button to perform right click
  &lt;a class=&#34;anchor&#34; href=&#34;#remap-middle-button-to-perform-right-click&#34;&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;I find middle button to be easier to reach then the right button.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-.xsession&#34; data-lang=&#34;.xsession&#34;&gt;xinput set-button-map 7 1 3 3
&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    
  </channel>
</rss>
