nyuuzyou/wikis huggingface dataset:
Pmbootstrap/Cross Compiling

This article explains how pmbootstrap builds foreign arch packages. Depending on the package type, one of these methods is used:
* Native: kernels, bootloaders, firmware packages
* Crossdirect: everything else
* QEMU: fallback if crossdirect does not work (slow)
== Native ==
Set options="pmb:cross-native" in the APKBUILD to use this method. pmaports CI scripts ensure that linux packages etc. use this method.
This is the fastest method, it gets used when the package does not have any dependencies on packages in the target architecture. pmbootstrap runs Alpine's abuild in the native chroot, installs the cross compiler related packages and sets environment variables like CARCH, CROSS_COMPILE and CC to instruct abuild and the kernels' build system (that also gets used in u-boot) to produce a foreign arch package.
== Crossdirect ==
pmbootstrap uses this method by default.
The native chroot gets mounted in the foreign arch chroot (e.g. armhf) at /native. The crossdirect package gets installed into the native chroot, and creates wrapper scripts:
* /native/usr/lib/crossdirect/armhf/gcc -> /native/usr/bin/armv6-alpine-linux-muslgnueabihf-gcc
* /native/usr/lib/crossdirect/armhf/rustc -> /native/usr/bin/rustc --target=armv6-alpine-linux-musleabihf …
When building packages in the armhf chroot, PATH will get prepended with /native/usr/lib/crossdirect/armhf. This leads to invoking the cross compiler from the native chroot, running at native speed, whenever calling the compiler from the foreign arch chroot.
=== Rust ===
Rust support in crossdirect is still experimental. (cross/crossdirect: improve rust handling) describes some of the problems with it.
==== CARGO_HOME ====
If a program needs to download git repositories of dependencies with cargo (ideally they are bundled with the source tarball and don't need to be downloaded), then these git repositories are cached with pmbootstrap. This works as long as the program does not override CARGO_HOME. GNOME podcasts does this for example, so if building gnome-podcasts from the git repository with pmbootstrap build --src, patch out the override of CARGO_HOME so the dependencies do not get downloaded for every build.
==== Packaging caveats ====
* cargo auditable build is unsupported and falls back to compiling in QEMU. Change it to cargo build to build the package with the native compiler.
* Running tests doesn't really work (e.g. when building squeekboard, the tests hang and time out).
== QEMU ==
Use pmbootstrap --no-cross or set options="!pmb:crossdirect" in the APKBUILD to use this method.
pmbootstrap installs everything into the foreign arch chroot and runs the build through QEMU user emulation. This is the most reliable method, but it is much slower than cross compiling. Use this as workaround if your package does not build with crossdirect.
== See also ==
* pmbootstrap
* crossdirect in pmaports
* postmarketOS podcast #30 discusses how crossdirect works among lots of other things
Pmbootstrap/Tab Completion

Frequent users of pmbootstrap may want to set up tab completion to automatically complete your commands and arguments when pressing tab. Pressing it twice also lists possible arguments.
== Install argcomplete ==
Install argcomplete with your distribution's package manager:
Alpine Linux, postmarketOS:
# apk add py3-argcomplete
Arch Linux:
# pacman -S python-argcomplete
Debian, Ubuntu:
# apt install python3-argcomplete
Fedora:
# dnf install python3-argcomplete
Gentoo:
# emerge dev-python/argcomplete
Or in the unlikely case that your distribution does not have it packaged:
$ pip3 install --user argcomplete
Next, do one of the following depending on the shell you use.
== Bash ==
Add the following line to ~/.bashrc:
eval "$(register-python-argcomplete pmbootstrap)"
For Ubuntu 20.04+:
eval "$(register-python-argcomplete3 pmbootstrap)"
Then reload your configuration by opening a new terminal or by running source ~/.bashrc.
== Zsh ==
Add the following lines to ~/.zshrc:
autoload bashcompinit
bashcompinit
eval "$(register-python-argcomplete pmbootstrap)"
Then reload your configuration by opening a new terminal or by running source ~/.zshrc.
== Fish ==
Run the following to add an autocomplete file for pmbootstrap:
register-python-argcomplete --shell fish pmbootstrap > ~/.config/fish/completions/pmbootstrap.fish
== See also ==
* pmbootstrap
* implement bash tab completion
Pmbootstrap/Troubleshooting/QEMU

This page is about debugging problems with pmbootstrap qemu.
== "Booting the kernel." displayed forever or segfault ==
By default, serial output is available in the terminal where you have run pmbootstrap qemu. Check it for indications why something is wrong.
== Alternative display options ==
=== GTK instead of SDL ===
The virtual machine's output window can be drawn with either SDL or GTK. The default is SDL, and in case that does not work, you can try to switch to GTK:
$ pmbootstrap qemu --display=gtk
Try this in case pmbootstrap qemu fails on start with something like this, and you're using proprietary NVIDIA drivers on your host:
 libGL error: No matching fbConfigs or visuals found
 libGL error: failed to load driver: swrast
 X Error of failed request: GLXBadContext
 Major opcode of failed request: 151 (GLX)
 Minor opcode of failed request: 6 (X_GLXIsDirect)
 Serial number of failed request: 109
 Current serial number in output stream: 108
=== Disable OpenGL ===
Graphics rendering with OpenGL is enabled by default. You can disable it (and fall back to slow(!!) software rendering using:
$ pmbootstrap qemu --no-gl
=== Using QEMU from the host system ===
Since , pmbootstrap is using the QEMU binary from the Alpine chroots. That way you don't have to install QEMU on your host system and everybody uses the same version. However, for debugging purpose you might want to use the QEMU binaries from your host system instead:
$ pmbootstrap qemu --host-qemu
=== See also ===
* QEMU
* pmbootstrap qemu with proprietary nvidia drivers
* pmbootstrap qemu booting the kernel for ever (with screenshot)
QEMU
Pmbootstrap/Troubleshooting/grsec

is the name of a patchset, that used to be freely available to harden the Linux kernel. Older versions of Alpine had a linux-hardened kernel for example, which used a fork of that patchset. When you run a kernel based on that patchset on your host Linux system, you will probably run into problems with pmbootstrap because it does some things inside chroots, that is blocked by default in that patchset. One example is setting file permissions }.
There are two options:
* run pmbootstrap with a regular kernel
* disable the grsec specific features with sysctl while running pmbootstrap (you will probably run into other issues though, which have not been resolved - the quick solution is really using the regular kernel).
=== Disable some grsec-specific features while running pmbootstrap ===
However, user cmdr2 reported, that you can do the following to disable all grsec features, and pmbootstrap will work then:
To comprehensively disable grsec until the next reboot, I suggest:
$ ls -1 /proc/sys/kernel/grsecurity | xargs -I '___' sudo sysctl -w kernel.grsecurity.___=0
=== Commands to non-native chroots hang ===
This can only be partially resolved as of now, see .
For starters, disable the RANDMMAP PaX flag:
$ sudo apk add paxctl
$ sudo paxctl -C ~/.local/var/pmbootstrap/chroot_rootfs_samsung-s7562/usr/bin/qemu-arm-static
$ sudo paxctl -r ~/.local/var/pmbootstrap/chroot_rootfs_samsung-s7562/usr/bin/qemu-arm-static
Pmbootstrap release

== Checklist ==
Checklist for creating a pmbootstrap release:
* bump pmbootstrap version (__version__ in pmb/__init__.py)
* update apk_tools_min_version to the current one in Alpine Linux (in pmb/config/__init__.py)
* commit with the message "Prepare x.x.x release"
* create a new tag with git tag -s -a x.x.x
** look at the previous commits and copy paste the commit message titles, including the MR ID, like done in the previous tags). Sort by features, fixes and other.
* push your changes:
** git push
** git push --tag origin x.x.x
* update the pmbootstrap aport in Alpine's aports (change the pkgrel, update the checksum, build; see script below)
* if future changes in pmaports will require the new pmbootstrap version, increase it in pmaports.git's pmaports.cfg file
* make a small mastodon post about the release
Category:Admin
Pmsourcedump

Various mirrors for open source code where the upstream link isn't useful for us (dead/not stable/one big tarball with too much stuff in it - sometimes there's the kernel, Android system, full chromium source code, ... mashed into one tarball).
https://github.com/pmsourcedump
Please note that these sources are the unpatched original ones. You can find our patches in pmaports.git.
Category:Technical Reference
PocketBook 614 plus (pocketbook-614-plus)

== Contributors ==
* Hitechshell
== Users owning this device ==
== Original software ==
A regular sdcard is used as internal memory, so we can simply take it out and read/write it on the computer. It is worth noting that the image is tied to a specific sdcard (its serial number), but it is enough to simply untie the image from this dependence.
# fdisk -l /dev/sda 
Disk /dev/sda: 7.37 GiB, 7908360192 bytes, 15446016 sectors
Disk model: Card Reader 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sda1 1009664 15446015 14436352 6.9G b W95 FAT32
/dev/sda2 * 73728 139263 65536 32M 6 FAT16
/dev/sda3 1 1009664 1009664 493M 85 Linux extended
/dev/sda5 139264 172031 32768 16M 83 Linux
/dev/sda6 172032 204799 32768 16M 83 Linux
/dev/sda7 204800 275455 70656 34.5M 83 Linux
/dev/sda8 275456 776191 500736 244.5M 83 Linux
/dev/sda9 776192 976895 200704 98M 83 Linux
/dev/sda10 976896 1009663 32768 16M 83 Linux
Partition table entries are not in disk order.
sda1 - userdata
sda2 - boot partition (with kernel)
sda5 - ???
sda6 - ???
sda7 - root (/)
sda8 - /ebrmain (contain cramfs.img)
sda9 - /mnt/secure (contain some apps and libs)
sda10 - ??? (contain dictionaries)
Unlinking an image from a specific SD card: after the system starts, the main application is launched - pocketbook located in /dev/sda8 (in fact, this is a link to /mnt/cramfs/bin/monitor.app). This binary contains a check for the serial number of the memory card. However, we can easily cheat this check: replace the path to the serialnumber of sdcard with a simple text file with this number.
copy the cramfs.img file from sda8 and unpack it: cramfsck -x tmp_cram cramfs.img As a result, there will be a monitor.app file in the tmp_cram/bin directory.
Using strings we can find that the program gets the serial number from /sys/block/mmcblk%c/device/serial
Сreate a file with serial number in /mnt/secure (you can do it in another place, the main thing is that the final path is the same length as the line above) and replace path from from /sys/block/mmcblk%c/device/serial to your file.
now just copy the file to sda8, delete the old link and create a new one. ln -s monitor_patched.app pocketbook
== Installation ==
pmbootstrap install --sdcard=/dev/sda
== See also ==
* Initial merge request
* 
*
PocketBook Touch HD (pocketbook-pb631)

Another i.MX6 e-book reader, with external SD card slot and audio codec (rt5640)
== Contributors ==
* Illen
== Users owning this device ==
== How to enter flash mode ==
There is no flash mode to flash pmOS, follow the instructions below to flash pmOS to the internal SD card.
== Installation ==
Insert the internal SD card into a SD card reader, and connect it to your PC. Follow the instructions below to flash postmarketOS to the SD card:
Use pmbootstrap to build your own installation image.
$ pmbootstrap init # select pocketbook-pb631
$ pmbootstrap install --sdcard /dev/[sdcard] # replace [sdcard] with your SD card's blockdevice
== Mainline status ==
== Display ==
This device uses ED060KG1 screen, currently untested.
== WLAN ==
RTL8189FTV, works with out of tree driver. The driver needs this patch for Linux 6.14.
== Audio ==
RT5640 codec (used for the headphone port) does not seem to be supported on i.MX6 platform.
== Mainline U-Boot==
U-Boot works and can load Linux from internal SD card. External SD card slot does not work.
== See also ==
* Mainline U-Boot fork for pb631
* Mainline Linux fork for pb631
Pocketsphinx

Pocketsphinx is a voice recognition library made by Carnegie Mellon University. It can be used without an internet connection
== Dependences ==
It may be the case that not all of these are needed, but with them it will install
Install these using "sudo apk add
* python2
* py2-pip
* swig
* pulseaudio
* pulseaudio-libs
* pulseaudio-dev
* alsa-lib
* alsa-utils
* alsa-lib-dev
Install these using "pip install --user"
* pocketsphinx
Category:Apps
Poco M3 (Citrus)

== Some device info ==
There is a port available, though its functionality remains to be determined. Have not personally tested it, but it may be possible to resolve the issue. If the port is taken from fxtec-qx1050, the screen may not function properly, with the top part being displayed at the bottom. However, it appears to work in this manner. Have no further comments at this time. One potential solution is to install the Kali Nethunter kernel, although this approach is not universally recommended. However, it has been known to facilitate system bootup. It should be noted that there is a paucity of information available on how to effectively utilize this device. However, employing a Linux distribution such as PostmarketOS is often a worthwhile endeavor. Please note that it is possible to create a PostmarketOS port for the Poco M3 using the hallium method.
== Users owning this device ==
== How to enter flash mode == 
Power off device, Press POWER + Volume Down
== Installation (First method, with broken screen and touchscreen) == 
Choose fxtec-qx1050:
 pmbootstrap init
Make install files:
 pmbootstrap install
Install PostmarketOS to a Poco M3:
 fastboot erase dtbo
 
 pmbootstrap flasher flash_rootfs --partition userdata
 
 pmbootstrap flasher flash_kernel
 
 fastboot reboot
== Installation (Second method, doesn't always work) == 
You need Orange Fox recovery and a prepared kernel from Kali Nehunter on SD card
Choose fxtec-qx1050:
 pmbootstrap init
Make install files:
 pmbootstrap install
Install PostmarketOS without kernel (do not start the system!):
 fastboot erase dtbo
 
 pmbootstrap flasher flash_rootfs --partition userdata
Run Orange Fox on your phone and install the Kernel from Nethunter (without deleting the cache or anything else!)
== Key Considerations == 
*Community Status: Marked as "testing" due to partial hardware support 
*The utilization: It is not recommended to install this due to the fact that PostmarketOS has been found to be ineffective by users who have attempted to install it
*Cross-Device References: Similar installation process to fxtec-qx1050
Podman

== Podman / Docker ==
use podman as a docker replacement since it runs without sudo.
sudo apk add podman
sudo rc-update add cgroups
#remove folder so it will be created with the right permission on first run:
sudo rm -rf $HOME/.local/share/containers/storage
sudo touch /etc/subuid
sudo touch /etc/subgid
sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $(whoami)
-- reboot or logout/login --
Power Glossary

* VFG - Voltage fuel gauge (there's 2 type of fuelgauges, 2nd is coulomb-counter-based fuel gauges)
* AICL - adaptive-input current limit
* SOC - state-of-charge
* OCV - open-circuit voltage
* VFOCV - as per Maxim's integrated ModelGauge m5 algorithm: calculated open-circuit voltage of the cell as determined by the voltage fuel gauge. This value is used in other internal calculations.
* OVP - over voltage protection
* OPP - over power protection
* OCP - over current protection
* SCP - short circuit protection
* OTP - over temperature protection
* BOP - brown out protection
* QH - Maxim's raw coulomb count generated by the device. This register is used internally as an input to the mixing algorithm.
* VBYP - Vcc switch-over
* RepSOC - in ModelGauge m5 algorithm, reported SOC (for use by the application GUI)
* ELVSS - AMOLED negative power supply(amoled panel require negative voltage, so there's special ICs to generate ELVSS and ELVDD)
* ELVDD - AMOLED positive power supply
Power Monitoring

== Powersupply (GTK3 tool) ==
A Gtk3 based application displaying the current battery status, charging power, and other related information:
Install:
 apk add powersupply
Run:
 powersupply
=== Links ===
* Homepage
== Powerstat ==
A shell tool which gathers power consumption along with other statistics such as system load, number of context switches etc.
Only works while running on battery power.
Can also monitor GPU power consumption, but that is not of much use for phones, since it only supports Intel GPUs (at the time of this writing).
Install:
No package yet. Download tarball from here or:
 git clone https://github.com/ColinIanKing/powerstat.git
 cd powerstat
 make
 make install
Run:
 powerstat
See
 man powerstat
for more options.
=== Links ===
Homepage
Powerway Dreamtab DRN-X500 (astar)

== Contributors ==
* Riomccloud
* V6lhost
== Users owning this device ==
== How to enter flash mode ==
# With the tablet turned off, hold the button
# While holding it, connect the USB cable and press the button five times
# Release both buttons
== Installation ==
For this initial testing phase, follow the Installation guide and select a device with the same SoC, like INet Tek D70 A33. Install it to the SD card, since internal storage seems to be not recognized for now.
== Features ==
=== WiFi ===
Its wireless network capabilities aren't included in the SoC. It seems to use a Realtek RTL8703AS: 
== See also ==
Powkiddy X55 (powkiddy-x55)

== Contributors ==
* vognev
== Users owning this device ==
== How to enter flash mode ==
== Installation ==
Use pmbootstrap to build your own installation image.
$ pmbootstrap init
$ pmbootstrap install --sdcard=/dev/mmcblk0
== See also ==
* Initial merge request
* Suggested UI package for device
* Gamepad fix
Category:Game Console
Preparing videos for blog posts

Here's a short cheat sheet of how to get videos ready for blog posts. We convert them to the widely supported ( will for example not work on Fedora out of the box), and create short and smaller video thumbnails. These thumbnails will be embedded into the blog post directly as little animated pictures, just like gifs, but much more size efficient.
==== Convert to webm ====
$ ffmpeg -i video.mp4 video.webm
==== Shorten ====
Start at 10 seconds and cut after the next 5 seconds:
$ ffmpeg -ss 00:10:00 -i video.webm -c copy -t 00:00:05 video-short.webm
==== Scale down ====
Resize to 300x533 px:
$ ffmpeg -y -i video-short.webm -vf scale=300:533 video-thumb.webm
==== Add bottom text ====
#!/bin/sh -e
if [ "$#" -ne 3 ]; then
 echo "usage: $(basename $0) input output text"
 exit 1
fi
set -x
font="/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
ffmpeg -i "$1" -vf drawtext="fontfile=$font: \
 text=\'$3\': fontcolor=white: fontsize=24: box=1: boxcolor=black@0.5: \
 boxborderw=5: x=(w-text_w)/2: y=h-text_h-15" -codec:a copy "$2"
==== Merge multiple videos ====
#!/bin/sh -e
if [ "$#" -lt 1 ]; then
 echo "usage: $(basename $0) video1 video2 video3 ..."
 exit 1
fi
set -x
{
 for i in $@; do
 echo "file $i"
 done
} > inputlist
ffmpeg -f concat -i inputlist -c copy merged.webm
==== Embed into a post ====
<video controls width="300" height="533" class="border" autoplay="autoplay" loop mute>
<source src="/static/video/2019-00/video-thumb.webm" />
<a href="/static/video/2019-00/video.webm">Description of the video here</a>
</video>
Make sure to embed the link to the full video somewhere in the text related to the video:
Some text talking about the video ([video](/static/video/2019-00/video.webm)).
Category:Guide
Prestigio MultiPad PMT5008 3G (prestigio-pmt5008-3g)

== Contributors ==
* km2
== Users owning this device ==
== How to enter flash mode ==
== Installation ==
== Mainline Kernel Status ==
There is no downstream kernel source code for this device. So I decided to port mainline linux and I was pretty quick to successfully start 4 uart ports, wdt, smp and /bin/sh from initramfs. But for further progress, you need to write the pinctrl and clk drivers.
Also this device uses pmic mt6323 which seems to be in mainline.
== See also ==
Projects

This page lists all of the various projects that postmarketOS maintains, along with the team members that maintain them. To become a maintainer, simply talk with the current maintainer(s) if there are any, or add yourself if you are interested and there are no maintainers.
Project 	Description 	Maintainers
apkbrowser 	 	wonderfulShrineMaidenOfParadise
artwork 	 	ollieparanoid
asus-transformer-blobtools 	 	
boot-deploy 	 	craftyguy, caleb
bootmac 	 	DylanVanAssche
BuffyBox 	 	
build.postmarketos.org 	 	ollieparanoid
cast.postmarketos.org 	 	ollieparanoid
charging-sdl 	 	
ci-common 	 	ollieparanoid
fbdebug 	 	
gnss-share 	 	craftyguy
gpmbootstrap 	 	
HKDM 	 	Caleb
install-makedepends 	 	
jonathan 	IRC and Matrix bot for managing/syncing cross-room power levels and access, and handling shortcuts	funderscore
libapk-qt (ApkQt) 	 	Alexey Min
mobile-config-firefox 	 	ollieparanoid
mobile-config-thunderbird 	 	DylanVanAssche
monitoring 	 	
mrhlpr 	 	Newbyte and pabloyoyoista
msm-cros-efs-loader 	 	Jenneron
msm-firmware-loader 	 	TravMurav
obex-capabilities 	 	
ondev2 	 	ollieparanoid
openrc-settingsd 	 	
pbsplash 	 	Caleb
pmaports 	 	Various, see CODEOWNERS and APKBUILDs in repo
pmbootstrap 	 	ollieparanoid, Caleb, Newbyte
postmarketos-android-recovery-installer	 	
postmarketos-apparmor-profiles 	 	
postmarketos-backup 	 	
postmarketos-demos 	 	
postmarketos-mkinitfs 	 	craftyguy
postmarketos-release-upgrade 	 	
postmarketos-testing-template-generator	 	Jenneron
postmarketos-theme 	 	
postmarketos-tweaks 	 	
postmarketOS Upgrade GTK3 	 	
postmarketOS Welcome 	 	
postmarketos.org 	 	ollieparanoid
q6voiced 	 	TravMurav
reboot-mode 	 	
status.postmarketos.org 	 	
swclock-offset 	 	
systemd 	 	jane400
tinydm 	 	ollieparanoid
ttq 	 	ollieparanoid
TTYEscape 	 	Caleb
unudhcpd 	 	craftyguy
webflash 	 	
wiki 	 	
xfce4-phone 	 	
== Archived Projects ==
Project 	Reason
anbox-image-make 	Anbox is no longer maintained and has been replaced by Waydroid
aports-turbo 	Superseded by apkbrowser
gps-nokia-n900 	Now maintained under Maemo Leste
linux-postmarketos-archive	The linux-postmarketos.git repository was removed due to space issues
matrix-bot 	Superseded by jonathan
megapixels 	Use https://gitlab.postmarketos.org/megapixels-org instead
pmOS-repo-scripts 	Superseded by bpo
postmarketos-images 	Superseded by bpo
osk-sdl 	Superseded by unl0kr
postmarketos-ondev 	Superseded by ondev2
postmarketos-splash 	Superseded by pbsplash
postprocessd 	Use https://gitlab.postmarketos.org/megapixels-org/postprocessd instead
Proscan PLT9650G (proscan-plt9650g)

A generic cheap tablet running a Rockchip RK3126.
== Contributors ==
* rendeko
== What works ==
* Kernel compiles but doesn't seem to finish booting
== What doesn't work ==
* Everything
== Notes ==
* Lacks vibration motor and LEDs, so maximum-attention hook can't be used.
== Users owning this device ==
== Notes ==
* The chipset is a RK3126 (from 2014) which is separate from RK3126c (from 2017).
== See also ==
* Device package
* Kernel package