Skip to content

Instantly share code, notes, and snippets.

View whitslack's full-sized avatar

Matt Whitlock whitslack

  • New Hampshire, USA
View GitHub Profile
@whitslack
whitslack / portage-utils.bash
Last active March 2, 2024 07:55
Prints diagnostics pertaining to redundant USE flags specified in /etc/portage/make.conf and /etc/portage/package.use/*.
# Accumulates flags in the associative array named by ${1}.
accumulate() {
declare -Ag ${1?}
local -n var=${1} ; shift
local flag ; for flag in "${@}" ; do
case ${flag} in
'-*') var=( ['*']=0 ) ;;
-*) var[${flag:1}]=0 ;;
*) var[${flag}]=1 ;;
esac

Early Userspace without Initramfs

If you've built your own kernel with all necessary storage-controller and file-system drivers built in, then you may have no need of an early userspace environment. However, if you want to do anything non-trivial with your root file system (LVM, LUKS, etc.), then you need an early userspace to set up and mount it. The traditional mechanism for this is initramfs, but building and maintaining an initramfs image is awkward and tiresome. Initramfs is a sledgehammer when, nine times out of ten, all you need is a screwdriver. This guide details a method of booting into an early userspace environment located in an ordinary file system on a physical disk partition, where an init script in this environment in turn sets up and mounts the real root file system and pivots into it.

Setting Up the Basic Environment

In order to employ this method of booting your system, you will need a traditional (non-LVM) disk partition containing a file system that your kernel can mount without

@whitslack
whitslack / bsync.c
Created March 3, 2020 01:12
bsync: a write-minimizing block device synchronizing utility
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <error.h>
#include <fcntl.h>
#include <sysexits.h>
#include <unistd.h>
@whitslack
whitslack / bip-whitlock-txid-draft.md
Created May 31, 2017 07:58
Mitigating transaction malleability by redefining TxId
BIP: whitlock-txid-draft
Layer: Consensus (hard fork)
Title: Mitigating transaction malleability by redefining TxId
Author: Matt Whitlock <bip@mattwhitlock.name>
Type: Standards Track
Created: 2017-04-01
License: WTFPL <http://www.wtfpl.net/>

Keybase proof

I hereby claim:

  • I am whitslack on github.
  • I am whitslack (https://keybase.io/whitslack) on keybase.
  • I have a public key ASBHukTHa5TM_Tp-2UG__gee3nPwZeEO4USiwJTKAXRCtwo

To claim this, I am signing this object: