<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by ioannis valasakis on Medium]]></title>
        <description><![CDATA[Stories by ioannis valasakis on Medium]]></description>
        <link>https://medium.com/@wizofe?source=rss-95dda6247db1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*iZi6nU8zBBYx4xFXbIndWg.jpeg</url>
            <title>Stories by ioannis valasakis on Medium</title>
            <link>https://medium.com/@wizofe?source=rss-95dda6247db1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 10 Apr 2026 20:22:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wizofe/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Uploading your first project in GitHub (with images)!]]></title>
            <link>https://medium.com/@wizofe/uploading-your-first-project-in-github-with-images-955ade6b9a62?source=rss-95dda6247db1------2</link>
            <guid isPermaLink="false">https://medium.com/p/955ade6b9a62</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[ed25519]]></category>
            <dc:creator><![CDATA[ioannis valasakis]]></dc:creator>
            <pubDate>Thu, 25 Nov 2021 10:35:23 GMT</pubDate>
            <atom:updated>2021-11-25T10:35:23.966Z</atom:updated>
            <content:encoded><![CDATA[<p>Here’s a very quick introduction to using GitHub from the bottom up. Let’s assume that you are using a Linux kind of shell bash/tcshet.c. Here’s a quick summary (feel free to skip any steps you’ve already achieved).</p><p>This is strictly for beginners and in order to happily upload your existing code to a completely new repository. It doesn’t teach good practices (very important).</p><p>After you complete this tutorial you may follow some of the amazing tutorials around to understand the logic behind code versioning, for example <a href="https://www.atlassian.com/git">Atlassian’s git tutorial</a> and <a href="https://rogerdudler.github.io/git-guide/">Roger Dudler’s tutorial</a>.</p><h3>Create SSH key</h3><p>Open your local terminal and type the following to generate a new, super-safe SSH using the OpenSSH format and the <a href="https://en.wikipedia.org/wiki/EdDSA">ed25519 algorithm</a>, using the same email that you have in GitHub:</p><pre>ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C “yourgithub@email.com”</pre><p>To add the key to the local ssh agent run the following:</p><pre>eval &quot;$(ssh-agent -s)&quot;<br>ssh-add ~/.ssh/id_ed25519</pre><h3>Upload key to GitHub</h3><p>Open your GitHub account and choose <strong>Settings</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/190/1*cMVWuy-V4fmyk3jsCi2Crw.png" /></figure><p>Choose <strong>SSH and GPG keys</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/231/1*u4n0qu94Scw-jN6hWVnKIQ.png" /></figure><p>Select <strong>New SSH key</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*4nS2LNdz0Ca2TkfnqyYRJg.png" /></figure><p><strong>Copy and paste</strong> the nameofed25519.pub file inside the white (key) box! It’s important to put the public file in there, otherwise the security key will be exposed!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*wehwnf3K51tXSR6mFVeZLw.png" /></figure><h3>Create a new repository on your GitHub account</h3><p>In the upper-right corner use the + drop-down menu and choose <strong>New repository</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/244/1*5DuXk-78xralXUIVtQPt3w.png" /></figure><p>As a name choose your preferred name (let’s call it here <em>tuning-sounds</em>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*U48L_VcWfT9sxfFuTTycRg.png" /></figure><p>You can add a README and license file (personally choice is GPL v3+) and click to <strong>Create repository.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*d6nkqJTMNxNcThrd3WesqQ.png" /></figure><h3>Create a new repo locally</h3><p>At this step, GitHub offers a nice command line tutorial that allows to create a new repository from the command line. If you have existing code, let’s say in a folder called <em>my-existing-code </em>get out of it cd.. and create a new one, with the same name we just gave the project in GitHub mkdir tuning-sounds; cd tuning-sounds</p><p>Now follow the steps that GitHub suggests, in my case (it will be different for you):</p><pre># pulling the online repo locally<br>git init<br>git remote add origin <a href="mailto:git@github.com">git@github.com</a>:wizofe/tuning-sounds.git<br>git pull origin master</pre><pre># pushing a first README<br>echo “# tuning-sounds” &gt;&gt; README.md<br>git add README.md<br>git commit -m “first commit”<br>git branch -M master<br>git push -u origin master</pre><p>Amazing! You just pushed your first changes in the repo <strong>🎊</strong></p><h3>Commit and push code</h3><p>Now you are ready to move the existing contents in your existing folder (<em>my-existing-code</em>) to the new project (<em>tuning-sounds</em>) with the following:</p><pre>cd ..<br>mv my-existing-code/* tuning-sounds/<br>cd tuning-sounds</pre><pre>git add .<br>git commit -m &quot;Move existing code in the repo&quot;<br>git push -u origin master</pre><p>This is the way you’ll do all your future commits. It is suggests that you commit relevant changes and <strong>not whole bunch of code! </strong>(like we just did ;-)</p><p>A good practice is to divide by functionality, for example if you create a pre-processing part in your code, only add that, commit it and push it to the repo. That makes easier to refer in future and also roll-back if your new change doesn’t work or breaks anything.</p><p>Talking about that, a great practice is to have testing inside your code :)</p><h3>Verify on GitHub</h3><p>If you go back on your GitHub folder you should be able to see the new code. It should look similar to this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*ueuvYGjteDpyRTY9nOgGhg.png" /></figure><h3>Looking forward</h3><p>A few things to read about for any future projects are the following:</p><ul><li>Use a .gitignore file which is a way to exclude files in the same directory as your code (especially if you have data/config files or anything which you don’t want to push online)</li><li>Creating branches and then do a pull request online. It’s a good idea to create new branches when adding functionality on the code. This way, you can also add collaborators that are able to do a code review before you do a final merge!</li><li>Git branching and workflow strategies</li><li>Testing your code (look for a testbed for your favourite language)</li><li>Enjoy!</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=955ade6b9a62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RSoC: Porting Redox to ARM (AArch64) — 0x02]]></title>
            <link>https://medium.com/@wizofe/rsoc-porting-redox-to-arm-aarch64-0x02-c566ee22f377?source=rss-95dda6247db1------2</link>
            <guid isPermaLink="false">https://medium.com/p/c566ee22f377</guid>
            <category><![CDATA[rust]]></category>
            <category><![CDATA[arm]]></category>
            <category><![CDATA[boards96]]></category>
            <category><![CDATA[redox]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <dc:creator><![CDATA[ioannis valasakis]]></dc:creator>
            <pubDate>Sun, 05 Aug 2018 22:39:42 GMT</pubDate>
            <atom:updated>2018-08-06T22:56:41.219Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BvvROKE0STmAOsflpUz1cg.png" /><figcaption><em>Getting closer to UEFI, HiKey960 and the kernel</em></figcaption></figure><h3>What am I going to do?</h3><p>Two weeks ago, I blogged about @microcolonel’s plan to port Redox OS to the Armv8 Architecture and specifically to the 64-bit AArch64 execution state.</p><p>In this edition, I’ll blog about my personal explorations of the following ⌨️</p><ul><li>Setting up the HiKey960 reference board (kindly offered by @microcolonel and ARM; thanks!) for Serial Communication to the host development system (Fedora Linux28)</li><li>Sanity checking @microcolonel’s <a href="https://gitlab.com/redox/redox">current status of Redox OS</a>. As a first step, and as explained in that doc, I compiled the whole of Redox for x86_64 on a Debian Stretch 9 host.</li><li>Building @microcolonel’s <a href="https://gitlab.redox-os.org/redox-os/kernel/tree/5d7e43f10064eb299df355c809596bd4d31eefca/src/arch/aarch64">AArch64 Redox kernel development branch</a> to get my first AArch64 entry into the Redox (micro) kernel!</li><li>Exploring the possibility of chain loading U-Boot from UEFI (i.e. Use U-Boot as an EFI payload) . For more details on this, look at this <a href="https://www.suse.com/media/article/UEFI_on_Top_of_U-Boot.pdf">SuSE paper</a>.</li><li>Getting on par with @microcolonel’s qemu based core kernel work on HiKey960 reference board. I will describe what works, where it fails, and the difficulties encountered.</li><li>Sharing some interesting community links, a Stanford course for Raspberry Pi (spoiler: it includes writing low level code in RUST 😍) and some insight on UEFI, U-Boot and OS Booting. A good read for anyone entering the playing field!</li></ul><h3>A summary of work done since the last blog posting</h3><p>At the time of writing the previous blog the plan was to target the Raspberry Pi 3 (Cortex A53) as a development platform because of its availability, popularity and community. Sadly, it seems that Broadcom went through a lot of shortcuts while implementing this specific design, which means features like <a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0176c/ar01s03s01.html">GIC</a> are half-there or completely missing, like in this case.</p><p>After a discussion with @microcolonel, he proposed and kindly sent me a <a href="https://www.96boards.org/documentation/consumer/hikey/hikey960/getting-started/">HiKey960</a> reference SoC from the awesome Linaro 96Boards initiative. The quality of this board is definitely a lot better than the Raspberry Pi and the documentation is detailed and open. Great stuff.</p><p>I am also excited as I wait for an <a href="https://www.asus.com/uk/Single-Board-Computer/Tinker-Board/">Asus Tinkerboard</a>, offered by another member of the Redox community: @stratact. Thank you so much for your contribution and I hope I can put it to use someday! Looking at you Redox kernel!!!</p><h3>Board Preparation</h3><p>The HiKey960 needs a UART to USB cable (such as <a href="https://www.96boards.orghttps//gist.github.com/raw-bin/84833ce783d71f7bae71c09c67a01487/product/uartserial/">the Mezzanine board from 96Boards</a> or any other 1.8V-compatible cable; beware that is not your usual 3V3/5V Amazon TTL2USB!)</p><p>Pin 1/2 is GND. Then, we need to connect the Pins 11 (TxD), 13 (RxD) to their equivalent on the cable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*trEdiOmEEEsUXeRjFDtrSQ.gif" /></figure><p>The colors aren’t universal but in <a href="https://www.aliexpress.com/item/1PCS-1-8V-USB-to-TTL-wire-usb-turn-serial-port-1-8V-lines-to-flash/32572439616.html">my case</a> they went like:</p><ul><li>White — RxD from the USB side</li><li>Green — TxD (same as above)</li><li>Black — GND</li><li>Pink (I suppose trying to be red) — Vcc <strong>[leave that unconnected]</strong></li><li>In case that you need there’s also an active low reset available on pin 6 of the 40 pin connector. A jumper from there to GND will reset the board and set it to fastboot mode (optional)</li></ul><p>For reference, see above for a photo of this setup.</p><p>If everything goes well you will be welcomed with a beautiful boot sequence and kernel messages from the stock Android AOSP installation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Slhx4yTKApm8tZX2mRcAvg.png" /><figcaption>Serial output from HiKey960</figcaption></figure><h4>Sanity check the Redox build environment</h4><p>Here is the summary of my process, mainly following <a href="https://gitlab.redox-os.org/redox-os/kernel/blob/5d7e43f10064eb299df355c809596bd4d31eefca/src/arch/aarch64/doc/PORT-HOWTO.md">@microcolonel’s How-To</a> but improvising at a few different points:</p><ul><li>Create a VM and install Debian Stretch 9</li><li>Install the required packages and libraries</li><li>Get the keys and install a Redox toolchain</li><li>Install Rust (nightly), cargo and xargo</li><li>Do a make fetch; make pull on the main repo</li><li>Get a Redox login prompt (x86_64) with make kvm=no vga=no qemu</li></ul><blockquote><strong>Mission accomplished! </strong>🎉</blockquote><h4>Compile the kernel for AArch64</h4><p><strong>What?</strong> Yes indeed! Thanks to @microcolonel’s this can be done (check the above mentioned How-To for detailed steps).Switch to origin/aarch64 branch</p><p>Summary:</p><ul><li>Switch to the origin/aarch64 branch</li><li>Update the submodules (kernel and syscall)</li><li>Get the aarch64-elf GNU toolchain</li><li>Get @microcolonel’s modified rust compiler that is using llvm with added toolchain triplet support for the aarch64-unknown-redox</li><li>Compiling a patched version of U-Boot</li><li>Let rustup know about our new AArch64 Rust compiler</li><li>Build the kernel!</li></ul><p>make ARCH=aarch64 CROSS_COMPILE=aarch64-elf- PLATFORM=qemu-system-aarch64-virt INSTALLER_FLAGS=”” build/kernel</p><h3>Building UEFI for HiKey960 from source</h3><p>Hikey960 currently only supports UEFI based booting using the <a href="https://github.com/tianocore/edk2">Tianocore edk2 project</a>. @microcolonel and I are exploring how we can get to the same boot flow by chain-loading u-boot from edk2 but that’s for later.</p><h4>Code Preparation</h4><p>Note: I only recently discovered that you can find pre-built binary UEFI images from Linaro but here are the steps I followed ot build from source for those who want to learn about it!</p><p>Create a working directory, let’s call it makeUEFIand get all the repositories needed in there:</p><p>It is important to get the current working branches in order to compile successfully. You may need the openssl-dev package as well, so keep that in mind.</p><pre>git clone https://github.com/ARM-software/arm-trusted-firmware -b integration<br>git clone https://github.com/96boards-hikey/edk2 -b testing/hikey960_v2.5<br>git clone https://github.com/96boards-hikey/OpenPlatformPkg -b testing/hikey960_v1.3.4<br>git clone https://github.com/96boards-hikey/l-loader -b testing/hikey960_v1.2<br>git clone https://git.linaro.org/uefi/uefi-tools<br>git clone https://github.com/96boards-hikey/atf-fastboot</pre><h4>Let’s build!</h4><p>Note: You may be able to find lot of the following instructions online, especially in the HiKey960 GitHub official documentation, as well a few Japanese blogs, where they are installing Debian on the HiKey. The problem is that in all of those sources, there’s always an error that stops you from following the steps successfully.</p><p>It feels almost like it’s an upside-down documentation (first tinkering with code and then trying to remember the steps involved!). By following the steps below you can be sure that everything is meticulously tested :)</p><p>Save the following bash script and execute it on your ${BUILD_PATH}</p><pre>#!/bin/bash<br># Install UEFI from source on HiKey960</pre><pre>export BUILD_PATH=`pwd`</pre><pre>cd ${BUILD_PATH}/edk2<br>ln -s ../OpenPlatformPkg </pre><pre># for the v1 of Hikey960, remove the following line from the tools/platform.config<br># BUILDFLAGS=-DSERIAL_BASE=0xFDF05000</pre><pre>BUILD_OPTION=DEBUG</pre><pre>export AARCH64_TOOLCHAIN=GCC5<br>export UEFI_TOOLS_DIR=${BUILD_PATH}/uefi-tools<br>export EDK2_DIR=${BUILD_PATH}/edk2</pre><pre>EDK2_OUTPUT_DIR=${EDK2_DIR}/Build/HiKey960/${BUILD_OPTION}_${AARCH64_TOOLCHAIN}</pre><pre>cd ${EDK2_DIR}</pre><pre># Build UEFI &amp; ARM Trust Firmware<br># Again, please use gcc-5.3 to build</pre><pre>${UEFI_TOOLS_DIR}/uefi-build.sh -b ${BUILD_OPTION} -a ../arm-trusted-firmware hikey960</pre><pre># Generate l-loader.bin</pre><pre>cd ${BUILD_PATH}/l-loader<br>ln -sf ${EDK2_OUTPUT_DIR}/FV/bl1.bin<br>ln -sf ${EDK2_OUTPUT_DIR}/FV/fip.bin<br>ln -sf ${EDK2_OUTPUT_DIR}/FV/BL33_AP_UEFI.fd</pre><pre>python gen_loader_hikey960.py -o l-loader.bin — img_bl1=bl1.bin — <br>img_ns_bl1u=BL33_AP_UEFI.fd</pre><pre># Generate partition table (You can download from net directly)<br># See generate_ptable.sh to config your own ptable</pre><pre>PTABLE=linux-32g SECTOR_SIZE=4096 SGDISK=./sgdisk bash -x generate_ptable.sh</pre><h4>Serial and flashing</h4><p>To flash the loader you need to have the board in Recovery Mode (look at the following table for reference):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/25f44afa08a89daf4a0bd534ec0c92f8/href">https://medium.com/media/25f44afa08a89daf4a0bd534ec0c92f8/href</a></iframe><p>Unfortunately you can’t access the Boot Screen usingminicom. For that purpose you can try ser2net(or alternatively picocombut I had more success with the former).</p><p>sudo apt-get install ser2net</p><p>Append the line for serial-over-USB in the config file etc/ser2net.conf</p><p>2001:telnet:0:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner</p><ul><li>Boot UEFI in recovery mode. Create a connection with your Serial to USB cable (usually on either/dev/ttyUSB0{1} . You can always check this by runningdmesg before and after inserting the Serial to USB table.</li><li>Install the HiKey960 recovery tools:</li></ul><pre>git clone https://github.com/96boards-hikey/tools-images-hikey960</pre><pre>cd tools-images-hikey960</pre><pre># Ensure that the l-loader is set up <br># on the correct addresss</pre><pre>cat config</pre><pre>./hisi-sec_usb_xloader.img 0x00020000<br>./hisi-sec_uce_boot.img 0x6A908000<br>./recovery.bin 0x1AC00000</pre><ul><li>If you are using a Debian-based distribution remove the modemmanager package. This package may cause hikey_idt tool to fail.<br>sudo apt-get purge modemmanager</li><li>Run the command to download l-loader.bin into HiKey960, using the right USB port:<br>sudo ./hikey_idt -c config -p /dev/ttyUSB0{1}</li><li>Now that UEFI is running on the Recovery Mode it’s time to flash update the images!</li></ul><pre># Flash the images onto HiKey960<br>sudo fastboot flash ptable prm_ptable.img<br>sudo fastboot flash xloader hisi-sec_xloader.img<br>sudo fastboot flash fastboot l-loader.bin<br>sudo fastboot flash fip fip.bin<br>sudo fastboot flash boot boot.img<br>sudo fastboot flash cache cache.img<br>sudo fastboot flash system system.img<br>sudo fastboot flash userdata userdata.img</pre><ul><li>Boot UEFI in Fastboot mode (see above)</li><li>Runtelnet localhost 2001</li><li>Using the Esc key, the boot manager is loaded. From there you can access UEFI Console, Android Fastboot or Grub!</li></ul><blockquote>Good job!!! 🥂🎇</blockquote><h3>Using U-Boot as an EFI payload</h3><p>Das U-Boot is not just *another bootloader. *It’s one of the most used bootloaders in the embedded world. A brain child of Wolfgang Denk, it has been adopted by many developers and companies and they all contribute to its source base.</p><p>For a bootloader to be successful around a variety of processors and architectures, a method of configuring it is necessary. This is happening during compile time (as with the Linux kernel). This technique is significantly reducing the complexity of the bootloader.</p><p>In the case of Das U-Boot, this configuration is driven by a single header file specific to the target platform and a few soft links in the source tree, that depending on the architecture, target board, etc select the required sub-directories.</p><p>The first step of configuring Das U-Boot for a specific platform/board/architecture is done by issuing:</p><p>make &lt;platform&gt;_config</p><p>Configuration <em>options</em> are selected using macros in the form of <em>CONFIG_XXXX</em>. Configuration <em>settings</em> are selected using macros in the form of <em>CFG_XXXX</em>. In general, configuration options (<em>CONFIG_XXX</em>) are user configurable and enable specific U-Boot operational features. Configuration settings (<em>CFG_XXX</em>) are usually hardware specific and require detailed knowledge of the underlying processor and/or hardware platform.</p><p>Board-specific U-Boot configuration is driven by a header file dedicated to that specific platform that contains configuration options and settings appropriate for the underlying platform. The U-Boot source tree includes a directory where these board-specific configuration header files reside, namely ../include/configsdirectory where you can change anything suitable for the board you are using/porting.</p><p>For a more insider’s approach have a look at the great paper <a href="https://www.suse.com/media/article/UEFI_on_Top_of_U-Boot.pdf">UEFI on Top of U-Boot</a>, written from SUSE’s Andreas Färber and Alexander Graf!</p><p>Note: If I have some extra time this month, I will try to attempt porting U-Boot for the HiKey960 although I can’ t promise anything :)</p><p>Keep tuned for my approach and the issues I had on my way; my next article is out next week!</p><h3>Fun Stuff</h3><p>Would you like to learn more about Operating Systems, their internals and do some small (but exciting) experiments on Raspberry Pi?</p><p>I have two great suggestions for you. One is a (quite old) lab from the University of Cambridge in U.K., namely <a href="https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/">Operating Systems Development</a>.</p><p>The other one, is from the University of Stanford and it’s very recent and relevant <a href="https://web.stanford.edu/class/cs140e/">Writing an OS in Rust!</a></p><p>I hope that you can get a bit more insight from those and enjoy as much as I did.</p><h3>Next steps</h3><p>To conclude, I am trying to get into the habit of writing more often blogs but it feels currently that my time is better spent experimenting and keeping everybody updated with a longer (and hopefully more detailed) monthly blog entry!</p><p>Having a regular weekly chat with @microcolonel is very helpful. His kind, patient and helpful approach gives me a lot to think about, experiment and learn.</p><p>The community of Redox is very engaging and active and its future looks very bright to me!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c566ee22f377" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Custom Raspberry Pi Debug Kernel]]></title>
            <link>https://medium.com/@wizofe/custom-raspberry-pi-debug-kernel-71661fd123f2?source=rss-95dda6247db1------2</link>
            <guid isPermaLink="false">https://medium.com/p/71661fd123f2</guid>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[kernel]]></category>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <dc:creator><![CDATA[ioannis valasakis]]></dc:creator>
            <pubDate>Sun, 29 Jul 2018 13:08:31 GMT</pubDate>
            <atom:updated>2018-07-29T13:08:31.243Z</atom:updated>
            <content:encoded><![CDATA[<p><em>or how to mess with your kernel.</em></p><h3>Introduction</h3><p>This is a description on how to cross compile[1] a custom Linux kernel for the Raspberry Pi 3B including kernel debugging and memory leak investigation configurations.</p><p>[1] Using ahost Fedora 28 to a guestRaspberry Pi system; instructions may differ depending on your OS, for example for Debian-based OS’s it can be something similar to gcc-arm-linux-gnueabihf</p><h3>Setting Up</h3><h4>Getting the kernel</h4><p>First thing to do while reading this, is to start downloading the kernel repo; It can take some time.</p><p>git clone --depth=1 <a href="https://github.com/raspberrypi/linux/`">https://github.com/raspberrypi/linux/</a></p><p>Current branch at the time of writing (<em>July 2018</em>) is the rpi-4.14.y.</p><h4>Using an old .config</h4><p>If there’s already a known working kernel configuration file on hand from the OS then it’s advised to use it. It usually is on the location /proc/config.gz. For the file to exist, the option <em>Kernel .config support</em> should be enabled in the kernel. This is the case on the current Raspberry Pi 3 and in case you don’t see the file there then do a sudo modprobe configs and the file will magically appear in the right place.</p><pre># On the host<br>KERNEL=kernel7<br># Transfer your old file from your Pi via scp<br>zcat /proc/config.gz &gt; .config<br># Clean any old config files<br>make mrproper<br># make the kernel aware of using an old configuration<br>make ARCH=arm CROSS_COMPILE=arm-linux-gnu- oldconfig<br># and setup with new options; look on the next section<br>make ARCH=arm CROSS_COMPILE=arm-linux-gnu- menuconfig</pre><h4>Detailed debug info configuration</h4><p>As a reference here’s the (missing) required configuration for a debug and memory leak detection kernel. For more information consider reading the <a href="https://www.kernel.org/doc/html/latest/">Linux Kernel Documentation</a>. This is for reference only, the .config file shouldn’t be manually edited as there are dependencies between the options; that may result in a non/malfunctioning kernel.</p><pre># Note: The commented options are important but they were already enabled<br># = CONFIG_PRINTK_TIME=y<br># = CONFIG_DEBUG_KERNEL=y<br># = CONFIG_KALLSYMS=y<br># = CONFIG_KGDB=y<br># = CONFIG_KGDB_SERIAL_CONSOLE=y<br># = CONFIG_KGDB_KDB=y<br># = CONFIG_PROC_FS=y<br># = CONFIG_MAGIC_SYSRQ = y<br># = CONFIG_SYSFS=y<br>CONFIG_KALLSYMS_ALL=y<br>CONFIG_PREEMPT=y # CLASH WITH VOLUNTAR?Y<br>CONFIG_KDB_KEYBOARD=y<br>CONFIG_PROC_VMCORE=y<br>CONFIG_PROC_KCORE=y<br>CONFIG_CRASH_DUMP=y<br>CONFIG_DEBUG_INFO=y<br>CONFIG_KEXEC=y<br>CONFIG_SLUB_DEBUG_ON=y<br>CONFIG_SLUB_STATS=y<br>CONFIG_DEBUG_SLAB=y<br>CONFIG_DEBUG_SPINLOCK_SLEEP=y<br>CONFIG_DEBUG_SPINLOCK=y<br>CONFIG_DEBUG_BUGVERBOSE=y<br>CONFIG_DEBUG_KMEMLEAK=y<br>CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=4096<br>CONFIG_DEBUG_KMEMLEAK_TEST=m</pre><h4>Making the kernel</h4><p>Fire it and grab a cup of tea while waiting for the compilation!</p><p>make -j6 ARCH=arm CROSS_COMPILE=arm-linux-gnu- zImage modules dtbs</p><h3>Debug Notes</h3><p>Add to the /boot/cmdline.txtthe following, whereuser_debug=Nis one of the following:</p><blockquote>1 — undefine instruction events<br>2 — system calls<br>4 — invalid data aborts<br>8 — SIGSEGV faults<br>16 — SIGBUS faults</blockquote><h3>Installing onto the SD Card</h3><p>To identify the SD run lsblk before and after the SD insertion. You ‘re going to get two partitions: p1 should be the boot partition, while p2 the rootfs. Now create two folders in oder to mount the fs, for example:</p><pre>mkdir -p mnt/bootfs<br>mkdir mnt/rootfs</pre><p>Mount and install the modules:</p><pre>sudo mount /dev/xxxp1 mnt/bootfs<br>sudo mount /dev/xxxp2 mnt/rootfs</pre><pre>sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnu- INSTALL_MOD_PATH=mnt/rootfs modules_install</pre><p>After that you need to copy the kernel and device tree blobs onto the SD card:</p><pre># Run all that as root<br>cp mnt/bootfs/$KERNEL.img mnt/bootfs/$KERNEL-backup.img<br>cp arch/arm/boot/zImage mnt/bootfs/$KERNEL.img<br>cp arch/arm/boot/dts/*.dtb mnt/bootfs/<br>cp arch/arm/boot/dts/overlays/*.dtb* mnt/bootfs/overlays/<br>cp arch/arm/boot/dts/overlays/README mnt/bootfs/overlays/<br>umount mnt/bootfs<br>umount mnt/rootfs</pre><h3>Debugging</h3><p>This is just a reference and some things to try using the compiled kernel to get more debugging information. I am writing a new article that is addressing the issue in more detail. Stay tuned!</p><h4>Memory leaks</h4><pre># Using kernel memory leak debugging<br># sudo mount -t debugfs nodev /sys/kernel/debug # superfluous — already mounted<br>sudo bash -c “echo scan &gt; /sys/kernel/debug/kmemleak”<br>sudo cat /sys/kernel/debug/kmemleak # Repeat to see updated info</pre><pre># IF the `echo scan…` part above *fails*, check /var/log/kern.log<br># What I saw: “Kernel memory leak detector disabled”,<br># “Early log buffer exceeded (####), please increase DEBUG_KMEMLEAK_EARLY_LOG_SIZE”</pre><pre># I increased CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE and rebuilt/reinstalled the kernel</pre><pre># Another handy command:<br>sudo slabtop -sc</pre><h4>Oops and bugs</h4><p>If the kernel is compiled with the option CONFIG_KALLSYMS then the dump is usable as it is. The most important information to keep is the EIP line ignoring the 0010:. By looking at the uncompressed kernel (vmlinux and not zImage or vmlinuz) with nm vmlinux | sort | less one can extract the name list, match it against the EIP from the kernel crash and look up the kernel function that contains the offending address.</p><p>Note: The address can’t be matched exactly (so it cant’ be grepped) but it’s a good starting point as to discover the location of the call.</p><p>Alternatively, you can use gdb on a running kernel. (read-only; i.e. you cannot change values or set break points.) To do this, first compile the kernel with -g; edit arch/arm/Makefile appropriately, then do a make clean. You’ll also need to enable CONFIG_PROC_FS (via make config).</p><p>After you’ve rebooted with the new kernel, launch gdb vmlinux /proc/kcore. You can now use all the usual gdb commands. The command to look up the point where your system crashed is l *0xXXXXXXXX. (Replace the XXXes with the EIP value.)</p><p>gdb’ing a non-running kernel currently fails because gdb (wrongly) disregards the starting offset for which the kernel is compiled.</p><h3>Troubleshooting</h3><h4>Can’t load kernel modules</h4><p>Check which modules are loading through the conf file emacs -nw /etc/modules-load.d/*.conf (try commenting a few out) and run sudo systemctl status systemd-modules-load.service which should give more detailed information on what is failing.</p><h4>Cannot find wifi card / No Internet</h4><p>It seems a bit weird as sometimes after a kernel installation the internet installation seems to fail. I suggest that before installing the modified kernel do a sudo raspi-update to get the current firmware blobs.</p><h3>Useful articles</h3><p>Many of the information above has been compiled through a lot of experimentation, crashed systems, dumped cores and a lot of reburned SD cards. Thanks all the authors for their Free and Open Source approach.</p><p><a href="https://github.com/raspberrypi/linux/blob/rpi-4.16.y/Documentation/admin-guide/README.rst">Linux Kernel Admin Guide</a><br><a href="https://ownyourbits.com/2018/05/09/debugging-the-linux-kernel">Debugging the linux kernel</a><br><a href="https://www.linux.com/learn/kernel-newbie-corner-kernel-and-module-debugging-gdb">The kernel newbie debugging<br></a><a href="http://www.bo-yang.net/2015/03/30/debug-kernel-space-memory-leak">Debug kernel space memory leak</a><br><a href="http://shell-storm.org/blog/Trace-and-debug-the-Linux-Kernel-functons">Trace and debug the linux kernel</a><br><a href="https://www.linux.com/learn/kernel-newbie-corner-kernel-and-module-debugging-gdb">Newbie corner kernel</a><br><a href="https://www.elinux.org/Kernel_Debugging_Tips">Kernel debugging tips</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71661fd123f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cross compiling Rust for ARM (e.g. Raspberry Pi) using any OS!]]></title>
            <link>https://medium.com/@wizofe/cross-compiling-rust-for-arm-e-g-raspberry-pi-using-any-os-11711ebfc52b?source=rss-95dda6247db1------2</link>
            <guid isPermaLink="false">https://medium.com/p/11711ebfc52b</guid>
            <category><![CDATA[mac]]></category>
            <category><![CDATA[vagrant]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[rust]]></category>
            <category><![CDATA[debian]]></category>
            <dc:creator><![CDATA[ioannis valasakis]]></dc:creator>
            <pubDate>Sat, 07 Jul 2018 21:54:26 GMT</pubDate>
            <atom:updated>2018-07-08T17:42:50.514Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<h3>Rust + Vagrant 💖</h3><p>Everybody knows that Rust is the <a href="https://www.reddit.com/r/rust/comments/60toqc/rust_was_voted_stack_overflows_most_loved/">most beloved</a> language for developers since it appeared! Same goes for Raspberry Pi, the small but mighty computer, that costs just £30 but brings a whole awesomeness on board (I wish Broadcom Engineers were a bit more open with their design and less lazy to implement the whole ARM GIC; but let’s keep this for another time).</p><p>Here is a small walkthrough, on how to use Mac OSx, Linux or even Windows (hey not tested but I am sure you can make it work, the tools are the same) to compile your Rust marvellousness and run the binary directly on the Raspberry Pi (2/3/3+).</p><p>You can find a few different tutorials describing this process but almost never for Mac OSx.</p><p>My solution is very simple: use <a href="https://www.vagrantup.com">Vagrant</a>! If you haven’t heard about it is an open-source software product for building and maintaining portable virtual software development environments e.g. for VirtualBox and so on. It really simplifies software configuration management of virtualizations and makes you life sooo much easier and productive 🤗</p><p><em>If you have a Linux based bistro, then you can just skip the steps 1–2.</em></p><h3>Preparation 👈🏼</h3><p>The simple steps for achieving all the above are the following (the first two steps assume Mac OSx; for Windows users you can do something similar but Google on how to install the tools described):</p><ol><li>Install Virtualbox on your machine and install Vagrant</li></ol><pre>brew cask install virtualbox<br>brew cask install vagrant<br>brew cask install vagrant-manager</pre><p>2. Add the Vagrant box you want to use, start it and ssh into it. We’ll use Debian Stretch for the following example</p><pre>cd ~/workspace/rust</pre><pre>vagrant init debian/stretch64<br>vagrant up<br>vagrant ssh<br># you can quit the machine with &#39;vagrant halt&#39;</pre><p>4. (If you have arrived here from the steps above, yes that was it. Now you ‘re running a Debian, straight into your Mac OSx at the speed of light 😮)</p><p>It’s a good idea to update to the current package versions. Do that and then install Rust (nightly 🌌 is recommended)</p><pre>sudo apt update<br>sudo apt upgrade</pre><pre># you may need to &#39;sudo apt install curl&#39; as well<br>curl <a href="https://sh.rustup.rs">https://sh.rustup.rs</a> -sSf | sh</pre><pre># Choose 2, Enter, nightly, y. Confirm and press 1 to install.</pre><p>Now you should be welcomed with</p><p><strong>Rust is installed now. Great! </strong>🎉</p><p>5. Install the GNU ARM toolchain and their respective Rust crates</p><pre>source $HOME/.cargo/env</pre><pre>sudo apt-get install -qq gcc-arm-linux-gnueabihf<br>rustup target add armv7-unknown-linux-gnueabihf</pre><p>6. Configure Cargo for cross-compilation</p><pre>mkdir -p ~/.cargo</pre><pre># &gt; should not be included when pasting</pre><pre>cat &gt;&gt;~/.cargo/config &lt;&lt;EOF<br>&gt; [target.armv7-unknown-linux-gnueabihf]<br>&gt; linker = &quot;arm-linux-gnueabihf-gcc&quot;<br>&gt; EOF</pre><p>7. That was it! Run a simple test</p><pre>cargo new --bin hello <br>cd hello <br>cargo build --target=armv7-unknown-linux-gnueabihf</pre><p>which should happily create an ARMv7 binary[1]! To be sure</p><p>[1] For the difference between ARM7 and ARMv7 check here: <a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka13706.html">http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka13706.html</a> Thanks @LulzCop for spotting my mistake :)</p><pre>file target/armv7-unknown-linux-gnueabihf/debug/hello</pre><pre>vagrant@stretch:~/hello$ target/armv7-unknown-linux-gnueabihf/debug/hello: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=39cfb5d9c8cda29ecac841120a2ef9c170f84399, not stripped</pre><pre># you can scp and run the executable on the ARM to finalise your test!</pre><p>Hurray! Now you can cross-compile Rust for ARM-based devices from the comfort of your own OS🤩</p><p>As always ping me if you have any questions and please comment in case something doesn’t work as expected!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11711ebfc52b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RSoC: Porting Redox to ARM (AArch64) — 0x01]]></title>
            <link>https://medium.com/@wizofe/rsoc-porting-redox-to-aarch64-0x01-3dee87644c97?source=rss-95dda6247db1------2</link>
            <guid isPermaLink="false">https://medium.com/p/3dee87644c97</guid>
            <category><![CDATA[rust]]></category>
            <category><![CDATA[hikey960]]></category>
            <category><![CDATA[arm]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[redox]]></category>
            <dc:creator><![CDATA[ioannis valasakis]]></dc:creator>
            <pubDate>Tue, 26 Jun 2018 17:26:31 GMT</pubDate>
            <atom:updated>2018-07-18T13:28:00.443Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introductory session</h3><p>…and here we go!</p><p>All excited. A first calendar entry to describe my attempt on arm64 support in <a href="http://www.redox-os.org">Redox OS</a>.</p><p>Specifically, looking into the Raspberry <a href="https://web.stanford.edu/class/cs140e/docs/BCM2837-ARM-Peripherals.pdf">Pi2/3b/3+</a>(all of them having a Cortex-A53 ARMv8 64-bit microprocessor, although for all my experiments I am going to use the Raspberry Pi 3b.</p><p>Yesterday, I had my (<a href="https://www.github.com/wizofe">@wizofe</a>) first meeting in Cambridge with <a href="https://github.com/raw-bin">@microcolonel</a>! Very very inspiring, got many ideas and motivation. He reminded me that the first and most important thing I fell in love with Open Source is its people :)</p><h4>Discussion Points</h4><p>Everything started with a personal introduction, background and motivation reasons that we both participate in this project. It’s very important to note that we don’t want it to be a one-off thing but definitely the start of a longer support and experimentation with OS support and ARM.</p><h4>Redox boot flow on AArch64</h4><p>Some of the points discussed:</p><ul><li>boot</li><li>debug</li><li>MMU setup</li><li>TLS</li><li>syscalls</li></ul><p>The current work by @microcolonel, is happening on the realms of qemu-system-aarch64 platform. But what should I need to put my attention, when porting to the RPi3? Here are the most importants bits:</p><ul><li>Typical AArch64 exception level transitions post reset: EL3 -&gt; EL2 -&gt; EL1</li><li>Setting up a buildable u-boot (preferably the u-boot mainline) for RPi3</li><li>Setting up a BOOTP/TFTP server on the same subnet as the RPi3</li><li>Packaging the redox kernel binary as a (fake) Linux binary using u-boot’s mkimage tool</li><li>Obtaining an FDT blob for the RPi3 (Linux’s DTB can be used for this). In hindsight, u-boot might be able to provide this too (u-boot’s own generate )</li><li>Serving the packaged redox kernel binary as well as the FDT blob to u-boot via BOOT/TFTP</li><li>Statically expressing a suitable PL011 UART’s physical base address within Redox as an initial debug console</li></ul><p>Note: I’ve already completed (as shown) two important steps, which I am going to describe on my next blog post (to keep you excited ;-)</p><h4>Challenges with recursive paging for AArch64</h4><p>@microcolonel is very fond of recursive paging. He seems to successfully to make it work on qemu and it seems that it may be possible in silicon as well. This is for 48-bit Virtual Addresses with 4 levels of translation.</p><p>As AArch64 has separate descriptors for page tables and pages which means that in order for recursive paging to work there must not be any disjoint bit fields in the two descriptor types. This is the case today but it is not clear if this will remain in the future.</p><p>The problem is that if recursive paging doesn’t work on the physical implementation that may time much longer than expected to port for the RPi3. Another point, is that as opposed to x86_64, AArch64 has a separate translation scheme for user-space and kernel space. So while x86_64 has a single cr3 register containing the base address of the translation tables, AArch64 has two registers, ttbr_el0 for user-space and ttbr_el1 for the kernel. In this realm, there has been @microcolonel’s work to extend the paging schemes in Redox to cope with this.</p><h4>TLS, Syscalls and Device Drivers</h4><p>The Redox kernel’s reliance on Rust’s #[thread_local] attribute results in llvm generating references to the tpidr_el0 register. On AArch64 tpidr_el0 is supposed to contain the user-space TLS region’s base address. This is separate from tpidr_el1 which is supposted to contain the kernel-space TLS region’s base address.</p><p>To fix this, @microcolonel has modified llvm such that the use of a ‘kernel’ code-model and an aarch64-unknown-redox target results in the emission og tpidr_el1. TLS support is underway at present.</p><h4>Device drivers and FDT</h4><p>For the device driver operation using fdt it’s very important to note the following:</p><ul><li>It will be important to create a registry of all the device drivers present</li><li>All device drivers will need to implement a trait that requires publishing of a device-tree compatible string property</li><li>As such, init code can then match the compatible string with the tree of nodes in the device tree in order to match drivers to their respective data elements in the tree</li></ul><h4>Availability of @microcolonel’s code base</h4><p>As he still expects his employer’s open source contribution approval there are still many steps to be done to port Redox OS.</p><p>The structure of the code to be published was also discussed. At present @microcolonel’s work is a set of patches to the following repositories:</p><ul><li>Top level redox checkout (build glue etc)</li><li>Redox kernel submodule (core AArch64 support)</li><li>Redox syscall’s submodule (AArch64 syscall support)</li><li>Redox’s rust submodule (TLS support, redox toolchain triplet support)</li></ul><p>Possible ways to manage the publishing of this code were also discussed. One way is to create AArch64 branches for all of the above and push them out to the redox github. This is TBD with <strong>@jackpot51</strong>.</p><h4>Feature parity with x86_64</h4><p>It’s very important to stay aligned with the current x86_64 port and for that reason the following work is important to be under way:</p><ul><li>Syscall implementation</li><li>Context switch support</li><li>kmain -&gt; init invocation</li><li>Filesystem with apps</li><li>Framebuffer driver</li><li>Multi-core support</li><li>(…) (to be filled with a whole list of the current x86_64 features)</li></ul><p><em>Attaining feature parity would be the first concrete milestone for the </em><em>AArch64 port as a whole.</em></p><h4>My next steps</h4><p>As a result of the discussion and mentoring, the following steps were decided for the future:</p><ul><li>Get to a point where u-boot can be built from source and installed on the RPi3</li><li>Figure out the UART base and verify that the UART’s data register can be written to from the u-boot CLI (which should provoke an immediate appearance of characters on the CLI)</li><li>Setup a flow using BOOTP/DHCP and u-bootthat allows Redox kernels and DTBs to be sent to u-boot over Ethernet</li><li>Once @microcolonel’s code has been published, start by hacking in the UART base address and a DTB blob</li><li>Aim to reach kstart with println output up and running.</li></ul><h4>Next steps for @microcolonel</h4><ul><li>Complete TLS support</li><li>Get Board and CPU identification and display going via DTB probes</li><li>Verify kstart entry on silicon. @microcolonel means to use the <em>Lemaker</em> <em>Hikey620 Linaro 96Board</em> for this. It’s a <em>Cortex-A53</em> based board just like the RPi3. The idea is to quickly check if recursive paging on silicon is OK. This can make @wizofe’s like a lot rosier. :)</li><li>Make the UART base address retrieval dynamic via DTB (as opposed to the static fixed address used at present which isn’t portable)</li><li>Get init invocation from kmain going</li><li>Implement necessary device driver identification traits and registry</li><li>Implement GIC and timer drivers (Red Flag for RPi3 here, as it has no implementation of GIC but rather a closed proprietary approach)</li><li>Focus on user-land bring-up</li></ul><h4>Future work</h4><p>If we could pick up the most important plan for the future of Redox that would be a roadmap!</p><p>Some of the critical items that should be discussed:</p><ul><li>Suitable tests and Continuous integration (perhaps with Jenkins)</li><li>A pathway to run Linux applications under Redox. FreeBSD’s linuxulator (system call translator) would be one way to do this. This would make complex applications such as firefox etc usable until native solutions become available in the longer term.</li><li>Self hosted development. Having redox bootable on a couple of popular laptops with a focus on feature fullness will go a great way in terms of perception. System76 dual boot with Pop_OS! ? ;)</li><li>A strategy to support hardware assisted virtualization.</li></ul><p>Thanks for reading! Hope to see you next time here. For any questions feel free to message me here! Many many insights are taken from @microcolonel’s very detailed summary; The following part of the blog is my own experimentation and exploration on the discussed matters!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3dee87644c97" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to fix screen tearing on Fedora28 when using external HD monitors]]></title>
            <link>https://medium.com/@wizofe/how-to-solve-the-issue-with-screen-tearing-on-fedora28-with-external-hd-monitors-74cbd074f082?source=rss-95dda6247db1------2</link>
            <guid isPermaLink="false">https://medium.com/p/74cbd074f082</guid>
            <category><![CDATA[troubleshoot]]></category>
            <category><![CDATA[hdpi]]></category>
            <category><![CDATA[fedora]]></category>
            <category><![CDATA[external-monitor]]></category>
            <category><![CDATA[tearing]]></category>
            <dc:creator><![CDATA[ioannis valasakis]]></dc:creator>
            <pubDate>Tue, 26 Jun 2018 11:06:04 GMT</pubDate>
            <atom:updated>2018-07-30T09:50:08.921Z</atom:updated>
            <content:encoded><![CDATA[<p>While using <em>Fedora 28</em> with my <em>Thinkpad T450</em> notebook and two external Dell HD monitors, I noticed a very strange effect when scrolling: apparently that comes with the name “<a href="https://en.wikipedia.org/wiki/Screen_tearing"><em>tearing</em></a>”.</p><p>I did some research and I found out that the drivers are already part of the kernel, so there’s no need to add external developmental Intel HD drivers.</p><p>In the end the solution was very simple: to add the following file/contents to the system and reboot. Magic!</p><p><strong>Case</strong>: <em>Thinkpad T450</em><br><strong>Video Driver:</strong> <em>Intel HD 550 </em><br><strong>Problem: </strong>Screen <em>tearing</em> when scrolling on an HD screen</p><p><strong>Solution</strong>:</p><ul><li>Create a new file, namely /etc/X11/xorg.conf.d/20-intel.conf</li><li>Add this to the file</li></ul><pre>Section “Device”<br> Identifier “Intel Graphics”<br> Driver “intel”<br> Option “TearFree” “true”<br>EndSection</pre><ul><li>That’s it, now reboot and enjoy your new HD experience!</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74cbd074f082" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I installed Fedora 27 on my High Sierra Macbook Pro 15']]></title>
            <link>https://medium.com/@wizofe/how-i-installed-fedora-27-on-my-high-sierra-macbook-pro-15-80616909f294?source=rss-95dda6247db1------2</link>
            <guid isPermaLink="false">https://medium.com/p/80616909f294</guid>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[macbook]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[fedora]]></category>
            <dc:creator><![CDATA[ioannis valasakis]]></dc:creator>
            <pubDate>Fri, 29 Dec 2017 02:27:06 GMT</pubDate>
            <atom:updated>2017-12-29T02:31:43.980Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<p>(<em>and yes, I have a functional Wi-Fi!</em>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*Sq9SDDgDgxlDmPJnY-awWQ.png" /><figcaption>Tux loves Apples.</figcaption></figure><p>This is a quick and sexy guide on installing Fedora 27 on a 2014 15&#39; Macbook Pro. Many people are intimidated by Linux and partitioning hard drives but in all honesty there’s nothing to be scared (although to be fair it wasn’t my first time installing Linux; I still remember the moment I installed it on my iPod 120Gb device.</p><p>Yes, fellow reader, you read correctly that’s not an <em>iPad </em>but a 10 years old iPod with 240Gb hard drive, at times you didn’t have to pay an extra £100 tupgrade from 32 to 64Gb space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Dx3ptLWLKD4nppBHfhW6Og.jpeg" /><figcaption>Oh, yeah; that iPod!</figcaption></figure><p>Approach this as a curated list of links and genius ideas around the World Wide Web. Link or add your own on the comments.</p><h3>1 — macOS, getting the required files</h3><p>First step is to use your browser and <a href="http://www.getfedora.org">GetFedora</a>. I opted for the latest version (currently 27). A fancy script is happy to recognise your macOS and offer you the “Fedora Media Writer”. This is a tool for downloading the required Fedora image file (about 1.5Gb), while also used to build a USB Live distro.</p><p>While waiting for the download, fire diskutil and create a new 15–20Gb partition on your hard drive. If you have High Sierra you’ll need to choose the option ‘Partition’ (and confirm that you’re sure you need this) and create an extra FAT32 (the file system doesn’t matter at this stage as you’re going to re-format later anyway).</p><h3>2— WiFi</h3><p>As there’s no out of the box support for the Broadcom 4360 WiFi network adapter you need to connect to Ethernet or (if you’ve no spare Thunderbolt to Ethernet connector) use your mobile phone in USB Tethering mode. Of course that depends on the phone maker but it should be somewhere around Settings, Data/Internet. Don’t forget that for this option you shoulnd’t enable MPT mode (in my case it was the camera mode).</p><p>Try out if your connection is up:</p><pre>[wizofe@earthsea ~]$ ping <a href="http://www.google.com">www.google.com</a></pre><pre>PING <a href="http://www.google.com(ham11s01-in-x04.1e100.net">www.google.com(ham11s01-in-x04.1e100.net</a> (2a00:1450:4005:800::2004)) 56 data bytes<br>64 bytes from ham11s01-in-x04.1e100.net (2a00:1450:4005:800::2004): icmp_seq=1 ttl=53 time=57.3 ms</pre><p>Whoot. We ‘re online.</p><p>Now you ‘re ready to install the Broadcom 4360 drivers. Here’s a tutorial from jamespamplin Github repo.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ec50e443775697d6980f5a2c675b630e/href">https://medium.com/media/ec50e443775697d6980f5a2c675b630e/href</a></iframe><h3>3 — Graphic Card</h3><p>I am going to talk about my graphic card (NVIDIA GK107M, or as usually known GT 750M). If you have a different card then please follow the instructions but try to google which is your required drivers.</p><p>Follow this guide to install the propietary video drivers from nVidia and disable the open source Nouveau. In my case, I decided to stay open source as I am using Linux for developing purposes (if I need Video and Photo Editing, I switch to macOS anyway ;))</p><p><a href="https://www.if-not-true-then-false.com/2015/fedora-nvidia-guide/#">Fedora 27/26/25 nVidia Drivers Install Guide</a></p><h3>4 — Larger console font (for the virtual terminal)</h3><p>With the high dpi Retina screen, the Visual Console has really tiny font size and it’s impossible to work in. I am tooking about the full screen terminal and <em>not </em>the GNOME console. You can reach it by using the combination Ctrl-Alt-F[2–6].</p><p>Here’s an except from Martin’s Blog:</p><p>First, I generated a custom font file from one of the TTF fonts installed on my system (in this case from Google Noto):</p><pre>sudo mkdir /boot/grub2/fonts<br>sudo grub2-mkfont -s 36 -o /boot/grub2/fonts/NotoSansRegular36.pf2 \<br> /usr/share/fonts/google-noto/NotoSans-Regular.ttf</pre><p>This font can now be used in <strong>/etc/default/grub</strong>:</p><pre>GRUB_TIMEOUT=5 <br>GRUB_DISTRIBUTOR=&quot;$(sed &#39;s, release .*$,,g&#39; /etc/system-release)&quot; <br>GRUB_DEFAULT=saved <br>GRUB_DISABLE_SUBMENU=true <br><strong>GRUB_TERMINAL_OUTPUT=&quot;gfxterm&quot;</strong> <br>GRUB_CMDLINE_LINUX=&quot;...&quot; <br>GRUB_DISABLE_RECOVERY=&quot;true&quot; <br><strong>GRUB_FONT=&quot;/boot/grub2/fonts/NotoSansRegular36.pf2&quot;</strong></pre><p>Basically, I added the <strong>GRUB_FONT</strong> entry which points to the font to use. In addition, I had to change the <strong>GRUB_TERMINAL_OUTPUT</strong> from <strong>console</strong> to <strong>gfxterm</strong>.</p><p><strong>Note:</strong> The remaining entries must remain as they are! Only edit the two variables.</p><p>Finally, the GRUB configuration can be regenerated.</p><pre> # EFI:<br>sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg</pre><p>To increase the font size for the Linux console (Ctrl+Alt+F[2–8]), first install the <strong>terminus</strong> fonts:</p><pre>sudo dnf install terminus-fonts-console</pre><p>Now, change to a TTY and use the <strong>setfont</strong> command to load one of the fonts. You will find them in <strong>/usr/lib/kbd/consolefonts/</strong>. For me, the ter-m32n font works quite nicely:</p><pre>sudo setfont ter-m32n</pre><p>To make this font the default console font, edit <strong>/etc/vconsole.conf</strong> and adjust the <strong>FONT</strong> entry:</p><pre>KEYMAP=&quot;gb&quot; <br><strong>FONT=&quot;ter-m32n&quot;</strong></pre><h3>5 — Upgrade Fedora</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XnxKwvb6B7g_ZeNUqIAjnQ.png" /><figcaption>Fedora is here to stay!</figcaption></figure><p>Simply run:</p><pre>dnf --update</pre><p>After this update the wifi is going to break again but the only thing you need to do is run:</p><pre>akmods --force</pre><p>and this will reload the required kernel modules.</p><h3>6 — Setting up vim</h3><p>Two of my favourite plugins for Vim are Vim Sensible and SpaceVim. To install sensible you need the Pathogen plugin manager. Pretty easy to install:</p><pre>mkdir -p ~/.vim/autoload ~/.vim/bundle &amp;&amp; \<br>curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim</pre><p>now create a .vimrc file in your home folder (preferably with …vi!) and add the following (input with ‘i’ and close and save with :wq)</p><pre>execute pathogen#infect()<br>syntax on<br>filetype plugin indent on</pre><p>now to install ‘sensible’ run:</p><pre>cd ~/.vim/bundle<br>git clone git://github.com/tpope/vim-sensible.git</pre><p>In addition I will link my .vimrc file to my github so you can get some ideas of my setup. Feel free to build on it, although I *love* the theme of vim sensible!</p><ul><li>airline (for the status line)</li><li>w0rp/ale (for on the fly lint checking)</li><li>plugged (plugin manager)</li><li>goyo (for distraction free writing)</li><li>lightline (for status line sugarcoating)</li><li>tcomment_vim (gcc for commenting a line; sweet)</li><li>easymotion (to move around with ease)</li></ul><p>Here is a nice blog with definitely the most useful vim plugins ever:</p><p><a href="http://sherifsoliman.com/2016/05/30/favorite-vim-plugins/">http://sherifsoliman.com/2016/05/30/favorite-vim-plugins</a></p><p>If you are interested on how to use vim8 as an IDE for coding have a look at this really cool article as well. As a reference I am using the following plugins:</p><p><a href="http://liuchengxu.org/posts/use-vim-as-a-python-ide/">Use Vim as a Python IDE</a></p><h3>7 —Linux basics</h3><p>It is out of the scope of the guide to provide a Linux tutorial although if you are really starting now, have a look at this nice and simple introduction to Fedora Linux by David Farning:</p><p><a href="https://fedoraproject.org/wiki/DavidFarning/fedorafaqBasics#What_is_a_terminal.3F_How_to_I_.22open_a_terminal.3F.22">DavidFarning/fedorafaqBasics - Fedora Project Wiki</a></p><h3>8 —Future</h3><p>Future planned articles are an Introduction to Linux device drivers, experimenting with microcontrollers and sensors (Atmel Mega AVR, Arduino, Raspberry Pi).</p><p>I am also writing a re-make of the Cambridge Computer Lab tutorial of how to make a simple Operating System (in Assembly Language) using Raspberry Pi 3.</p><p>Hope to see you again soon and feel free to drop me a line for any ideas, additions or kudos ;)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80616909f294" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>