[Toybox] Toybox Installer/setup routine?

Denys Nykula nykula at ukr.net
Sun Sep 8 03:29:45 PDT 2019


> It's probably easier to maintain a makefile for llvm, cmake is terrible.

Unsure if easier to maintain, but easier to make, yes. Will try and see.
 
> If you don't mind /share and /include at the top level.

Looking up files in shell a lot, I do want /local and these dirs in root. Not
fond of extra depth in /home, /mnt and, to some degree, /var, either.

> My mkroot script creates a minimal directory hierarchy (enough to install linux
> from scratch into) in 3 lines:
> 
> mkdir -p "$ROOT"/{etc,tmp,proc,sys,dev,home,mnt,root,usr/{bin,sbin,lib},var} &&
> chmod a+rwxt "$ROOT"/tmp && ln -s usr/{bin,sbin,lib} "$ROOT" || exit 1

Mkroot is useful. Regarding allnoconfig, where should I read about kconfig CLI
helpers if they exist? Currently to remember because of which dependency I keep
a certain option in my config and see if I maybe can remove it since I no
longer use this or that device, I have this ad hoc reverse lookup:

#!/bin/sh
# $ kwhy ACPI_WMI
# DELL_WMI
# IDEAPAD_LAPTOP
# ...
find /src/linux/ -name Kconfig -not -path '*scripts*tests*' -exec perl -0pe 's/\
nconfig (.+)(\n[ \t]+.*)*\n[ \t]+depends on.*[^!\w\n]('$1')[^!\w].*/\n$1\n/g;s/(
^|\n)[^A-Z\n].*/\n/g;s/\s+/\n/g;s/^\n//' {} +

> > Head with negative -n value is used in Linux kernel build for atomics checks,
> 
> Huh, what architecture/config requires this? (I've been building the kernel with
> toybox for years now, and built it with mkroot yesterday. Didn't see this. The
> only thing I'm finding with grep isn't building the kernel, it's building perf

scripts/atomic/check-atomics.sh:
NEWSUM="$(head -n -1 ${LINUXDIR}/include/${header} | sha1sum)"

Build continues, just prints distracting warnings at the beginning. Wrote this
down when trying to build as much as possible with LLVM and note all that
might have been going wrong.

> > if ! sed -n -e '/^# Generated by .*libtool/q0;4q1' "${f}"; then continue; fi
> 
> Ok, so you need the exitcode extension to q, and never previously mentioned it
> on this list. Right, easy enough to add...

Haven't mentioned because it's not a bottleneck and is in my own todo list.

> > There are also patch -f and find -newerXY
> 
> Let's see, we don't check "Prereq:" lines, I don't remember implementing
> querying /dev/tty for a filename if the one in the patch isn't there (we just
> fail), and although we _warn_ about possibly reversed patches that's all we do.
> So our current behavior _is_ -f already, and it sounds like I should
> accept-but-ignore the option?

Yeah it's about the tty prompt. Portage checks the patch before applying and
passes -f to prevent this freeze, with --dry-run to not pollute the sources.
It's an old option likely used in other build tools, so if toybox behaves
like it's there by default, adding a noop -f flag can be useful.

/portage/eclass/epatch.eclass:
# Generate some useful debug info ...
${patch_cmd} --dry-run -f < "${PATCH_TARGET}" 2>&1

Gentoo duplicated this in another place, adding two more options to imitate
the same dry run behavior in case of a mismatch, dropped support for standard
patch and required GNU everywhere. This seems dirty and I'm in favor of
letting extra options other than -f remain broken.

/lib/portage/python3.7/phase-helpers.sh:
ebegin "${prefix:-Applying }${f##*/}"
# -p1 as a sane default
# -f to avoid interactivity
# -s to silence progress output
# -g0 to guarantee no VCS interaction
# --no-backup-if-mismatch not to pollute the sources
${patch_cmd} -p1 -f -s -g0 --no-backup-if-mismatch \
  "${patch_options[@]}" < "${f}"

> Um, looking at newerXY... there are only 3 times in stat, create, access,
> modification. What's this "birth" nonsense? Why is Hurd tracking that
> differently then linux, and why would anyone care? (Would making b and c
> synonyms break anything?)
> 
> I can see -newermt 123456789 being useful, though...

Xdg-utils look for recently installed desktop apps to update users' file
association tables, comparing app inode change with table modification.

/lib/portage/python3.7/preinst-qa-check.d/50xdg-utils:
find_args+=( -newercm "${d}"/mimeinfo.cache ) || missing=1

Difference between content birth and inode change is from BSD. This doc
says that any B test should return false on Linux filesystems, most
details are in the section, More on age ranges.
http://www.softpanorama.org/Tools/Find/selecting_files_by_age.shtml



More information about the Toybox mailing list