Commit 0c1370b5 authored by Yuval Adam's avatar Yuval Adam

Initial static build

parent 91d00222
*.pyc
__pycache__
build/
\ No newline at end of file
This diff is collapsed.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>postmarketOS</title>
<meta name="description" content="Aiming for a 10 year life-cycle for smartphones">
<meta name="keywords" content="postmarketOS">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="all">
<link rel="canonical" href="https://postmarketos.org/blog/">
<link href="/static/css/tachyons.min.css" rel="stylesheet">
<link href="/static/css/main.css" rel="stylesheet">
</head>
<body>
<div class="mw7 center">
<div class="cf ph2-ns">
<a class="title" href="/">
<h1 class="f2 lh-title">
<img src="/static/img/recycle.png"></img>
<span>postmarketOS</span>
</h1>
</a>
<div class="menu">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/wiki/">Wiki</a></li>
<li><a href="/blog/">Blog</a></li>
</ul>
</div>
<ul>
<li><a href="/blog/2017/05/26/intro/">intro</a></li>
</ul>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>postmarketOS</title>
<meta name="description" content="Aiming for a 10 year life-cycle for smartphones">
<meta name="keywords" content="postmarketOS">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="all">
<link rel="canonical" href="https://postmarketos.org/">
<link href="/static/css/tachyons.min.css" rel="stylesheet">
<link href="/static/css/main.css" rel="stylesheet">
</head>
<body>
<div class="mw7 center">
<div class="cf ph2-ns">
<a class="title" href="/">
<h1 class="f2 lh-title">
<img src="/static/img/recycle.png"></img>
<span>postmarketOS</span>
</h1>
</a>
<div class="menu">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/wiki/">Wiki</a></li>
<li><a href="/blog/">Blog</a></li>
</ul>
</div>
<div class="fl w-100 w-50-ns pa2">
<img src="/static/img/banner.jpg"></img>
</div>
<div class="fl w-100 w-50-ns pa2">
<p class="intro">postmarketOS (<i>pmOS</i>), is a touch-optimized, pre-configured <a href="https://alpinelinux.org">Alpine Linux</a> that can be installed on smartphones and other mobile devices. The project is at very early stages of development and is not yet usable for most users.</p>
<p class="intro">For further details read our <a href="/blog/2017/05/26/intro/">introductory blog post</a>.</p>
<p>Find us on:</p>
<ul>
<li><a href="https://github.com/postmarketOS">GitHub</a></li>
<li><a href="https://reddit.com/r/postmarketOS">/r/postmarketOS</a></li>
<li><a href="https://chat.disroot.org/#/room/#postmarketos:disroot.org">#postmarketos:disroot.org</a></li>
<li>#postmarketos on Freenode IRC</li>
</ul>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
a.title {
text-decoration: none;
color: black;
}
a.title h1 img {
height: 1.4em;
}
a.title h1 span {
vertical-align: top;
}
div.menu ul {
list-style: none;
padding-left: 7px;
}
div.menu ul li {
display: inline-block;
padding-right: 1.3em;
}
div.menu ul li a {
font-size: 1.2em;
color: #444;
text-decoration: none;
}
p.intro {
font-size: 1.3em;
line-height: 1.3em;
margin-top: 0px;
}
This diff is collapsed.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>postmarketOS</title>
<meta name="description" content="Aiming for a 10 year life-cycle for smartphones">
<meta name="keywords" content="postmarketOS">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="all">
<link rel="canonical" href="https://postmarketos.org/wiki/Battery-replacement/">
<link href="/static/css/tachyons.min.css" rel="stylesheet">
<link href="/static/css/main.css" rel="stylesheet">
</head>
<body>
<div class="mw7 center">
<div class="cf ph2-ns">
<a class="title" href="/">
<h1 class="f2 lh-title">
<img src="/static/img/recycle.png"></img>
<span>postmarketOS</span>
</h1>
</a>
<div class="menu">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/wiki/">Wiki</a></li>
<li><a href="/blog/">Blog</a></li>
</ul>
</div>
<h1>Battery replacement</h1>
<p><em>Add replacement guides and experiences you've made with with batteries bought online here. Be careful, some batteries do not work as good as advertised or might even explode. Do your research on the vendor, before buying.</em></p>
<h3>Guides</h3>
<p><em>TODO</em></p>
<h3>Bad vendors</h3>
<h4>UltraFire</h4>
<ul>
<li><a href="https://www.s-config.com/bad-batteries-china-ultrafire-3500mah/">source</a></li>
<li><a href="http://www.candlepowerforums.com/vb/showthread.php?316888-Fake-Ultrafire-18650-battery-warning">source</a></li>
</ul>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>postmarketOS</title>
<meta name="description" content="Aiming for a 10 year life-cycle for smartphones">
<meta name="keywords" content="postmarketOS">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="all">
<link rel="canonical" href="https://postmarketos.org/wiki/BlackBerry-Bold-Touch-9900-(Dakota)/">
<link href="/static/css/tachyons.min.css" rel="stylesheet">
<link href="/static/css/main.css" rel="stylesheet">
</head>
<body>
<div class="mw7 center">
<div class="cf ph2-ns">
<a class="title" href="/">
<h1 class="f2 lh-title">
<img src="/static/img/recycle.png"></img>
<span>postmarketOS</span>
</h1>
</a>
<div class="menu">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/wiki/">Wiki</a></li>
<li><a href="/blog/">Blog</a></li>
</ul>
</div>
<h1>BlackBerry Bold Touch 9900 (Dakota)</h1>
<h3>Contributors</h3>
<ul>
<li>drebrez</li>
</ul>
<h3>What works</h3>
<ul>
<li>Nothing yet</li>
</ul>
<h3>What does not work</h3>
<ul>
<li>Everything else</li>
</ul>
<h3>Device info</h3>
<ul>
<li>Firmware v7.1.0.1033 (Bundle 2807)</li>
<li>Platform 5.1.0.692</li>
<li>Cryptographic Kernel v3.8.7.6</li>
</ul>
<h3>RIM Wireless Device Command-Line Programmer</h3>
<ul>
<li><code>CFP INFO</code> =&gt; <a href="https://pastebin.com/aQNrCdhD">output</a></li>
<li><code>CFP FLASHINFO</code> =&gt; <a href="https://pastebin.com/mKEsFiTA">output</a></li>
</ul>
<h3>Useful Links</h3>
<ul>
<li><a href="http://www.gsmarena.com/blackberry_bold_touch_9900-3116.php">Full phone specifications</a> </li>
<li><a href="http://bbsak.org/">BlackBerry Swiss Army Knife</a> </li>
<li><a href="https://forums.crackberry.com/hybrid-os-f224/hybrid-os7-1-babyluv-barracuda-series-5-9220-93x0-9790-98x0-99xx-727201/">Hybrid OS7.1 Babyluv by Barracuda Series 5</a></li>
<li><a href="http://dsync.blogspot.ch/2014/10/tutorial-custom-upgrade-blackberry-os.html">Custom Upgrade BlackBerry OS 7.1 Walkthrough</a></li>
</ul>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>postmarketOS</title>
<meta name="description" content="Aiming for a 10 year life-cycle for smartphones">
<meta name="keywords" content="postmarketOS">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="all">
<link rel="canonical" href="https://postmarketos.org/wiki/Boot-process/">
<link href="/static/css/tachyons.min.css" rel="stylesheet">
<link href="/static/css/main.css" rel="stylesheet">
</head>
<body>
<div class="mw7 center">
<div class="cf ph2-ns">
<a class="title" href="/">
<h1 class="f2 lh-title">
<img src="/static/img/recycle.png"></img>
<span>postmarketOS</span>
</h1>
</a>
<div class="menu">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/wiki/">Wiki</a></li>
<li><a href="/blog/">Blog</a></li>
</ul>
</div>
<h1>Boot process</h1>
<p>Have you already flashed your device with pmOS? Now it's time to run it.</p>
<p>Power on your device and connect it to your USB port. pmOS uses the USB interface as a network interface and runs a DHCP server on it and <code>dmesg</code> will show something like</p>
<pre class="codehilite"><code>[ 6284.442088] usb 1-1: new high-speed USB device number 36 using xhci_hcd
[ 6284.627106] usb 1-1: New USB device found, idVendor=18d1, idProduct=d001
[ 6284.627123] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 6284.627134] usb 1-1: Product: Android
[ 6284.627143] usb 1-1: Manufacturer: Android
[ 6284.627151] usb 1-1: SerialNumber: 0123456789ABCDEF
[ 6284.632322] rndis_host 1-1:1.0 usb0: register 'rndis_host' at usb-0000:00:14.0-1, RNDIS device, b2:c4:1e:03:64:b9
[ 6285.239048] rndis_host 1-1:1.0 enp0s20f0u1: renamed from usb0
[ 6285.287058] IPv6: ADDRCONF(NETDEV_UP): enp0s20f0u1: link is not ready</code></pre>
<p>And you'll have a new interface with IP in the range 172.16.42.0/24</p>
<pre class="codehilite"><code>$ ifconfig enp0s20f0u1
enp0s20f0u1 Link encap:Ethernet HWaddr b2:c4:1e:03:64:b9
inet addr:172.16.42.107 Bcast:172.16.42.255 Mask:255.255.255.0
inet6 addr: fe80::dbd2:4531:89f2:d2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:47 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1226 (1.2 KB) TX bytes:8375 (8.3 KB)</code></pre>
<p>It the interface doesn't automatically get an IP address on your system (for example on systems without NetworkManager) you need to start a dhcp client to get one.</p>
<pre class="codehilite"><code class="language-bash"># Replace the interface name with the one on your machine
$ dhclient -v enp0s20f0u1</code></pre>
<p>If this fails, you may need to first assign an ethernet address to it:</p>
<pre class="codehilite"><code># ip l set enp0s20f0u1 address 12:12:12:12:12:12</code></pre>
<p>Then you can try the above dhclient command.</p>
<p>At this point, your device will show a logo and will be waiting for you to connect using telnet and enter the password to decrypt the filesystem (Make sure the last segment of the IP address is a "1" and not what is shown in the output of <code>ifconfig</code>!).</p>
<pre class="codehilite"><code>telnet 172.16.42.1
Trying 172.16.42.1...
Connected to 172.16.42.1.
Escape character is '^]'.
Enter passphrase for /dev/mapper/mmcblk0p25p2:
Connection closed by foreign host.</code></pre>
<p>After entering the password, you'll get disconnected and the graphic interface will show up in your device.</p>
<p>Congratulations, you are now running postmarketOS!</p>
<p>From now on you can also login to your device using <code>ssh</code> and the password you set during the install phase</p>
<pre class="codehilite"><code>$ ssh user@172.16.42.1
user@172.16.42.1's password:
Welcome to postmarketOS!
This distribution is based on Alpine Linux.
Read both our wikis to find a large amount of how-to guides and
general information about administrating and development.
See &lt;https://postmarketos.org/wiki&gt; and &lt;https://wiki.alpinelinux.org&gt;.
You may change this message by editing /etc/motd.
localhost:~$</code></pre>
<p>Use <code>sudo</code> to run commands as <code>root</code>, it is configured.</p>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>postmarketOS</title>
<meta name="description" content="Aiming for a 10 year life-cycle for smartphones">
<meta name="keywords" content="postmarketOS">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="all">
<link rel="canonical" href="https://postmarketos.org/wiki/Build-internals/">
<link href="/static/css/tachyons.min.css" rel="stylesheet">
<link href="/static/css/main.css" rel="stylesheet">
</head>
<body>
<div class="mw7 center">
<div class="cf ph2-ns">
<a class="title" href="/">
<h1 class="f2 lh-title">
<img src="/static/img/recycle.png"></img>
<span>postmarketOS</span>
</h1>
</a>
<div class="menu">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/wiki/">Wiki</a></li>
<li><a href="/blog/">Blog</a></li>
</ul>
</div>
<h1>Build internals</h1>
<p>To build a package with <code>pmbootstrap</code>, you will only need the command <code>pmbootstrap build hello-world</code>. Optionally with <code>--force</code> to build even if the package was already built, and with <code>--arch=armhf</code> to build for another architecture, replace <code>armhf</code> accordingly. This wiki page lists some more information about what is going on in the background.</p>
<h3>initramfs</h3>
<p>The <a href="https://en.wikipedia.org/wiki/Initramfs">initramfs</a> shows the boot splash images, and allows the root partition to be unlocked (currently via telnet). You can add a hook to inspect the initramfs running on the device, as described in [[Inspecting the initramfs]].</p>
<p>To rebuild the initramfs, run <code>mkinitfs</code> inside the chroot with the right parameters (or - much easier - <code>pmbootstrap initfs build</code>). This gets done automatically, whenever a new kernel gets installed, or when the <code>postmarketos-mkinitfs</code> package gets installed the first time.</p>
<h3>pmbootstrap vs. abuild</h3>
<p><code>pmbootstrap</code> wraps around <code>abuild</code> (Alpine's official program to build [[apks|Glossary#apk]]), but it does a few things different than <code>abuild</code> (which internally often calls <code>apk</code>):
<em> <code>pmbootstrap</code> can cross-compile out of the box, utilizing different chroots as needed (see below for details)
</em> <code>pmbootstrap</code> does dependency parsing on its own (so it works across the <code>aports</code> folder <em>and</em> the binary repository, also with <a href="https://ollieparanoid.github.io/post/50-days-of-postmarketOS/#timestamp-based-rebuilds">timestamp based rebuilds</a> and can detect across chroots when a package is outdated and explicitly install them).
<em> <code>pmbootstrap</code> does </em>not<em> honor operators in dependencies, such as: <code>&lt;</code>, <code>&gt;</code>, <code>=</code>, <code>!</code>. These simply get ignored (<code>!</code> packages don't count as dependencies). This may lead to errors, if it does please report them. However, since we're calling <code>apk</code> to install the packages, it does the real dependency checking and so far it's working well enough.
</em> <code>pmbootstrap</code> parses <code>APKINDEX</code> and <code>APKBUILD</code> files on its own.
<em> <code>APKINDEX</code> parsing is considered to be pretty good (because the format is dead simple!)
</em> <code>APKBUILD</code> parsing would require a shell to be done perfectly (which would in turn kill performance). The way it is implemented right now, is that the variables we care about are hardcoded inside the <code>pbm/config/__config.py</code> or if not possible otherwise directly in <code>pmb/parse/apkbuild.py</code>. That is really fast and works for all packages we care about. If it breaks somewhere, it should be easy to patch.
<em> <code>pmbootstrap</code> does not remove build dependencies after a build is done. This is for performance reasons - if you want a clean stat, run <code>pmbootstrap zap</code>.
</em> <code>pmbootstrap</code> has a hack right now, that <code>gzip</code> always uses weak compression (also for speed)</p>
<h3>Cross-compile types</h3>
<p>There are two cross-compile types supported. <a href="https://github.com/postmarketOS/pmbootstrap/blob/master/pmb/build/autodetect.py"><code>pmb.build.autodetect.crosscompile()</code></a> figures out, which one is the right one for each build.
<em> <code>None</code>: The package does not have any binaries (<a href="https://wiki.alpinelinux.org/wiki/APKBUILD#arch"><code>noarch</code></a>), it ends in <code>-repack</code> (such as <a href="https://github.com/postmarketOS/pmbootstrap/tree/master/aports/qemu-user-static-repack">qemu-user-static-repack</a>) or the target architecture is the same as the "native" architecture (e.g. compiling <code>heimdall</code> for <code>x86_64</code> on an <code>x86_64</code> system).
</em> <code>"native"</code>: the build system of the package understands cross-compiling, like all kernel packages. We can use the native chroot with the cross-compiler inside that chroot for maximum speed.
<em> <code>"distcc"</code>: the build system of the package does </em>not* understand cross-compiling, so we run the whole compiling process inside a chroot with the target architecture (with qemu user mode emulation, this is slow). We avoid using qemu emulation for the compiler though, because we use the cross-compiler inside the native chroot through distcc (which was originally meant to share compiling efforts across the network, but it works for this case. <a href="https://archlinuxarm.org/wiki/Distcc_Cross-Compiling">Arch Linux ARM also does this</a> and has a detailed description of how to set this up manually.)</p>
<h3>Caches</h3>
<p><code>pmbootstrap</code> uses various caches. They can all be found inside the <code>work</code> folder, and start with <code>cache_</code>. All cache folders get mounted to the appropriate chroots, depending on $ARCH. They are shared among the chroots, when it makes sense (e.g. <code>cache_distfiles</code>).
<em> <code>cache_apk_$ARCH</code>: APK files from binary repositories (see also: <a href="https://wiki.alpinelinux.org/wiki/Local_APK_cache#To_manually_enable_Local_Cache_on_HDD_install">Local APK cache</a>)
</em> <code>cache_ccache_$ARCH</code>: ccache: Whenever you compile something with <code>pmbootstrap</code>, the output gets cached in this folder (depending on the architecture). When you compile the same code for the second time, the cached output gets used, thus saving you a lot of time (think of re-compiling kernels, because you want to test another kernel config option etc.)
<em> <code>cache_distfiles</code>: Whenever you build a package, <code>abuild</code> (which pmbootstrap wraps) will download the source files to the <code>distfiles</code> cache (and skip these downloads, when they already exist). The exact file name can be controlled inside the APKBUILD (<a href="https://wiki.alpinelinux.org/wiki/APKBUILD_Reference#source">more info</a>).
</em> <code>cache_git</code>: <code>pmbootstrap</code> can download git repositories. This gets used in <code>pmbootstrap aportgen</code>, which copies a package (aka. aport) from Alpine Linux and customizes it (for example: <code>gcc-armhf</code>), so we inherit all patches and changes automatically, without much maintenance work. The git repos get stored inside this folder.
* <code>cache_http</code>: This stores files, that get downloaded with <a href="https://github.com/postmarketOS/pmbootstrap/blob/master/pmb/helpers/http.py"><code>pmb.helpers.http.download()</code></a>, so they don't need to be downloaded again every time. Currently, this gets used for the initial download of Alpine Linux' main repositories <code>APKINDEX.tar.gz</code> and <a href="https://pkgs.alpinelinux.org/package/edge/main/armhf/apk-tools-static">apk-tools-static</a> (which is a static build of the <code>apk</code> package manager, used to set up the chroot).</p>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>postmarketOS</title>
<meta name="description" content="Aiming for a 10 year life-cycle for smartphones">
<meta name="keywords" content="postmarketOS">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="all">
<link rel="canonical" href="https://postmarketos.org/wiki/Coolpad-Sky-3-E502-(Modena-2)/">
<link href="/static/css/tachyons.min.css" rel="stylesheet">
<link href="/static/css/main.css" rel="stylesheet">
</head>
<body>
<div class="mw7 center">
<div class="cf ph2-ns">
<a class="title" href="/">
<h1 class="f2 lh-title">
<img src="/static/img/recycle.png"></img>
<span>postmarketOS</span>
</h1>
</a>
<div class="menu">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/wiki/">Wiki</a></li>
<li><a href="/blog/">Blog</a></li>
</ul>
</div>
<h1>Coolpad Sky 3 E502 (Modena 2)</h1>
<h3>Contributor</h3>
<ul>
<li><a href="https://github.com/McBitter">McBitter</a></li>
</ul>
<h3>Status</h3>
<p>Flashing a custom kernel is not possible yet, but McBitter is working on replacing the bootloader with a custom fork of <a href="https://github.com/littlekernel/lk">LK</a> (a proprietary fork of LK is already present on the device, but it does not allow flashing a custom kernel). When that works, porting pmOS can begin.</p>
<h4>List of LCM's (the LCD control module) in original firmware</h4>
<ul>
<li>hx8394f_dsi_ld_cpt_vdo</li>
<li>ili9881c_dsi_ys_cmi_vdo</li>
<li>otm1287a_dsi_by_auo</li>
<li>ili9881c_dsi_ld_auo_vdo</li>
</ul>
<h4>Digitizer that is present on the model I have</h4>
<ul>
<li>TBD</li>
</ul>
<h3>Links</h3>
<ul>
<li><a href="https://forum.xda-developers.com/u/repair/coolpad-sky-3-e502-modena-2-unbrick-t3610163">Unbrick tutorial</a></li>
<li><a href="https://androidmtk.com/smart-phone-flash-tool">Proprietary flashing software SP Flash Tool</a></li>
<li><a href="https://gitgud.io/mcbitter/coolpad_sky_3_E502">Original firmware with Android 6.0</a></li>
</ul>
<h3>Links to useful reverse engineering hints</h3>
<ul>
<li>http://www.stevenhoneyman.co.uk/2015/02/reconstructing-mtk-lcm-drivers.html</li>
<li>https://forum.xda-developers.com/showpost.php?p=70395172&amp;postcount=5882</li>
</ul>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>postmarketOS</title>
<meta name="description" content="Aiming for a 10 year life-cycle for smartphones">
<meta name="keywords" content="postmarketOS">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="all">
<link rel="canonical" href="https://postmarketos.org/wiki/Creating-a-package/">
<link href="/static/css/tachyons.min.css" rel="stylesheet">
<link href="/static/css/main.css" rel="stylesheet">
</head>
<body>
<div class="mw7 center">
<div class="cf ph2-ns">
<a class="title" href="/">
<h1 class="f2 lh-title">
<img src="/static/img/recycle.png"></img>
<span>postmarketOS</span>
</h1>
</a>
<div class="menu">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/wiki/">Wiki</a></li>
<li><a href="/blog/">Blog</a></li>
</ul>
</div>
<h1>Creating a package</h1>
<p>Here is a practical approach on how to port packages from other Linux distributions to pmOS (because that is usually the fastest way). Feel free to extend this information, and to add other distributions.</p>
<h3>General information</h3>
<ul>
<li>Please read <a href="https://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package#APKBUILD_variables.2Ffunctions">this section</a> from our upstream friends wiki (<em>which we should also extend and improve</em>)</li>
<li>Please always package the latest version of a software (unless it is impossible because of software that depends on it, but try to avoid that!)</li>
<li>Please do not copy maintainers/contributors from the other packages to your new ports (so they won't get annoyed by questions for pmOS/Alpine packages!). Instead please credit them in the commit messages (maybe with a link to the original build recipe)</li>
<li>Alpine Linux uses <code>musl</code> as libc, not <code>glibc</code>. Never add <code>glibc</code> as dependency.</li>
<li>Alpine uses busybox' <code>sh</code> for building packages. Do not use bash specific features.</li>
<li>Manpages and other documentation goes into an extra -doc package in Alpine, and abuild will complain if the main package contains them. The solution is to add this: <code>subpackages="$pkgname-doc"</code> (<a href="https://wiki.alpinelinux.org/wiki/APKBUILD_Reference#doc.28.29">more info</a>)</li>
<li>You can look up the exact meaning of every variable and function in the <a href="https://wiki.alpinelinux.org/wiki/APKBUILD_Reference">APKBUILD Reference</a></li>
<li>Set up the git hook from the [[development guide]] article to automatically verify checksums in your APKBUILDs and therefore making your life easier</li>
</ul>
<h3>Porting packages from Arch Linux</h3>
<h4>Find the package</h4>
<p><a href="https://www.archlinux.org/packages/">Search here</a>, click the package name, click on "Source Files" on the top right. A git repo with the <code>PKGBUILD</code> and all other files (such as patches appears).</p>
<h4>Differences between APKBUILDs and PKGBUILDs</h4>
<ul>
<li><code>APKBUILD</code>s do not have the arrays from bash, use flat strings instead</li>
<li>There's no <code>optdepends</code></li>
<li><code>-doc</code> subpackages (see above)</li>
<li><code>APKBUILD</code> has different options (!makeflags won't work, but it has !strip and !check)</li>
</ul>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>postmarketOS</title>
<meta name="description" content="Aiming for a 10 year life-cycle for smartphones">
<meta name="keywords" content="postmarketOS">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="all">
<link rel="canonical" href="https://postmarketos.org/wiki/Development-guide/">
<link href="/static/css/tachyons.min.css" rel="stylesheet">
<link href="/static/css/main.css" rel="stylesheet">
</head>
<body>
<div class="mw7 center">
<div class="cf ph2-ns">
<a class="title" href="/">
<h1 class="f2 lh-title">
<img src="/static/img/recycle.png"></img>
<span>postmarketOS</span>
</h1>
</a>
<div class="menu">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/wiki/">Wiki</a></li>
<li><a href="/blog/">Blog</a></li>
</ul>
</div>
<h1>Development guide</h1>
<h2>Tips</h2>
<p>If happens often that we commit changes and then we realize that we forgot to regenerate APKBUILD checksums. This is noticed by Travis (<a href="https://travis-ci.org/postmarketOS/pmbootstrap/builds/261056579">example</a>) but you might want to avoid it. </p>
<p>You can install the following git hook that is run every time before you commit. </p>
<p>Copy the following code to <code>.git/hooks/pre-commit</code> inside your <code>pmbootstrap</code> repository:</p>
<pre class="codehilite"><code class="language-bash">#!/bin/bash
#
# PostmarketOS pre-commit hook
# Checks for bad checksums
./test/check_checksums.py</code></pre>
<p>Now this is what happens when you forgot to regenerate checksums for some aport and try to commit</p>
<pre class="codehilite"><code class="language-bash">$ git commit -a
Checking device-qemu-aarch64 for correct checksums
[13:45:23] (native) generate checksums for device-qemu-aarch64
[13:45:23] Done
MM aports/device/device-qemu-aarch64/APKBUILD
diff --git a/aports/device/device-qemu-aarch64/APKBUILD b/aports/device/device-qemu-aarch64/APKBUILD
index 99b811b..c4cee6c 100644
--- a/aports/device/device-qemu-aarch64/APKBUILD
+++ b/aports/device/device-qemu-aarch64/APKBUILD
@@ -21,4 +21,4 @@ package() {
&quot;$pkgdir&quot;/etc/deviceinfo
}
-sha512sums=&quot;a18ab789c19d8802be6a9e9c842f4c304f267bd78f46b096b4ba6609430d1544e0a9eca9bc22db67a0728efae3aad6c2def9f7e64157d31aeb31b4bb839076d5 deviceinfo&quot;
+sha512sums=&quot;8df46383685a40a96b7c604c29d413ecdd4b4a9b92cb61f452283042f189b1ca01cb70632fec0711dd67229e0501729762c6841359ac7ea455f516b512abce9c deviceinfo&quot;
** The checksums are not correct</code></pre>
<p>After that, simply do <code>git commit -a --amend -n</code> (<code>-n</code> is necessary so that this time the hook is not triggered).</p>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>postmarketOS</title>
<meta name="description" content="Aiming for a 10 year life-cycle for smartphones">
<meta name="keywords" content="postmarketOS">