367 lines
31 KiB
HTML
367 lines
31 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en-us" dir="ltr" itemscope itemtype="http://schema.org/Article" data-r-output-format="html">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0, minimum-scale=1.0">
|
||
<meta name="generator" content="Hugo 0.161.1">
|
||
<meta name="generator" content="Relearn 8.2.0+220806ce3ced8264fbdd693f77f28216a8a1b6ae">
|
||
<meta name="description" content="To realize the full benefits of gokrazy, you need to use only software written in Go. If there is no Go software for what you want to do, creating that piece of software can pose a seemingly unsurmountable hurdle. To make some quick progress and figure out if your idea can be implemented, it might make sense to temporarily use existing software before starting your own implementation.
|
||
This article shows a couple of techniques for getting non-Go software to work on gokrazy, in increasing order of complexity.">
|
||
<meta name="author" content="">
|
||
<meta name="twitter:card" content="summary">
|
||
<meta name="twitter:title" content="Non-Go Prototyping :: gokrazy">
|
||
<meta name="twitter:description" content="To realize the full benefits of gokrazy, you need to use only software written in Go. If there is no Go software for what you want to do, creating that piece of software can pose a seemingly unsurmountable hurdle. To make some quick progress and figure out if your idea can be implemented, it might make sense to temporarily use existing software before starting your own implementation.
|
||
This article shows a couple of techniques for getting non-Go software to work on gokrazy, in increasing order of complexity.">
|
||
<meta property="og:url" content="https://gokrazy.org/development/non-go/index.html">
|
||
<meta property="og:site_name" content="gokrazy">
|
||
<meta property="og:title" content="Non-Go Prototyping :: gokrazy">
|
||
<meta property="og:description" content="To realize the full benefits of gokrazy, you need to use only software written in Go. If there is no Go software for what you want to do, creating that piece of software can pose a seemingly unsurmountable hurdle. To make some quick progress and figure out if your idea can be implemented, it might make sense to temporarily use existing software before starting your own implementation.
|
||
This article shows a couple of techniques for getting non-Go software to work on gokrazy, in increasing order of complexity.">
|
||
<meta property="og:locale" content="en_us">
|
||
<meta property="og:type" content="article">
|
||
<meta property="article:section" content="Package development">
|
||
<meta itemprop="name" content="Non-Go Prototyping :: gokrazy">
|
||
<meta itemprop="description" content="To realize the full benefits of gokrazy, you need to use only software written in Go. If there is no Go software for what you want to do, creating that piece of software can pose a seemingly unsurmountable hurdle. To make some quick progress and figure out if your idea can be implemented, it might make sense to temporarily use existing software before starting your own implementation.
|
||
This article shows a couple of techniques for getting non-Go software to work on gokrazy, in increasing order of complexity.">
|
||
<meta itemprop="wordCount" content="813">
|
||
<title>Non-Go Prototyping :: gokrazy</title>
|
||
<link href="/images/favicon.png?1782408721" rel="icon" type="image/png">
|
||
<link href="/css/auto-complete/auto-complete.min.css?1782408721" rel="stylesheet">
|
||
<script src="/js/auto-complete/auto-complete.min.js?1782408721" defer></script>
|
||
<script src="/js/search-lunr.min.js?1782408721" defer></script>
|
||
<script src="/js/search.min.js?1782408721" defer></script>
|
||
<script>
|
||
window.relearn = window.relearn || {};
|
||
window.relearn.index_js_url="/searchindex.en.js?1782408721";
|
||
</script>
|
||
<script src="/js/lunr/lunr.min.js?1782408721" defer></script>
|
||
<script src="/js/lunr/lunr.stemmer.support.min.js?1782408721" defer></script>
|
||
<script src="/js/lunr/lunr.multi.min.js?1782408721" defer></script>
|
||
<script src="/js/lunr/lunr.en.min.js?1782408721" defer></script>
|
||
<script>
|
||
window.relearn = window.relearn || {};
|
||
window.relearn.contentLangs=['en'];
|
||
</script>
|
||
<link href="/fonts/fontawesome/css/fontawesome-all.min.css?1782408721" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="/fonts/fontawesome/css/fontawesome-all.min.css?1782408721" rel="stylesheet"></noscript>
|
||
<link href="/css/perfect-scrollbar/perfect-scrollbar.min.css?1782408721" rel="stylesheet">
|
||
<link href="/css/theme.min.css?1782408721" rel="stylesheet">
|
||
<link href="/css/format-html.min.css?1782408721" rel="stylesheet" id="R-format-style">
|
||
<script>
|
||
window.relearn = window.relearn || {};
|
||
// configuration
|
||
window.relearn.min = `.min`;
|
||
window.relearn.path='\/development\/non-go\/index.html';
|
||
window.relearn.relBasePath='..\/..';
|
||
window.relearn.relBaseUri='..\/..';
|
||
window.relearn.absBaseUri='https:\/\/gokrazy.org';
|
||
window.relearn.disableInlineCopyToClipboard=true;
|
||
window.relearn.enableBlockCodeWrap=true;
|
||
// legal
|
||
window.relearn.getItem = (s,n) => {return s.getItem(n)};
|
||
window.relearn.setItem = (s,n,v) => {return s.setItem(n,v)};
|
||
window.relearn.removeItem = (s,n) => {return s.removeItem(n)};
|
||
// translations
|
||
window.T_Copy_to_clipboard = `Copy text to clipboard`;
|
||
window.T_Copied_to_clipboard = `Text copied to clipboard!`;
|
||
window.T_Link_copied_to_clipboard = `Link copied to clipboard!`;
|
||
window.T_Reset_view = `Reset view`;
|
||
window.T_View_reset = `View reset!`;
|
||
window.T_No_results_found = `No results found for "{0}"`;
|
||
window.T_N_results_found = `{1} results found for "{0}"`;
|
||
window.T_Browser_unsupported_feature = `This browser doesn't support this feature`;
|
||
// variant stuff
|
||
window.relearn.themevariants = [ 'auto' ];
|
||
window.relearn.customvariantname = "my-custom-variant";
|
||
window.relearn.changeVariant = function(variant) {
|
||
var oldVariant = document.documentElement.dataset.rThemeVariant;
|
||
window.relearn.setItem(window.localStorage, window.relearn.absBaseUri + "/variant", variant);
|
||
document.documentElement.dataset.rThemeVariant = variant;
|
||
if (oldVariant != variant) {
|
||
document.dispatchEvent( new CustomEvent('themeVariantLoaded', { detail: { variant, oldVariant } }) );
|
||
window.relearn.markVariant();
|
||
}
|
||
}
|
||
window.relearn.markVariant = function() {
|
||
var variant = window.relearn.getItem(window.localStorage, window.relearn.absBaseUri + "/variant");
|
||
document.querySelectorAll(".R-variantswitcher select").forEach((select) => {select.value = variant;});
|
||
}
|
||
window.relearn.initVariant = function() {
|
||
var variant = window.relearn.getItem(window.localStorage, window.relearn.absBaseUri + "/variant") ?? "";
|
||
if( variant == window.relearn.customvariantname ){
|
||
}else if( !variant || !window.relearn.themevariants.includes(variant) ){
|
||
variant = window.relearn.themevariants[0];
|
||
window.relearn.setItem(window.localStorage, window.relearn.absBaseUri + "/variant", variant);
|
||
}
|
||
document.documentElement.dataset.rThemeVariant = variant;
|
||
}
|
||
window.relearn.initVariant();
|
||
window.relearn.markVariant();
|
||
</script>
|
||
</head>
|
||
<body class="mobile-support html" data-url="/development/non-go/index.html">
|
||
<div id="R-body" class="default-animation">
|
||
<div id="R-body-overlay"></div>
|
||
<nav id="R-topbar">
|
||
<div class="topbar-wrapper">
|
||
<div class="topbar-sidebar-divider"></div>
|
||
<div class="topbar-area topbar-area-start" data-area="start">
|
||
<div class="topbar-button topbar-button-sidebar" data-content-empty="disable" data-width-s="show" data-width-m="hide" data-width-l="hide">
|
||
<span class="btn cstyle button link noborder notitle interactive"><button onclick="toggleNav()" type="button" title="Menu (CTRL+ALT+n)"><i class="fa-fw fas fa-bars"></i></button></span>
|
||
</div>
|
||
<div class="topbar-button topbar-button-toc" data-content-empty="hide" data-width-s="show" data-width-m="show" data-width-l="show">
|
||
<span class="btn cstyle button link noborder notitle interactive"><button onclick="toggleTopbarFlyout(this)" type="button" title="Table of Contents (CTRL+ALT+t)"><i class="fa-fw fas fa-list-alt"></i></button></span>
|
||
<div class="topbar-content">
|
||
<div class="topbar-content-wrapper">
|
||
<nav class="TableOfContents">
|
||
<ul>
|
||
<li><a href="#go-software-not-written-for-gokrazy-grafana">Go software not written for gokrazy: Grafana</a></li>
|
||
<li><a href="#c-software-wireguard">C software: WireGuard</a></li>
|
||
<li><a href="#c-software-tc">C software: tc</a></li>
|
||
</ul>
|
||
</nav>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<ol class="topbar-breadcrumbs breadcrumbs highlightable" itemscope itemtype="http://schema.org/BreadcrumbList"><li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement" class=""><a itemprop="item" href="/index.html"><span itemprop="name">gokrazy Go appliances</span></a><meta itemprop="position" content="1"> > </li><li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement" class=""><a itemprop="item" href="/development/index.html"><span itemprop="name">Package development</span></a><meta itemprop="position" content="2"> > </li><li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement" class=""><span itemprop="name">Non-Go Prototyping</span><meta itemprop="position" content="3"></li>
|
||
</ol>
|
||
<div class="topbar-area topbar-area-end" data-area="end">
|
||
<div class="topbar-button topbar-button-edit" data-content-empty="disable" data-width-s="area-more" data-width-m="show" data-width-l="show">
|
||
<span class="btn cstyle button link noborder notitle interactive"><a href="https://github.com/gokrazy/gokrazy/tree/master/website/content/development/non-go.markdown" rel="external" title="Edit (CTRL+ALT+w)"><i class="fa-fw fas fa-pen"></i></a></span>
|
||
</div>
|
||
<div class="topbar-button topbar-button-more" data-content-empty="hide" data-width-s="show" data-width-m="show" data-width-l="show">
|
||
<span class="btn cstyle button link noborder notitle interactive"><button onclick="toggleTopbarFlyout(this)" type="button" title="More"><i class="fa-fw fas fa-ellipsis-v"></i></button></span>
|
||
<div class="topbar-content">
|
||
<div class="topbar-content-wrapper">
|
||
<div class="topbar-area topbar-area-more" data-area="more">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</nav>
|
||
<div id="R-main-overlay"></div>
|
||
<main id="R-body-inner" class="highlightable development" tabindex="-1">
|
||
<div class="flex-block-wrapper">
|
||
<article class="default">
|
||
<header class="headline">
|
||
</header>
|
||
|
||
<h1 id="non-go-prototyping">Non-Go Prototyping</h1>
|
||
|
||
<p>To realize the full benefits of gokrazy, you need to use only
|
||
software written in Go. If there is no Go software for what you want
|
||
to do, creating that piece of software can pose a seemingly
|
||
unsurmountable hurdle. To make some quick progress and figure out if
|
||
your idea can be implemented, it might make sense to temporarily use
|
||
existing software before starting your own implementation.</p>
|
||
<p>This article shows a couple of techniques for getting non-Go
|
||
software to work on gokrazy, in increasing order of complexity.</p>
|
||
<p>Note that software which is manually installed like shown
|
||
here <strong>will not be automatically updated</strong> by gokrazy
|
||
and hence poses a security risk. Use these techniques only for
|
||
prototyping.</p>
|
||
<h2 id="go-software-not-written-for-gokrazy-grafana">Go software not written for gokrazy: Grafana<span class="btn cstyle anchor copyanchor scrollanchor link noborder notitle interactive"><button type="button" title="Copy link to clipboard"><i class="fa-fw fas fa-link fa-lg"></i></button></span></h2>
|
||
<p>It would not suffice to add Grafana to your <code>gokr-packer</code>
|
||
command, as the resulting Grafana binary requires assets, supports
|
||
plugins, keeps state, etc.</p>
|
||
<p>Hence, you need to manually install Grafana into a directory
|
||
underneath <code>/perm</code>. A convenient way to do that is to
|
||
use <a href="https://github.com/gokrazy/breakglass">breakglass</a>
|
||
to download the “Standalone Linux Binaries” release from
|
||
<a href="https://grafana.com/grafana/download?platform=arm"><a href="https://grafana.com/grafana/download?platform=arm" rel="external">https://grafana.com/grafana/download?platform=arm</a></a>. Note
|
||
that I am serving the file from my computer because my busybox
|
||
version supports neither HTTPS nor DNS.</p>
|
||
<div class="highlight actionbar-wrapper wrap-code" dir="auto"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>/tmp/breakglass531810560 # wget http://10.0.0.76:4080/grafana-5.3.2.linux-arm64.tar.gz
|
||
</span></span><span style="display:flex;"><span>/tmp/breakglass531810560 # tar xf grafana-5.3.2.linux-arm64.tar.gz</span></span></code></pre></div>
|
||
<p>We cannot start Grafana yet, as its binary is dynamically
|
||
linked. One way to fix this is to place the sources which correspond
|
||
to the release you just unpacked (e.g. from
|
||
<a href="https://github.com/grafana/grafana/tree/v5.3.2"><a href="https://github.com/grafana/grafana/tree/v5.3.2" rel="external">https://github.com/grafana/grafana/tree/v5.3.2</a></a>)
|
||
in your <code>$GOPATH</code> and recompile the binaries:</p>
|
||
<div class="highlight actionbar-wrapper wrap-code" dir="auto"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>GOARCH<span style="color:#f92672">=</span>arm64 CGO_ENABLED<span style="color:#f92672">=</span><span style="color:#ae81ff">1</span> CC<span style="color:#f92672">=</span>aarch64-linux-gnu-gcc go install <span style="color:#ae81ff">\
|
||
</span></span></span><span style="display:flex;"><span> -ldflags <span style="color:#e6db74">"-linkmode external -extldflags -static"</span> <span style="color:#ae81ff">\
|
||
</span></span></span><span style="display:flex;"><span> github.com/grafana/grafana/pkg/cmd/...</span></span></code></pre></div>
|
||
<p>Note that it is usually easier to set the environment
|
||
variable <code>CGO_ENABLED=0</code> to get a statically linked
|
||
binary, but Grafana uses sqlite3, which is written in C, so we
|
||
resort to the <code>-ldflags</code> variant.</p>
|
||
<p>At this point, we can start Grafana from breakglass:</p>
|
||
<div class="highlight actionbar-wrapper wrap-code" dir="auto"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>/tmp/breakglass531810560 # cd grafana-5.3.2
|
||
</span></span><span style="display:flex;"><span>/tmp/breakglass531810560/grafana-5.3.2 # wget http://10.0.0.76:4080/grafana-server
|
||
</span></span><span style="display:flex;"><span>/tmp/breakglass531810560/grafana-5.3.2 # install -m 755 grafana-server bin/ && rm grafana-server
|
||
</span></span><span style="display:flex;"><span>/tmp/breakglass531810560/grafana-5.3.2 # ./bin/grafana-server
|
||
</span></span><span style="display:flex;"><span>INFO[10-30|19:27:51] Starting Grafana logger=server version=5.0.0 commit=NA compiled=2018-10-30T19:27:51+0100
|
||
</span></span><span style="display:flex;"><span>…</span></span></code></pre></div>
|
||
<p>To have gokrazy start Grafana, we can use a Go package like this:</p>
|
||
<div class="highlight actionbar-wrapper wrap-code" dir="auto"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-go" data-lang="go"><span style="display:flex;"><span><span style="color:#f92672">package</span> <span style="color:#a6e22e">main</span>
|
||
</span></span><span style="display:flex;"><span>
|
||
</span></span><span style="display:flex;"><span><span style="color:#f92672">import</span> (
|
||
</span></span><span style="display:flex;"><span> <span style="color:#e6db74">"log"</span>
|
||
</span></span><span style="display:flex;"><span> <span style="color:#e6db74">"syscall"</span>
|
||
</span></span><span style="display:flex;"><span>)
|
||
</span></span><span style="display:flex;"><span>
|
||
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">func</span> <span style="color:#a6e22e">main</span>() {
|
||
</span></span><span style="display:flex;"><span> <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">bin</span> = <span style="color:#e6db74">"/perm/grafana/bin/grafana-server"</span>
|
||
</span></span><span style="display:flex;"><span> <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">err</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">syscall</span>.<span style="color:#a6e22e">Exec</span>(<span style="color:#a6e22e">bin</span>, []<span style="color:#66d9ef">string</span>{<span style="color:#a6e22e">bin</span>, <span style="color:#e6db74">"-homepath=/perm/grafana"</span>}, <span style="color:#66d9ef">nil</span>); <span style="color:#a6e22e">err</span> <span style="color:#f92672">!=</span> <span style="color:#66d9ef">nil</span> {
|
||
</span></span><span style="display:flex;"><span> <span style="color:#a6e22e">log</span>.<span style="color:#a6e22e">Fatal</span>(<span style="color:#a6e22e">err</span>)
|
||
</span></span><span style="display:flex;"><span> }
|
||
</span></span><span style="display:flex;"><span>}</span></span></code></pre></div>
|
||
<h2 id="c-software-wireguard">C software: WireGuard<span class="btn cstyle anchor copyanchor scrollanchor link noborder notitle interactive"><button type="button" title="Copy link to clipboard"><i class="fa-fw fas fa-link fa-lg"></i></button></span></h2>
|
||
<p>WireGuard is a modern VPN tunnel, which consists of a Linux kernel
|
||
module and a configuration
|
||
tool. See <a href="https://github.com/rtr7/kernel/commit/c7afbc1fd2efdb9e1149d271c4d2be59cc5c98f4">rtr7/kernel@c7afbc1f</a>
|
||
for how the kernel module was added to the router7 kernel.</p>
|
||
<p>The configuration tool can be statically cross-compiled. We can run
|
||
Debian in a Docker container to not mess with our host system:</p>
|
||
<div class="highlight actionbar-wrapper wrap-code" dir="auto"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>% mkdir /tmp/wg
|
||
</span></span><span style="display:flex;"><span>% cd /tmp/wg
|
||
</span></span><span style="display:flex;"><span>% docker run -t -i debian
|
||
</span></span><span style="display:flex;"><span>root@d1728eaaa6e1:/# dpkg --add-architecture arm64
|
||
</span></span><span style="display:flex;"><span>root@d1728eaaa6e1:/# apt update
|
||
</span></span><span style="display:flex;"><span>root@d1728eaaa6e1:/# apt install libmnl-dev:arm64 libelf-dev:arm64 linux-headers-amd64 crossbuild-essential-arm64 pkg-config wget
|
||
</span></span><span style="display:flex;"><span>root@d1728eaaa6e1:/# wget https://git.zx2c4.com/WireGuard/snapshot/WireGuard-0.0.20181018.tar.xz
|
||
</span></span><span style="display:flex;"><span>root@d1728eaaa6e1:/# tar xf WireGuard-0.0.20181018.tar.xz
|
||
</span></span><span style="display:flex;"><span>root@d1728eaaa6e1:/# cd WireGuard-0.0.20181018/src/tools
|
||
</span></span><span style="display:flex;"><span>root@d1728eaaa6e1:/# make CC=aarch64-linux-gnu-gcc LDFLAGS=-static
|
||
</span></span><span style="display:flex;"><span>root@d1728eaaa6e1:/# exit
|
||
</span></span><span style="display:flex;"><span>% docker cp -L d1728eaaa6e1:/WireGuard-0.0.20181018/src/tools/wg .</span></span></code></pre></div>
|
||
<p>Now we can copy and run the <code>wg</code> binary via breakglass:</p>
|
||
<div class="highlight actionbar-wrapper wrap-code" dir="auto"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>/tmp/breakglass531810560 # wget http://10.0.0.76:4080/wg
|
||
</span></span><span style="display:flex;"><span>/tmp/breakglass531810560 # chmod +x wg
|
||
</span></span><span style="display:flex;"><span>/tmp/breakglass531810560 # ./wg --help
|
||
</span></span><span style="display:flex;"><span>Usage: ./wg <cmd> [<args>]
|
||
</span></span><span style="display:flex;"><span>…</span></span></code></pre></div>
|
||
<h2 id="c-software-tc">C software: tc<span class="btn cstyle anchor copyanchor scrollanchor link noborder notitle interactive"><button type="button" title="Copy link to clipboard"><i class="fa-fw fas fa-link fa-lg"></i></button></span></h2>
|
||
<p>Linux’s Traffic Control system (used e.g. for traffic shaping) is
|
||
configured with the <code>tc</code> tool.</p>
|
||
<p><code>tc</code> is a special case in that it requires to be
|
||
dynamically linked. The different queueing disciplines are
|
||
implemented as plugins, and statically linking <code>tc</code>
|
||
results in a binary which starts but won’t be able to display or
|
||
change queueing disciplines.</p>
|
||
<p>Because gokrazy doesn’t include a C runtime environment, we’ll need to copy not
|
||
only the <code>tc</code> binary, but also the dynamic loader and all required
|
||
shared libraries. We can run Debian in a Docker container to not mess with our
|
||
host system, and use the <a
|
||
href="https://github.com/gokrazy/freeze"><code>freeze</code> tool</a> to
|
||
automate the tedious parts of the process:</p>
|
||
<div class="highlight actionbar-wrapper wrap-code" dir="auto"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>% docker run -t -i debian:trixie
|
||
</span></span><span style="display:flex;"><span>root@6e530a973d45:/# dpkg --add-architecture arm64
|
||
</span></span><span style="display:flex;"><span>root@6e530a973d45:/# apt update
|
||
</span></span><span style="display:flex;"><span>root@6e530a973d45:/# apt install iproute2:arm64 qemu-user-static golang-go ca-certificates
|
||
</span></span><span style="display:flex;"><span>root@6e530a973d45:/# go install github.com/gokrazy/freeze/cmd/...@latest
|
||
</span></span><span style="display:flex;"><span>root@6e530a973d45:/# ~/go/bin/freeze -wrap=qemu-aarch64-static $(which tc)
|
||
</span></span><span style="display:flex;"><span>2022/03/20 11:45:46 /sbin/tc
|
||
</span></span><span style="display:flex;"><span>2022/03/20 11:45:46 Copying tc together with its 12 ELF shared library dependencies
|
||
</span></span><span style="display:flex;"><span>2022/03/20 11:45:46 [cp /sbin/tc /tmp/freeze2237965672/tc]
|
||
</span></span><span style="display:flex;"><span>2022/03/20 11:45:46 [cp /usr/lib/aarch64-linux-gnu/libbpf.so.0.7.0 /tmp/freeze2237965672/libbpf.so.0]
|
||
</span></span><span style="display:flex;"><span>2022/03/20 11:45:46 [cp /usr/lib/aarch64-linux-gnu/libelf-0.186.so /tmp/freeze2237965672/libelf.so.1]
|
||
</span></span><span style="display:flex;"><span>2022/03/20 11:45:46 [cp /usr/lib/aarch64-linux-gnu/libmnl.so.0.2.0 /tmp/freeze2237965672/libmnl.so.0]
|
||
</span></span><span style="display:flex;"><span>2022/03/20 11:45:46 [cp /usr/lib/aarch64-linux-gnu/libbsd.so.0.11.5 /tmp/freeze2237965672/libbsd.so.0]
|
||
</span></span><span style="display:flex;"><span>2022/03/20 11:45:46 [cp /lib/aarch64-linux-gnu/libcap.so.2.44 /tmp/freeze2237965672/libcap.so.2]
|
||
</span></span><span style="display:flex;"><span>2022/03/20 11:45:46 [cp /lib/aarch64-linux-gnu/libm-2.33.so /tmp/freeze2237965672/libm.so.6]
|
||
</span></span><span style="display:flex;"><span>2022/03/20 11:45:46 [cp /lib/aarch64-linux-gnu/libdl-2.33.so /tmp/freeze2237965672/libdl.so.2]
|
||
</span></span><span style="display:flex;"><span>2022/03/20 11:45:46 [cp /usr/lib/aarch64-linux-gnu/libxtables.so.12.4.0 /tmp/freeze2237965672/libxtables.so.12]
|
||
</span></span><span style="display:flex;"><span>2022/03/20 11:45:46 [cp /lib/aarch64-linux-gnu/libc-2.33.so /tmp/freeze2237965672/libc.so.6]
|
||
</span></span><span style="display:flex;"><span>2022/03/20 11:45:46 [cp /lib/aarch64-linux-gnu/ld-2.33.so /tmp/freeze2237965672/ld-linux-aarch64.so.1]
|
||
</span></span><span style="display:flex;"><span>2022/03/20 11:45:46 [cp /lib/aarch64-linux-gnu/libz.so.1.2.11 /tmp/freeze2237965672/libz.so.1]
|
||
</span></span><span style="display:flex;"><span>2022/03/20 11:45:46 [cp /usr/lib/aarch64-linux-gnu/libmd.so.0.0.5 /tmp/freeze2237965672/libmd.so.0]
|
||
</span></span><span style="display:flex;"><span>2022/03/20 11:45:46 [tar cf /tmp/freeze2237965672.tar freeze2237965672]
|
||
</span></span><span style="display:flex;"><span>2022/03/20 11:45:46 Download freeze2237965672.tar to your gokrazy device and run:
|
||
</span></span><span style="display:flex;"><span> LD_LIBRARY_PATH=$PWD ./ld-linux-aarch64.so.1 ./tc
|
||
</span></span><span style="display:flex;"><span>root@6e530a973d45:/# exit
|
||
</span></span><span style="display:flex;"><span>% mkdir /tmp/freeze
|
||
</span></span><span style="display:flex;"><span>% cd /tmp/freeze
|
||
</span></span><span style="display:flex;"><span>% docker cp 6e530a973d45:/tmp/freeze2237965672.tar .
|
||
</span></span><span style="display:flex;"><span>% caddy file-server -listen=:4080</span></span></code></pre></div>
|
||
<p>Now we can copy the contents of the temporary directory to
|
||
e.g. <code>/perm/tc</code> and run the <code>tc</code> command in
|
||
breakglass:</p>
|
||
<div class="highlight actionbar-wrapper wrap-code" dir="auto"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>/tmp/breakglass531810560 # wget -O- http://10.0.0.76:4080/freeze2237965672.tar | tar xf -
|
||
</span></span><span style="display:flex;"><span>/tmp/breakglass531810560 # cd freeze2237965672
|
||
</span></span><span style="display:flex;"><span>/tmp/breakglass531810560/freeze2237965672 # LD_LIBRARY_PATH=$PWD ./ld-linux-aarch64.so.1 ./tc
|
||
</span></span><span style="display:flex;"><span>Usage: tc [ OPTIONS ] OBJECT { COMMAND | help }
|
||
</span></span><span style="display:flex;"><span>…</span></span></code></pre></div>
|
||
|
||
<footer class="footline">
|
||
</footer>
|
||
</article>
|
||
</div>
|
||
</main>
|
||
</div>
|
||
<aside id="R-sidebar" class="default-animation">
|
||
<div id="R-header-topbar" class="default-animation"></div>
|
||
<div id="R-header-wrapper" class="default-animation">
|
||
<div id="R-header" class="default-animation">
|
||
<img src="/logo.svg" width="100%" alt="gokrazy logo" title="gokrazy logo">
|
||
|
||
</div>
|
||
<search><form action="/search/index.html" method="get">
|
||
<div class="searchbox default-animation">
|
||
<button class="search-detail" type="submit" title="Search (CTRL+ALT+f)"><i class="fas fa-search"></i></button>
|
||
<label class="a11y-only" for="R-search-by">Search</label>
|
||
<input data-search-input id="R-search-by" name="search-by" class="search-by" type="search" placeholder="Search...">
|
||
<button class="search-clear" type="button" data-search-clear="" title="Clear search"><i class="fas fa-times" title="Clear search"></i></button>
|
||
</div>
|
||
</form></search>
|
||
</div>
|
||
<div id="R-homelinks" class="default-animation homelinks">
|
||
<div class="R-menu-divider default-animation">
|
||
<hr class="padding">
|
||
</div>
|
||
<div class="R-sidebarmenu R-shortcutmenu-homelinks">
|
||
<ul class="space collapsible-menu">
|
||
<li class="" data-nav-url="/index.html"><a class="padding" href="/index.html"><i class="fa-fw fas fa-home"></i> Home</a></li>
|
||
</ul>
|
||
</div>
|
||
<div class="R-menu-divider default-animation">
|
||
<hr class="padding">
|
||
</div>
|
||
<div class="R-sidebarmenu R-shortcutmenu-headercontrols">
|
||
<ul class="">
|
||
</ul>
|
||
</div>
|
||
<div class="R-menu-divider default-animation">
|
||
<hr class="padding">
|
||
</div>
|
||
</div>
|
||
<div id="R-content-wrapper" class="highlightable">
|
||
<div class="R-sidebarmenu R-shortcutmenu-main">
|
||
<ul class="enlarge morespace collapsible-menu">
|
||
<li class="" data-nav-url="/quickstart/index.html"><a class="padding" href="/quickstart/index.html"><b>1. </b>Quickstart</a></li>
|
||
<li class="" data-nav-url="/platforms/index.html"><a class="padding" href="/platforms/index.html"><b>2. </b>Supported platforms</a></li>
|
||
<li class="" data-nav-url="/userguide/index.html"><a class="padding" href="/userguide/index.html"><b>3. </b>Configuration</a><ul id="R-subsections-74b4df3a3d9365853f09e9f1dfe7bbba" class="collapsible-menu"></ul></li>
|
||
<li class="" data-nav-url="/packages/index.html"><a class="padding" href="/packages/index.html"><b>4. </b>Available packages</a><ul id="R-subsections-bdf1e8ce92aa8ff6883c617f10480430" class="collapsible-menu"></ul></li>
|
||
<li class="parent " data-nav-url="/development/index.html"><a class="padding" href="/development/index.html"><b>5. </b>Package development</a><ul id="R-subsections-54b0ce3c97b111c8cd4d107325fd580c" class="collapsible-menu">
|
||
<li class="" data-nav-url="/development/process-interface/index.html"><a class="padding" href="/development/process-interface/index.html">Process interface / requirements</a></li>
|
||
<li class="" data-nav-url="/development/gpio/index.html"><a class="padding" href="/development/gpio/index.html">Controlling a GPIO input/output pin</a></li>
|
||
<li class="" data-nav-url="/development/modules/index.html"><a class="padding" href="/development/modules/index.html">Working with Go modules</a></li>
|
||
<li class="" data-nav-url="/development/buildtags/index.html"><a class="padding" href="/development/buildtags/index.html">The gokrazy Go build tag</a></li>
|
||
<li class="active " data-nav-url="/development/non-go/index.html"><a class="padding" href="/development/non-go/index.html">Non-Go Prototyping</a></li></ul></li>
|
||
</ul>
|
||
</div>
|
||
<div class="R-sidebarmenu R-shortcutmenu-shortcuts">
|
||
<div class="nav-title padding">More</div>
|
||
<ul class="space collapsible-menu">
|
||
<li class="" data-nav-url="https://github.com/gokrazy/gokrazy"><a class="padding" href="https://github.com/gokrazy/gokrazy" rel="external"><i class='fab fa-github'></i> GitHub repo</a></li>
|
||
</ul>
|
||
</div>
|
||
<div id="R-footer-margin"></div>
|
||
<div class="R-menu-divider default-animation">
|
||
<hr class="padding">
|
||
</div>
|
||
<div class="R-sidebarmenu R-shortcutmenu-footercontrols">
|
||
<ul class="">
|
||
</ul>
|
||
</div>
|
||
<div id="R-footer"><p>Built with <a href="https://github.com/McShelby/hugo-theme-relearn" title="love"><i class="fas fa-heart"></i></a> by <a href="https://gohugo.io/">Hugo</a></p></div>
|
||
</div>
|
||
</aside>
|
||
<script src="/js/perfect-scrollbar/perfect-scrollbar.min.js?1782408721" defer></script>
|
||
<script src="/js/theme.min.js?1782408721" defer></script>
|
||
<div id="toast-container" role="status" aria-live="polite" aria-atomic="false"></div>
|
||
</body>
|
||
</html>
|