Skip to content

Instantly share code, notes, and snippets.

@paradigm
paradigm / gist:49861a397647352518e637d4362f3897
Created January 21, 2017 15:23
bedrock rust port results
$ # rust port - includes sanity check
$ ./target/x86_64-unknown-linux-musl/release/brc arch ls
brc: error chdir("..")'ing in the dirt while breaking out of chroot. Maybe your user lacks necessary permissions. Check the permissions on the file path along/in /bedrock/strata/
$ brc arch ls
^C
$ # had to ctrl-c due to infinite loop.
@paradigm
paradigm / poki_brg.md
Last active September 17, 2016 11:59

Bedrock Linux 1.0beta3 brg development 2016/09/03

Setup

First, get the requisite files and compile busybox and netselect with Bedrock Linux's settings:

git clone --branch 1.0beta3-brg https://github.com/bedrocklinux/bedrocklinux-userland.git
cd bedrocklinux-userland

make busybox netselect

@paradigm
paradigm / brg-design-doc.md
Last active August 10, 2016 11:11
Bedrock Linux brg design doc 2016-08-10

brg design doc 2016-08-10

brg will be a Bedrock Linux utility which, primarily, acquires software from other distributions for use as Bedrock Linux strata.

Typical Bedrock Linux installations acquire most of their software through package managers provided by other distributions. If one would like some package (e.g. vim) from some distribution (e.g. Debian), this is acquired through the distribution's package manager (e.g. apt-get install vim). However, this results in a bootstrapping problem: how does one get the package manager

@paradigm
paradigm / test.c
Last active May 27, 2016 21:37
vfork+chroot benchmark
/*
* $ gcc test.c
* $ time sudo brc init ./a.out 7 fork >/dev/null
* sudo brc init ./a.out 7 fork > /dev/null 0.00s user 0.00s system 0% cpu 1.207 total
* $ time sudo brc init ./a.out 121 vfork >/dev/null
* sudo brc init ./a.out 121 vfork > /dev/null 0.00s user 0.00s system 0% cpu 0.982 total
* $ time sudo brc init ./a.out 121 nofork >/dev/null
* sudo brc init ./a.out 121 nofork > /dev/null 0.02s user 0.02s system 4% cpu 0.999 total
*/
@paradigm
paradigm / test.c
Last active May 26, 2016 21:43
chroot() outside of current root with single chroot() call
/*
* $ gcc test.c && sudo brc init ./a.out
* void
* arch
* jessie
* crux
*/
#include <sys/types.h>
#include <sys/stat.h>
# mkdir -p /tmp/test
# mount -t tmpfs tmpfs /tmp/test
# cd /tmp/test
# umount /tmp/test
umount: /tmp/test: target is busy
(In some cases useful info about processes that
use the device is found by lsof(8) or fuser(1).)
@paradigm
paradigm / brg_spec.md
Last active May 4, 2016 01:03
Rough draft of specification for brg

brg spec, draft 1

brg

brg will be a Bedrock Linux utility which, primarily, acquires software from other distributions for use as Bedrock Linux strata. See

http://bedrocklinux.org/1.0beta3/plans.html#brg

if you are not familiar with brg's goal.

#!/bin/sh
sudo pacman -S base-devel fakeroot
wget "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=packer" -O PKGBUILD
makepkg
sudo pacman -U packer-*.pkg.tar.xz && rm packer-*.pkg.tar.xz
ioctl() not implemented in bru (hoping it'd avoid the memory copy):
16757 17:06:07 open("/etc/resolv.conf", O_RDONLY) = 13
16757 17:06:07 ioctl(13, FS_IOC32_GETFLAGS or FS_IOC_GETFLAGS, 0x7ffc26d2fa34) = -1 ENOSYS (Function not implemented)
16757 17:06:07 close(13) = 0
16757 17:06:07 open("/dev/tty", O_RDWR|O_NOCTTY|O_NONBLOCK) = 13
16757 17:06:07 writev(13, [{"*** ", 4}, {"stack smashing detected", 23}, {" ***: ", 6}, {"/usr/sbin/NetworkManager", 24}, {" terminated\n", 12}], 5) = 69
ioctl() implemented in bru:
$ sudo ./brp /tmp/brp-test
FUSE library version: 2.9.4
nullpath_ok: 0
nopath: 0
utime_omit_ok: 0
unique: 1, opcode: INIT (26), nodeid: 0, insize: 56, pid: 0
INIT: 7.23
flags=0x0003f7fb
max_readahead=0x00020000
INIT: 7.19