<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	 xmlns:friends="wordpress-plugin-friends:feed-additions:1" >

<channel>
	<title>Gentoo Linux &#8211; Scott&#039;s Blog</title>
	<atom:link href="https://alfter.us/category/linux/gentoo-linux/feed/" rel="self" type="application/rss+xml" />
	<link>https://alfter.us</link>
	<description>Things that interest me</description>
	<lastBuildDate>Tue, 28 Nov 2023 21:13:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.5</generator>
<site xmlns="com-wordpress:feed-additions:1">230089306</site>	<item>
		<title>Cheatsheet: install debloated Windows 11 on QEMU</title>
		<link>https://alfter.us/2023/09/29/cheatsheet-install-debloated-windows-11-on-qemu/</link>
		
		<dc:creator><![CDATA[Scott Alfter]]></dc:creator>
		<pubDate>Fri, 29 Sep 2023 17:36:46 +0000</pubDate>
				<category><![CDATA[computers]]></category>
		<category><![CDATA[Gentoo Linux]]></category>
		<category><![CDATA[Windows]]></category>
		<guid isPermaLink="false">https://alfter.us/?p=9915</guid>

					<description><![CDATA[This pulls together tips from https://christitus.com/windows-11-perfect-install/, https://christitus.com/install-windows-the-arch-linux-way/, https://blogs.oracle.com/virtualization/post/install-microsoft-windows-11-on-virtualbox, and some other sources I&#8217;ve forgotten. It&#8217;s mainly aimed at getting Win11 running under QEMU on Gentoo Linux, but should also work for bare-metal installs, QEMU on other platforms, or other virtualization platforms (VMware, VirtualBox, etc.). More Win11-without-TPM/Secure Boot tricks https://nerdschalk.com/install-windows-11-without-tpm/ has several methods that might be [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>This pulls together tips from <a rel="noreferrer noopener" href="https://christitus.com/windows-11-perfect-install/" target="_blank">https://christitus.com/windows-11-perfect-install/</a>, <a rel="noreferrer noopener" href="https://christitus.com/install-windows-the-arch-linux-way/" target="_blank">https://christitus.com/install-windows-the-arch-linux-way/</a>, <a rel="noreferrer noopener" href="https://blogs.oracle.com/virtualization/post/install-microsoft-windows-11-on-virtualbox" target="_blank">https://blogs.oracle.com/virtualization/post/install-microsoft-windows-11-on-virtualbox</a>, and some other sources I&#8217;ve forgotten.  It&#8217;s mainly aimed at getting Win11 running under QEMU on Gentoo Linux, but should also work for bare-metal installs, QEMU on other platforms, or other virtualization platforms (VMware, VirtualBox, etc.).</p>



<ol class="wp-block-list">
<li>Verify kernel prerequisites as described in <a href="https://wiki.gentoo.org/wiki/QEMU" target="_blank" rel="noreferrer noopener">https://wiki.gentoo.org/wiki/QEMU</a></li>



<li>Install <code>app-emulation/qemu</code> and <code>app-emulation/libvirt</code></li>



<li>Start /etc/init.d/libvirtd, and add it to the default runlevel:<br><code>sudo rc-update add libvirtd</code> </li>



<li>Add yourself to the kvm group:<br><code>sudo usermod -aG kvm `whoami`</code></li>



<li>Download the latest Win11 ISO from <a href="https://www.microsoft.com/software-download/windows11" target="_blank" rel="noreferrer noopener">https://www.microsoft.com/software-download/windows11</a></li>



<li>Download the latest libvirt driver ISO from <a href="https://github.com/virtio-win/virtio-win-pkg-scripts/" target="_blank" rel="noreferrer noopener">https://github.com/virtio-win/virtio-win-pkg-scripts/</a></li>



<li>Start virt-manager and create a new VM, installing from the Win11 ISO. Most defaults are OK, with the following exceptions:<br>a. Change virtual disk storage bus from SATA to virtio<br>b. Add new storage, select the driver ISO, and change type from disk to CD-ROM<br>c. Change network device type from e100e to virtio</li>



<li>Start the VM; Win11 setup should begin.</li>



<li>Disable TPM and Secure Boot checks in the installer:<br>a. When the installer begins, press Shift-F10 and launch <code>regedit</code> from the command prompt.<br>b. Add a new key named <code>LabConfig</code> under <code>HKLM\SYSTEM\Setup</code><br>c. Add two new DWORDS to <code>HKLM\SYSTEM\Setup\LabConfig</code> named <code>BypassTPMCheck</code> and <code>BypassSecureBootCheck</code>, and set both to 1.<br>d. Exit Regedit, close the command prompt, and continue.</li>



<li>Optional: when prompted during installation, select &#8220;English (World)&#8221; as the time and currency format.  This causes a bunch of bloatware and other crap to not be installed.</li>



<li>After installation on the first boot, press Shift-F10 again and enter this to cut OOBE short:<br><code>oobe\BypassNRO</code><br>This will trigger a reboot, followed by a less intrusive offline OOBE process (necessary because the virtual NIC isn&#8217;t working yet, and it&#8217;s a good idea anyway).</li>



<li>Once the system&#8217;s up and running, run <code>virtio-win-guest-tools.exe</code> from the driver ISO to install the remaining needed drivers and other tools.</li>



<li>If you selected &#8220;English (World)&#8221; as the time and currency format when installing, start <code>intl.cpl</code> and make sure all settings are as they should be (whether &#8220;English (United States)&#8221; or whatever&#8217;s appropriate for you).  Do the same for &#8220;region settings&#8221; in the Settings app.</li>



<li>Open Microsoft Store, search for &#8220;App Installer,&#8221; and update it&#8230;need to do this for Winget to work.  (TODO: is there a way to do this with a normal download instead?)</li>



<li>Open a PowerShell admin window and launch Chris Titus&#8217;s tweak utility:<br><code>irm christitus.com/win | iex</code><br>Use it to debloat your system, install the software you want, etc.<br><strong>Warning: </strong>Removing the Edge browser with this utility may break other apps (I know for certain that Teams won&#8217;t work), and it might not be possible to get it working right again without a full reinstall.  It appears that Edge is embeddable within applications in much the same way that Internet Explorer was once embeddable.  <em>Plus ça change</em>&#8230; </li>



<li>Check for Windows updates in the usual manner.</li>
</ol>



<h2 class="wp-block-heading">More Win11-without-TPM/Secure Boot tricks</h2>



<p><a href="https://nerdschalk.com/install-windows-11-without-tpm/" target="_blank" rel="noreferrer noopener">https://nerdschalk.com/install-windows-11-without-tpm/</a> has several methods that might be useful, especially for upgrading from Win10 or earlier (as opposed to the clean install described above).</p>



<p>For upgrading to Win11 22H2 from an earlier version, <a rel="noreferrer noopener" href="https://jensd.be/1860/windows/upgrade-to-windows-11-22h2-on-unsupported-hardware" target="_blank">https://jensd.be/1860/windows/upgrade-to-windows-11-22h2-on-unsupported-hardware</a> should be useful.</p>
]]></content:encoded>
					
		
		
		<friends:post-format>standard</friends:post-format>
<post-id xmlns="com-wordpress:feed-additions:1">9915</post-id>	</item>
		<item>
		<title>Gentoo + Raspberry Pi Pico SDK + VSCodium: getting it all working</title>
		<link>https://alfter.us/2022/04/10/gentoo-raspberry-pi-pico-sdk-vscodium-getting-it-all-working/</link>
		
		<dc:creator><![CDATA[Scott Alfter]]></dc:creator>
		<pubDate>Sun, 10 Apr 2022 21:17:13 +0000</pubDate>
				<category><![CDATA[electronics]]></category>
		<category><![CDATA[Gentoo Linux]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[raspberry pi pico]]></category>
		<guid isPermaLink="false">https://alfter.us/?p=8825</guid>

					<description><![CDATA[The standard instructions for getting the Raspberry Pi Pico SDK up and running mostly work on Gentoo Linux, but there are a few exceptions (especially with regard to setting up the needed ARM cross-compiler). This is a summary of what I figured out over the course of a couple of hours on a Sunday morning, [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>The <a rel="noreferrer noopener" href="https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf" data-type="URL" data-id="https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf" target="_blank">standard instructions</a> for getting the Raspberry Pi Pico SDK up and running mostly work on Gentoo Linux, but there are a few exceptions (especially with regard to setting up the needed ARM cross-compiler).  This is a summary of what I figured out over the course of a couple of hours on a Sunday morning, adding the needed components to my system to get the provided &#8220;blinky&#8221; example to compile without errors.  (I don&#8217;t yet have a Raspberry Pi Pico to test with, but they&#8217;re on order from Sparkfun and will probably arrive sometime this week.)</p>



<h2 class="wp-block-heading">Install the ARM Cross-Compiler</h2>



<p>This is the biggest divergence from the published directions.  Gentoo has a system called <a rel="noreferrer noopener" href="https://wiki.gentoo.org/wiki/Crossdev" data-type="URL" data-id="https://wiki.gentoo.org/wiki/Crossdev" target="_blank">crossdev</a> that makes building cross-compilers ridiculously easy.  If you don&#8217;t already have it enabled (I already had AVR, ARM, and RISC-V cross-compilers for other purposes, though the ARM compilers I already had were for cross-compiling for Gentoo on Raspberry Pi SBCs, not the Raspberry Pi Pico), go get it.  Even if you&#8217;re running Gentoo Linux on a Raspberry Pi SBC, you&#8217;ll need this for the Pico:</p>



<pre class="wp-block-code"><code>sudo emerge crossdev</code></pre>



<p>Then, to build the necessary cross-compiler, do this&#8230;-s4 ensures that we get a C++ compiler as well as a C compiler:</p>



<pre class="wp-block-code"><code>sudo crossdev -s4 --target arm-none-eabi</code></pre>



<h2 class="wp-block-heading">Install the Raspberry Pi Pico SDK</h2>



<p>This pretty much goes by the book.  You&#8217;ll need Git installed&#8230;if you haven&#8217;t done that already, go take care of that.  Then, get the SDK:</p>



<pre class="wp-block-code"><code>cd ~ &amp;&amp; mkdir pico &amp;&amp; cd pico
git clone -b master https://github.com/raspberrypi/pico-sdk
(cd pico-sdk &amp;&amp; git submodule update --init)
git clone -b master https://github.com/raspberrypi/pico-examples
git clone -b master https://github.com/raspberrypi/pico-extras
git clone -b master https://github.com/raspberrypi/pico-playground
cat &lt;&lt;EOF &gt;&gt;~/.bashrc
PICO_SDK_PATH=`pwd`/pico-sdk
PICO_EXAMPLES_PATH=`pwd`/pico-examples
PICO_EXTRAS_PATH=`pwd`/pico-extras
PICO_PLAYGROUND_PATH=`pwd`/pico-playground
EOF</code></pre>



<p>Log out and back in before continuing to make sure the new variables are in your environment.</p>



<h2 class="wp-block-heading">Install VSCodium</h2>



<p><a href="https://vscodium.com" data-type="URL" data-id="https://vscodium.com" target="_blank" rel="noreferrer noopener">VSCodium</a> is the fully-open-source version of Visual Studio Code.  Mainly it lacks the telemetry code that phones home to Microsoft with your usage.  There is of course an ebuild in Portage, but before we install it, there&#8217;s a fix I like to apply that helps with plugin availability (in particular, it gets <a href="https://platformio.org" data-type="URL" data-id="https://platformio.org" target="_blank" rel="noreferrer noopener">PlatformIO</a> up and running in VSCodium).  The following will do both:</p>



<pre class="wp-block-code"><code>sudo wget https://alfter.us/wp-content/uploads/2022/04/vscodium-marketplace.patch -O /etc/portage/patches/app-editors/vscodium/vscodium-marketplace.patch
sudo emerge vscodium</code></pre>



<h2 class="wp-block-heading">Configure VSCodium</h2>



<p>There are a couple of extensions you&#8217;ll want to grab to better integrate Pico SDK projects into VSCodium:</p>



<ul class="wp-block-list"><li>C/C++ IntelliSense</li><li>CMake</li><li>CMake Tools</li><li>Cortex-Debug</li></ul>



<h2 class="wp-block-heading">Try It Out</h2>



<p>Start VSCodium from a shell prompt (the needed environment variables may or may not show up if you launch it from some desktop facility).  We&#8217;ll start with the provided examples:</p>



<pre class="wp-block-code"><code>nohup vscodium ~/pico/pico-examples &amp;</code></pre>



<p>If everything&#8217;s set up right, you&#8217;ll get some messages from cmake in the output window and a few options to select at the bottom of the window:</p>



<figure class="wp-block-image size-large"><a href="https://alfter.us/wp-content/uploads/2022/04/blinky.png"><img fetchpriority="high" decoding="async" width="1024" height="831" src="https://alfter.us/wp-content/uploads/2022/04/blinky-1024x831.png" alt="" class="wp-image-8829" srcset="https://alfter.us/wp-content/uploads/2022/04/blinky-1024x831.png 1024w, https://alfter.us/wp-content/uploads/2022/04/blinky-300x244.png 300w, https://alfter.us/wp-content/uploads/2022/04/blinky-768x624.png 768w, https://alfter.us/wp-content/uploads/2022/04/blinky-624x507.png 624w, https://alfter.us/wp-content/uploads/2022/04/blinky.png 1223w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<p>Where it says &#8220;CMake: [Debug]: Ready,&#8221; you can click to choose between different build options: debug, release, etc.  To the right of that, you pick the compiler to use&#8230;whatever the exact version is, it should have &#8220;arm-none-eabi&#8221; as part of the name.  To the right of that is the &#8220;Build&#8221; button, and right next to build, you can click where it says &#8220;[all]&#8221; to pick one of the examples to build.  Click on it, select &#8220;blink&#8221;, then click &#8220;Build.&#8221;  After a short time (maybe a second on the Ryzen 7 3800X I&#8217;m running), the output window should say the build is complete with no errors.  ~/pico/pico-examples/build/blink/blink.uf2 is the file that you&#8217;d then transfer into a Raspberry Pi Pico for execution.</p>
]]></content:encoded>
					
		
		
		<friends:post-format>standard</friends:post-format>
<post-id xmlns="com-wordpress:feed-additions:1">8825</post-id>	</item>
		<item>
		<title>Connecting to Bluetooth serial devices on Gentoo LInux</title>
		<link>https://alfter.us/2021/05/31/connecting-to-bluetooth-serial-devices-on-gentoo-linux/</link>
		
		<dc:creator><![CDATA[Scott Alfter]]></dc:creator>
		<pubDate>Mon, 31 May 2021 23:18:47 +0000</pubDate>
				<category><![CDATA[3D printing]]></category>
		<category><![CDATA[Gentoo Linux]]></category>
		<category><![CDATA[linux]]></category>
		<guid isPermaLink="false">https://alfter.us/?p=8613</guid>

					<description><![CDATA[This should&#8217;ve been easier, but in hindsight it isn&#8217;t too bad. The point-and-drool tools provided for managing Bluetooth (at least under KDE) fall flat on their face, but if you enable some supposedly deprecated options and rebuild BlueZ, you&#8217;ll get what you need. I decided to try getting an HC-05 Bluetooth interface working with one [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>This should&#8217;ve been easier, but in hindsight it isn&#8217;t too bad.  The point-and-drool tools provided for managing Bluetooth (at least under KDE) fall flat on their face, but if you enable some supposedly deprecated options and rebuild BlueZ, you&#8217;ll get what you need.</p>



<p>I decided to try getting an <a rel="noreferrer noopener" href="https://amzn.to/3i1m790" target="_blank">HC-05 Bluetooth interface</a> working with one of my 3D printers yesterday.  bluedevil (the KDE package that manages Bluetooth) apparently knows nothing about RFCOMM devices (which emulate RS-232 connections over Bluetooth).  I had gotten both Android and Windows 10 to talk to my printer over Bluetooth without much fuss: pair the device, fire up a suitable application, and connect.  </p>



<p>The needed documentation to get RFCOMM devices working on recent Gentoo builds is a bit sparse, so this post aims to correct that.</p>



<p>First, BlueZ needs to be rebuilt with some more USE flags enabled:</p>



<pre class="wp-block-code"><code>echo net-wireless/bluez deprecated extra-tools readline | sudo tee /etc/portage/package.use/bluez &amp;&amp; sudo emerge -1v bluez &amp;&amp; sudo /etc/init.d/bluetooth restart</code></pre>



<p>With your HC-05 at least powered up, you can retrieve its MAC address, which is needed for the following step:</p>



<pre class="wp-block-code"><code>hcitool scan</code></pre>



<p>which returns something like this:</p>



<pre class="wp-block-code"><code>Scanning ...
        98:D3:32:10:F7:9C       HC-05</code></pre>



<p>Next, RFCOMM needs to be configured and BlueZ restarted (wherever you see it below, substitute your device&#8217;s MAC address for the one used here):</p>



<pre class="wp-block-code"><code>cat &lt;&lt;EOF | sudo tee /etc/bluetooth/rfcomm.conf &amp;&amp; sudo /etc/init.d/bluetooth restart
rfcomm {
  bind no;
  device 98:D3:32:10:F7:9C;
  channel 1;
}
EOF</code></pre>



<p>Now we can pair the device to the computer:</p>



<pre class="wp-block-code"><code>sudo rfcomm connect hci0 98:D3:32:10:F7:9C 1</code></pre>



<p>You should be prompted for the HC-05&#8217;s PIN; the default is 1234. (Note: while I&#8217;ve gotten this working under KDE, I never get prompted for the PIN when in a pure-CLI environment and the connection is refused.) Key it in, and you should get a notice that you&#8217;re now connected:</p>



<pre class="wp-block-code"><code>Connected /dev/rfcomm0 to 98:D3:32:10:F7:9C on channel 1
Press CTRL-C for hangup</code></pre>



<p>Press Ctrl-C, then store the PIN for future reference:</p>



<pre class="wp-block-code"><code>for i in /var/lib/bluetooth/&#91;0-9A-F]*; do echo 98:D3:32:10:F7:9C 1234 | sudo tee -a $i/pincodes; done</code></pre>



<p>Create a boot script to bind /dev/rfcomm0:</p>



<pre class="wp-block-code"><code>cat &lt;&lt;EOF | sudo tee /etc/local.d/01-rfcomm-bind.start &amp;&amp; sudo chmod +x /etc/local.d/01-rfcomm-bind.start
#!/usr/bin/env bash
rfcomm bind hci0 98:D3:32:10:F7:9C 1
EOF</code></pre>



<p>Run rc-update and verify that both bluetooth and local are both being launched; in my case, both are in the default runlevel.  If you reboot now, /dev/rfcomm0 should show up.  Use something like minicom to connect, and if your HC-05 is plugged into a printer and the UART interface it&#8217;s using is active, you should at least see garbage coming across the line.  The HC-05 defaults to 9600 bps, while your printer is probably at 115.2 kbps or faster.  The only method I know of to set a different bitrate is to plug it in through an Arduino to bring up the AT-command interface, as described <a rel="noreferrer noopener" href="https://www.instructables.com/Modify-The-HC-05-Bluetooth-Module-Defaults-Using-A/" target="_blank">here</a>.  It doesn&#8217;t seem to support nonstandard speeds like 250 kbps and multiples thereof, and I even had trouble getting 230.4 kbps to work.  115.2 kbps has usually been fast enough to stream gcode without stalling; preprocessing your gcode with something like <a href="https://github.com/FormerLurker/ArcWelderLib" target="_blank" rel="noreferrer noopener">ArcWelder</a> may help if your printer is running reasonably modern firmware.</p>
]]></content:encoded>
					
		
		
		<friends:post-format>standard</friends:post-format>
<post-id xmlns="com-wordpress:feed-additions:1">8613</post-id>	</item>
	</channel>
</rss>
