mirror of
https://codeberg.org/landley/toybox.git
synced 2026-01-26 14:13:25 +00:00
Move mkroot into its own directory.
This commit is contained in:
parent
8626a6ac7d
commit
126c719dd2
2
Makefile
2
Makefile
@ -77,7 +77,7 @@ tests: toybox
|
||||
scripts/test.sh
|
||||
|
||||
root:
|
||||
scripts/mkroot.sh $(MAKEFLAGS)
|
||||
mkroot/mkroot.sh $(MAKEFLAGS)
|
||||
|
||||
run_root:
|
||||
cd root/"$${CROSS:-host}" && ./run-qemu.sh
|
||||
|
||||
@ -6,6 +6,8 @@
|
||||
[ -z "$NOCLEAR" ] && exec env -i NOCLEAR=1 HOME="$HOME" PATH="$PATH" \
|
||||
LINUX="$LINUX" CROSS="$CROSS" CROSS_COMPILE="$CROSS_COMPILE" "$0" "$@"
|
||||
|
||||
! [ -d mkroot ] && echo "Run mkroot/mkroot.sh from toybox source dir." && exit 1
|
||||
|
||||
# assign command line NAME=VALUE args to env vars, the rest are packages
|
||||
for i in "$@"; do
|
||||
[ "${i/=/}" != "$i" ] && export "$i" || { [ "$i" != -- ] && PKG="$PKG $i"; }
|
||||
@ -13,9 +15,8 @@ done
|
||||
|
||||
# Set default directory locations (overrideable from command line)
|
||||
: ${TOP:=$PWD/root} ${BUILD:=$TOP/build} ${LOG:=$BUILD/log}
|
||||
: ${AIRLOCK:=$BUILD/airlock} ${CCC:=$PWD/ccc} ${PKGDIR:=$PWD/scripts/root}
|
||||
: ${AIRLOCK:=$BUILD/airlock} ${CCC:=$PWD/ccc} ${PKGDIR:=$PWD/mkroot/root}
|
||||
|
||||
# define functions
|
||||
announce() { printf "\033]2;$CROSS $*\007" >/dev/tty; printf "\n=== $*\n";}
|
||||
die() { echo "$@" >&2; exit 1; }
|
||||
|
||||
@ -80,7 +81,7 @@ if [ -z "$NOLOGPATH" ]; then
|
||||
CROSS_COMPILE=${CROSS_COMPILE##*/}
|
||||
export WRAPDIR="$BUILD/record-commands" LOGPATH="$LOG/$CROSS-commands.txt"
|
||||
rm -rf "$WRAPDIR" "$LOGPATH" generated/obj &&
|
||||
WRAPDIR="$WRAPDIR" CROSS_COMPILE= NOSTRIP=1 source scripts/record-commands ||
|
||||
WRAPDIR="$WRAPDIR" CROSS_COMPILE= NOSTRIP=1 source mkroot/record-commands ||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -304,5 +305,5 @@ if [ -z "$BUILTIN" ]; then
|
||||
> "$OUTPUT"/initramfs.cpio.gz || exit 1
|
||||
fi
|
||||
|
||||
mv "$LOG/$CROSS".{n,y}
|
||||
mv "$LOG/$CROSS".{n,y} && echo "Output is in $OUTPUT"
|
||||
rmdir "$TEMP" "$BUILD" 2>/dev/null || exit 0 # remove if empty, not an error
|
||||
@ -1,4 +1,4 @@
|
||||
#!/bin/echo Try "scripts/mkroot.sh dropbear"
|
||||
#!/bin/echo Try "mkroot/mkroot.sh dropbear"
|
||||
|
||||
# Example overlay file, adding dropbear (which requires zlib)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/bin/echo Try "scripts/mkroot.sh dynamic"
|
||||
#!/bin/echo Try "mkroot/mkroot.sh dynamic"
|
||||
|
||||
# Copy dynamic libraries from cross compiler
|
||||
|
||||
3
mkroot/root/overlay
Executable file
3
mkroot/root/overlay
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/echo Try "mkroot/mkroot.sh overlay"
|
||||
|
||||
cp -a "${OVERLAY:=overlay}"/. "$ROOT"/.
|
||||
@ -1,4 +1,4 @@
|
||||
#!/bin/echo Try "scripts/mkroot.sh $0"
|
||||
#!/bin/echo Try "mkroot/mkroot.sh $0"
|
||||
|
||||
# Alas http://www.linux-usb.org/usb.ids is not versioned, so...
|
||||
download 36d4e16755502fbc684be75e56841e1014e4a94a \
|
||||
@ -1,5 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
# usage: mkroot/testroot.sh [TARGET...]
|
||||
#
|
||||
# Test system image(s) (by booting qemu with -hda test.img providing /mnt/init)
|
||||
# and check that:
|
||||
#
|
||||
# A) it boots and runs our code (which means /dev/hda works)
|
||||
# B) the clock is set sanely ("make" is unhappy when source newer than output)
|
||||
# C) it can talk to the virtual network
|
||||
#
|
||||
# Each successful test prints a === line, and all 3 means it passed.
|
||||
# Writes result into root/build/test/$TARGET-test.txt
|
||||
#
|
||||
# With arguments, tests those targets (verbosely). With no arguments, tests
|
||||
# each target with a linux-kernel (in parallel) and prints pass/fail summary.
|
||||
|
||||
die() { echo "$@"; exit 1; }
|
||||
|
||||
[ -n "$(which toybox)" -a -n "$(which mksquashfs)" ] ||
|
||||
@ -7,7 +22,7 @@ die() { echo "$@"; exit 1; }
|
||||
|
||||
mkdir -p "${TEST:=$PWD/root/build/test}" &&
|
||||
|
||||
# Setup test filesystem
|
||||
# Setup test filesystem and package it into a squashfs.
|
||||
cat > "$TEST"/init << 'EOF' &&
|
||||
#!/bin/sh
|
||||
|
||||
@ -21,7 +36,7 @@ chmod +x "$TEST"/init &&
|
||||
|
||||
mksquashfs "$TEST"/init configure scripts/ tests/ "$TEST"/init.sqf -noappend -all-root >/dev/null &&
|
||||
|
||||
# Setup for network smoke test
|
||||
# Setup server on host's loopback for network smoke test
|
||||
echo === net ok > "$TEST"/index.html || die "smoketest setup"
|
||||
toybox netcat -p 65432 -s 127.0.0.1 -L toybox httpd "$TEST" &
|
||||
trap "kill $!" EXIT
|
||||
@ -1,3 +0,0 @@
|
||||
#!/bin/echo Try "scripts/mkroot.sh overlay"
|
||||
|
||||
cp -a "${OVERLAY:=overlay}"/. "$ROOT"/.
|
||||
@ -759,7 +759,7 @@ auditable version of the cmdline portion of that base.</p>
|
||||
|
||||
<hr /><h2><a name="mkroot" />Q: How do you build a working Linux system with toybox?</h2>
|
||||
|
||||
<p>A: Toybox has a built-in <a href=https://github.com/landley/toybox/blob/master/scripts/mkroot.sh>system builder</a>, with the Makefile target "<b>make
|
||||
<p>A: Toybox has a built-in <a href=https://github.com/landley/toybox/blob/master/mkroot/mkroot.sh>system builder</a> called "<a href=https://github.com/landley/toybox/blob/master/mkroot/README>mkroot</a>", with the Makefile target "<b>make
|
||||
root</b>". To enter the resulting root filesystem, "<b>sudo chroot
|
||||
root/host/fs /init</b>". Type "exit" to get back out.</p>
|
||||
|
||||
@ -832,7 +832,7 @@ to the build, by calling the script directly and listing packages on
|
||||
the command line:</p>
|
||||
|
||||
<blockquote>
|
||||
<p><b>scripts/mkroot.sh CROSS=all LINUX=~/linux dropbear</b></p>
|
||||
<p><b>mkroot/mkroot.sh CROSS=all LINUX=~/linux dropbear</b></p>
|
||||
</blockquote>
|
||||
|
||||
<p>An example package build script (building the dropbear ssh server, adding a
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user