Browse Source

Initial commit

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
master
David Oberhollenzer 4 years ago
commit
dbbb1889f4
  1. 4
      .gitignore
  2. 3
      cfg/alix/PACKAGES
  3. 3
      cfg/alix/SQUASHFS
  4. 6
      cfg/alix/TOOLCHAIN
  5. 1136
      cfg/alix/bbstatic.config
  6. 58
      cfg/alix/genimage.sh
  7. 65
      cfg/alix/install.sh
  8. 1
      cfg/alix/ld-musl-i386.path
  9. 20
      cfg/alix/libgcc_files.txt
  10. 3191
      cfg/alix/linux.config
  11. 29
      cfg/alix/release
  12. 2
      cfg/rpi3/PACKAGES
  13. 5
      cfg/rpi3/SQUASHFS
  14. 6
      cfg/rpi3/TOOLCHAIN
  15. 1135
      cfg/rpi3/bbstatic.config
  16. 58
      cfg/rpi3/boot-config.txt
  17. 1
      cfg/rpi3/cmdline.txt
  18. 53
      cfg/rpi3/genimage.sh
  19. 60
      cfg/rpi3/install.sh
  20. 2
      cfg/rpi3/ld-musl-arm.path
  21. 17
      cfg/rpi3/libgcc_files.txt
  22. 5886
      cfg/rpi3/linux.config
  23. 17
      cfg/rpi3/release
  24. 146
      mk.sh
  25. 39
      pkg/bash/build
  26. 2
      pkg/bash/depends
  27. 38
      pkg/bbstatic/build
  28. 25
      pkg/boot-rpi3/build
  29. 238
      pkg/coreutils/0001.patch
  30. 32
      pkg/coreutils/build
  31. 43
      pkg/firmware-rpi3/build
  32. 98
      pkg/initrd/build
  33. 1
      pkg/initrd/depends
  34. 77
      pkg/initrd/initrd.skel
  35. 42
      pkg/linux-rpi3/build
  36. 1
      pkg/linux-rpi3/depends
  37. 49
      pkg/linux/build
  38. 1
      pkg/linux/depends
  39. 36
      pkg/linux_modules/build
  40. 58
      pkg/ncurses/build
  41. 32
      pkg/readline/build
  42. 1
      pkg/readline/depends
  43. 16
      pkg/rootfs/build
  44. 25
      tcpkg/binutils/build
  45. 17
      tcpkg/cloog/build
  46. 46
      tcpkg/gcc1/build
  47. 7
      tcpkg/gcc1/depends
  48. 28
      tcpkg/gcc2/build
  49. 2
      tcpkg/gcc2/depends
  50. 17
      tcpkg/gmp/build
  51. 17
      tcpkg/isl/build
  52. 16
      tcpkg/libgcc/build
  53. 1
      tcpkg/libgcc/depends
  54. 28
      tcpkg/linux_hdr/build
  55. 17
      tcpkg/mpc/build
  56. 17
      tcpkg/mpfr/build
  57. 31
      tcpkg/musl/build
  58. 1
      tcpkg/musl/depends
  59. 30
      tcpkg/pkg-config/build
  60. 11
      tcpkg/toolchain/build
  61. 4
      tcpkg/toolchain/depends
  62. 18
      util/cmake.sh
  63. 40
      util/depends.sh
  64. 36
      util/download.sh
  65. 45
      util/pkgcmd.sh
  66. 36
      util/toolchain.sh

4
.gitignore

@ -0,0 +1,4 @@
*~
*.tar.bz2
*.tar.xz
*.tar.gz

3
cfg/alix/PACKAGES

@ -0,0 +1,3 @@
bbstatic
initrd
linux

3
cfg/alix/SQUASHFS

@ -0,0 +1,3 @@
coreutils
bash
rootfs

6
cfg/alix/TOOLCHAIN

@ -0,0 +1,6 @@
TARGET="i686-linux-musl"
GCC_CPU="i686"
GCC_EXTRACFG="--disable-libmpx --disable-libssp"
LINUXPKG="linux"

1136
cfg/alix/bbstatic.config

File diff suppressed because it is too large

58
cfg/alix/genimage.sh

@ -0,0 +1,58 @@
#!/bin/sh
set -u -e -x
FILE=$1
MOUNTED=0
LOOPATTACHED=0
function do_cleanup() {
[ $MOUNTED -ne 0 ] && umount /tmp/mnt.$$
[ $LOOPATTACHED -ne 0 ] && losetup -d ${LODEV}
rmdir /tmp/mnt.$$
}
trap do_cleanup ERR INT
cd `dirname $0`
truncate -s 1G $FILE
parted --script $FILE \
"mklabel msdos" \
"mkpart primary fat32 1M 256M" \
"mkpart primary btrfs 256M 100%" \
"set 1 boot on"
LODEV=$(losetup -f)
losetup -P ${LODEV} ${FILE}
LOOPATTACHED=1
mkfs.vfat ${LODEV}p1
mkfs.btrfs -f ${LODEV}p2
mkdir /tmp/mnt.$$
mount -t vfat ${LODEV}p1 /tmp/mnt.$$
MOUNTED=1
syslinux --install ${LODEV}p1
cp syslinux.cfg /tmp/mnt.$$/syslinux.cfg
cp ROOTFSFILE /tmp/mnt.$$/
cp KERNELFILE /tmp/mnt.$$/
umount /tmp/mnt.$$
MOUNTED=0
mount -t btrfs ${LODEV}p2 /tmp/mnt.$$
MOUNTED=1
mkdir /tmp/mnt.$$/etc /tmp/mnt.$$/etc_work
mkdir /tmp/mnt.$$/var_lib /tmp/mnt.$$/var_lib_work
umount /tmp/mnt.$$
MOUNTED=0
losetup -d ${LODEV}
LOOPATTACHED=0
dd if=mbr.bin of=$FILE conv=notrunc
rmdir /tmp/mnt.$$

65
cfg/alix/install.sh

@ -0,0 +1,65 @@
#!/bin/sh
set -u -e -x
CONFIRM="Yes, I am"
DEVICE=$1
MOUNTED=0
function do_cleanup() {
[ $MOUNTED -ne 0 ] && umount /tmp/mnt.$$
rmdir /tmp/mnt.$$
}
trap do_cleanup ERR INT
cd `dirname $0`
echo "Are you *really* sure to use $DEVICE?"
echo "If so, type \"$CONFIRM\""
read input
[ "x$input" != "x$CONFIRM" ] && exit 1
[ ! -b $DEVICE ] && {
echo "Error, $DEVICE is not a block device"
exit 1
}
count=$(grep -c -e "^$DEVICE" /proc/mounts || true)
[ $count -ne 0 ] && {
echo "Error, $DEVICE is mounted"
exit 1
}
dd if=/dev/zero of=$DEVICE bs=512 count=1
parted --script $DEVICE \
"mklabel msdos" \
"mkpart primary fat32 1M 256M" \
"mkpart primary btrfs 256M 100%" \
"set 1 boot on"
mkfs.vfat ${DEVICE}1
mkfs.btrfs -f ${DEVICE}2
mkdir /tmp/mnt.$$
mount -t vfat ${DEVICE}1 /tmp/mnt.$$
MOUNTED=1
syslinux --install ${DEVICE}1
cp syslinux.cfg /tmp/mnt.$$/syslinux.cfg
cp ROOTFSFILE /tmp/mnt.$$/
cp KERNELFILE /tmp/mnt.$$/
umount /tmp/mnt.$$
MOUNTED=0
mount -t btrfs ${DEVICE}2 /tmp/mnt.$$
MOUNTED=1
mkdir /tmp/mnt.$$/etc /tmp/mnt.$$/etc_work
mkdir /tmp/mnt.$$/var_lib /tmp/mnt.$$/var_lib_work
umount /tmp/mnt.$$
MOUNTED=0
rmdir /tmp/mnt.$$
dd if=mbr.bin of=$DEVICE

1
cfg/alix/ld-musl-i386.path

@ -0,0 +1 @@
/lib

20
cfg/alix/libgcc_files.txt

@ -0,0 +1,20 @@
lib/libatomic.so
lib/libatomic.so.1
lib/libatomic.so.1.2.0
lib/libcilkrts.so
lib/libcilkrts.so.5
lib/libcilkrts.so.5.0.0
lib/libgcc_s.so
lib/libgcc_s.so.1
lib/libgomp.so
lib/libgomp.so.1
lib/libgomp.so.1.0.0
lib/libitm.so
lib/libitm.so.1
lib/libitm.so.1.0.0
lib/libquadmath.so
lib/libquadmath.so.0
lib/libquadmath.so.0.0.0
lib/libstdc++.so.6.0.24
lib/libstdc++.so
lib/libstdc++.so.6

3191
cfg/alix/linux.config

File diff suppressed because it is too large

29
cfg/alix/release

@ -0,0 +1,29 @@
build_release() {
local RELEASE_DIR="$1"
local ROOTFS_SQFS="$2"
local fname=$(find $PKGDEPLOYDIR/linux/ -name 'vmlinuz*')
local linux_image=$(basename $fname)
local rootfs_image=$(basename $ROOTFS_SQFS)
cp -r "$fname" "$RELEASE_DIR"
cp "$ROOTFS_SQFS" "$RELEASE_DIR"
cp "$SCRIPTDIR/cfg/$CFG/install.sh" "$RELEASE_DIR"
cp "$SCRIPTDIR/cfg/$CFG/genimage.sh" "$RELEASE_DIR"
cp "/usr/share/syslinux/mbr.bin" "$RELEASE_DIR"
sed -i 's/ROOTFSFILE/'$rootfs_image'/g' "$RELEASE_DIR/install.sh"
sed -i 's/KERNELFILE/'$linux_image'/g' "$RELEASE_DIR/install.sh"
sed -i 's/ROOTFSFILE/'$rootfs_image'/g' "$RELEASE_DIR/genimage.sh"
sed -i 's/KERNELFILE/'$linux_image'/g' "$RELEASE_DIR/genimage.sh"
cat > "$RELEASE_DIR/syslinux.cfg" << _EOF
timeout 0
totaltimeout 50
default linux
label linux
kernel /$linux_image
append root=/dev/sda1 root_sfs=/$rootfs_image
_EOF
}

2
cfg/rpi3/PACKAGES

@ -0,0 +1,2 @@
linux-rpi3
boot-rpi3

5
cfg/rpi3/SQUASHFS

@ -0,0 +1,5 @@
coreutils
bash
rootfs
linux_modules
firmware-rpi3

6
cfg/rpi3/TOOLCHAIN

@ -0,0 +1,6 @@
TARGET="arm-linux-musleabihf"
GCC_CPU="armv6"
GCC_EXTRACFG="--with-float=hard --with-fpu=neon-vfpv3"
LINUXPKG="linux-rpi3"

1135
cfg/rpi3/bbstatic.config

File diff suppressed because it is too large

58
cfg/rpi3/boot-config.txt

@ -0,0 +1,58 @@
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1
# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720
# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2
# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4
# uncomment for composite PAL
#sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi
# Additional overlays and parameters are documented /boot/overlays/README
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
enable_uart=1

1
cfg/rpi3/cmdline.txt

@ -0,0 +1 @@
console=serial0,115200 console=tty0 root=/dev/mmcblk0p1 elevator=deadline rootwait root_sfs=ROOTFSFILE

53
cfg/rpi3/genimage.sh

@ -0,0 +1,53 @@
#!/bin/sh
set -u -e -x
FILE=$1
MOUNTED=0
LOOPATTACHED=0
function do_cleanup() {
[ $MOUNTED -ne 0 ] && umount /tmp/mnt.$$
[ $LOOPATTACHED -ne 0 ] && losetup -d ${LODEV}
rmdir /tmp/mnt.$$
}
trap do_cleanup ERR INT
cd `dirname $0`
truncate -s 1G $FILE
parted --script $FILE \
"mklabel msdos" \
"mkpart primary fat32 1M 256M" \
"mkpart primary btrfs 256M 100%" \
"set 1 boot on"
LODEV=$(losetup -f)
losetup -P ${LODEV} ${FILE}
LOOPATTACHED=1
mkfs.vfat ${LODEV}p1
mkfs.btrfs -f ${LODEV}p2
mkdir /tmp/mnt.$$
mount -t vfat ${LODEV}p1 /tmp/mnt.$$
MOUNTED=1
cp -r boot/* /tmp/mnt.$$/
umount /tmp/mnt.$$
MOUNTED=0
mount -t btrfs ${LODEV}p2 /tmp/mnt.$$
MOUNTED=1
mkdir /tmp/mnt.$$/etc /tmp/mnt.$$/etc_work
mkdir /tmp/mnt.$$/var_lib /tmp/mnt.$$/var_lib_work
umount /tmp/mnt.$$
MOUNTED=0
losetup -d ${LODEV}
LOOPATTACHED=0
rmdir /tmp/mnt.$$

60
cfg/rpi3/install.sh

@ -0,0 +1,60 @@
#!/bin/sh
set -u -e -x
CONFIRM="Yes, I am"
DEVICE=$1
MOUNTED=0
function do_cleanup() {
[ $MOUNTED -ne 0 ] && umount /tmp/mnt.$$
rmdir /tmp/mnt.$$
}
trap do_cleanup ERR INT
cd `dirname $0`
echo "Are you *really* sure to use $DEVICE?"
echo "If so, type \"$CONFIRM\""
read input
[ "x$input" != "x$CONFIRM" ] && exit 1
[ ! -b $DEVICE ] && {
echo "Error, $DEVICE is not a block device"
exit 1
}
count=$(grep -c -e "^$DEVICE" /proc/mounts || true)
[ $count -ne 0 ] && {
echo "Error, $DEVICE is mounted"
exit 1
}
dd if=/dev/zero of=$DEVICE bs=512 count=1
parted --script $DEVICE \
"mklabel msdos" \
"mkpart primary fat32 1M 256M" \
"mkpart primary btrfs 256M 100%" \
"set 1 boot on"
mkfs.vfat ${DEVICE}p1
mkfs.btrfs -f ${DEVICE}p2
mkdir /tmp/mnt.$$
mount -t vfat ${DEVICE}p1 /tmp/mnt.$$
MOUNTED=1
cp -r boot/* /tmp/mnt.$$/
umount /tmp/mnt.$$
MOUNTED=0
mount -t btrfs ${DEVICE}p2 /tmp/mnt.$$
MOUNTED=1
mkdir /tmp/mnt.$$/etc /tmp/mnt.$$/etc_work
mkdir /tmp/mnt.$$/var_lib /tmp/mnt.$$/var_lib_work
umount /tmp/mnt.$$
MOUNTED=0
rmdir /tmp/mnt.$$

2
cfg/rpi3/ld-musl-arm.path

@ -0,0 +1,2 @@
/lib
/opt/vc/lib

17
cfg/rpi3/libgcc_files.txt

@ -0,0 +1,17 @@
lib/libatomic.so
lib/libatomic.so.1
lib/libatomic.so.1.2.0
lib/libcilkrts.so
lib/libcilkrts.so.5
lib/libcilkrts.so.5.0.0
lib/libgcc_s.so
lib/libgcc_s.so.1
lib/libgomp.so
lib/libgomp.so.1
lib/libgomp.so.1.0.0
lib/libitm.so
lib/libitm.so.1
lib/libitm.so.1.0.0
lib/libstdc++.so
lib/libstdc++.so.6
lib/libstdc++.so.6.0.24

5886
cfg/rpi3/linux.config

File diff suppressed because it is too large

17
cfg/rpi3/release

@ -0,0 +1,17 @@
build_release() {
local RELEASE_DIR="$1"
local ROOTFS_SQFS="$2"
local rootfs_image=$(basename $ROOTFS_SQFS)
local bootdir="$RELEASE_DIR/boot"
mkdir -p "$bootdir"
cp -r ${PKGDEPLOYDIR}/linux-rpi3/* "$bootdir"
cp -r ${PKGDEPLOYDIR}/boot-rpi3/* "$bootdir"
cp "$SCRIPTDIR/cfg/$CFG/cmdline.txt" "$bootdir"
cp "$ROOTFS_SQFS" "$bootdir"
sed -i 's/ROOTFSFILE/'$rootfs_image'/g' "$bootdir/cmdline.txt"
cp "$SCRIPTDIR/cfg/$CFG/install.sh" "$RELEASE_DIR"
cp "$SCRIPTDIR/cfg/$CFG/genimage.sh" "$RELEASE_DIR"
}

146
mk.sh

@ -0,0 +1,146 @@
#!/bin/bash
set -e
if [ ! $# -eq 1 ]; then
echo "usage: $0 <config>"
exit 1
fi
CFG="$1"
################################ basic setup ################################
BUILDROOT=$(pwd)
SCRIPTDIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
NUMJOBS=$(grep -e "^processor" /proc/cpuinfo | wc -l)
HOSTTUPLE=$(uname -m)-$OSTYPE
TCDIR="$BUILDROOT/$CFG/toolchain"
PKGBUILDDIR="$BUILDROOT/$CFG/build"
PKGSRCDIR="$BUILDROOT/src"
PKGDEPLOYDIR="$BUILDROOT/$CFG/deploy"
PKGLOGDIR="$BUILDROOT/$CFG/log"
PKGDOWNLOADDIR="$BUILDROOT/download"
PACKAGELIST="$BUILDROOT/$CFG/pkglist"
SQFS="$BUILDROOT/$CFG/rootfs.img"
SQFS_DIR="$BUILDROOT/$CFG/squashfs"
mkdir -p "$PKGDOWNLOADDIR" "$PKGSRCDIR" "$PKGBUILDDIR" "$PKGLOGDIR"
mkdir -p "$PKGDEPLOYDIR" "$TCDIR/bin"
export PATH="$TCDIR/bin:$PATH"
source "$SCRIPTDIR/cfg/$CFG/TOOLCHAIN"
mkdir -p "$TCDIR/$TARGET"
CMAKETCFILE="$TCDIR/toolchain.cmake"
############################# include utilities ##############################
source "$SCRIPTDIR/util/depends.sh"
source "$SCRIPTDIR/util/download.sh"
source "$SCRIPTDIR/util/pkgcmd.sh"
source "$SCRIPTDIR/util/toolchain.sh"
source "$SCRIPTDIR/util/cmake.sh"
############################## build toolchain ###############################
echo "--- resolving toolchain dependencies ---"
echo "toolchain" > "$BUILDROOT/$CFG/rawpkg"
dependencies "$BUILDROOT/$CFG/rawpkg" "$PACKAGELIST" "tcpkg"
cat "$PACKAGELIST"
echo "--- downloading toolchain files ---"
while read pkg; do
fetch_package "tcpkg" "$pkg"
done < "$PACKAGELIST"
echo "--- building toolchain ---"
gen_cmake_toolchain_file
while read pkg; do
run_tcpkg_command "$pkg" "build"
run_tcpkg_command "$pkg" "deploy"
done < "$PACKAGELIST"
echo "--- backing up toolchain sysroot ---"
save_toolchain
############################### build packages ###############################
echo "--- resolving package dependencies ---"
cat "$SCRIPTDIR/cfg/$CFG/PACKAGES" "$SCRIPTDIR/cfg/$CFG/SQUASHFS" | \
sort -u > "$BUILDROOT/$CFG/rawpkg"
dependencies "$BUILDROOT/$CFG/rawpkg" "$PACKAGELIST" "pkg"
cat "$PACKAGELIST"
echo "--- downloading package files ---"
while read pkg; do
fetch_package "pkg" "$pkg"
done < "$PACKAGELIST"
echo "--- building package ---"
while read pkg; do
install_build_deps "$pkg"
run_pkg_command "$pkg" "build"
run_pkg_command "$pkg" "deploy"
restore_toolchain
done < "$PACKAGELIST"
############################### squashfs image ###############################
echo "--- building squashfs ---"
cat "$SCRIPTDIR/cfg/$CFG/SQUASHFS" | sort -u > "$BUILDROOT/$CFG/rawpkg"
dependencies "$BUILDROOT/$CFG/rawpkg" "$PACKAGELIST" "pkg"
echo "toolchain" >> "$PACKAGELIST"
mkdir -p "$SQFS_DIR"
while read pkg; do
if [ -e "$PKGDEPLOYDIR/$pkg" ]; then
cp -ru --remove-destination ${PKGDEPLOYDIR}/${pkg}/* "$SQFS_DIR"
echo "$pkg"
fi
done < "$PACKAGELIST"
if [ -f "$SQFS" ]; then
rm "$SQFS"
fi
mksquashfs "$SQFS_DIR" "$SQFS" -all-root -no-progress -no-xattrs 2>&1 > "$PKGLOGDIR/rootfs.log"
############################## release package ###############################
echo "--- building release package ---"
RELEASEDIR="$BUILDROOT/$CFG/release-$CFG"
if [ -d "$RELEASEDIR" ]; then
rm -r "$RELEASEDIR"
fi
mkdir -p "$RELEASEDIR"
unset -f build_release
source "$SCRIPTDIR/cfg/$CFG/release"
build_release "$RELEASEDIR" "$SQFS"
if [ -e "${BUILDROOT}/${CFG}/release-${CFG}.tar.gz" ]; then
rm "${BUILDROOT}/${CFG}/release-${CFG}.tar.gz"
fi
pushd "$BUILDROOT/$CFG" > /dev/null
tar czf "${BUILDROOT}/${CFG}/release-${CFG}.tar.gz" "release-${CFG}"
popd > /dev/null

39
pkg/bash/build

@ -0,0 +1,39 @@
VERSION="4.4.12"
SRCDIR="bash-${VERSION}"
TARBALL="${SRCDIR}.tar.gz"
URL="https://ftp.gnu.org/gnu/bash/"
SHA256SUM="57d8432be54541531a496fd4904fdc08c12542f43605a9202594fa5d5f9f2331"
prepare() {
return
}
build() {
local INPUT="$1"
local OUTPUT="$2"
$INPUT/configure --prefix="" --host="$TARGET" --without-bash-malloc \
--with-installed-readline
make -j $NUMJOBS
}
deploy() {
local SOURCE="$1"
local BUILD="$2"
local DEPLOY="$3"
local DEVDEPLOY="$4"
make DESTDIR="$DEPLOY" install
${TARGET}-strip --discard-all ${DEPLOY}/bin/bash
ln -sv bash "$DEPLOY/bin/sh"
rm -r "$DEPLOY/share/doc"
rm -r "$DEPLOY/share/info"
rm -r "$DEPLOY/share/man"
mv "$DEPLOY/lib" "$DEVDEPLOY"
mv "$DEPLOY/include" "$DEVDEPLOY"
}

2
pkg/bash/depends

@ -0,0 +1,2 @@
ncurses
readline

38
pkg/bbstatic/build

@ -0,0 +1,38 @@
VERSION="1.27.2"
SRCDIR="busybox-$VERSION"
TARBALL="busybox-$VERSION.tar.bz2"
URL="https://busybox.net/downloads"
SHA256SUM="9d4be516b61e6480f156b11eb42577a13529f75d3383850bb75c50c285de63df"
prepare() {
return
}
build() {
local INPUT="$1"
local OUTPUT="$2"
local CFGFILE="$SCRIPTDIR/cfg/$CFG/bbstatic.config"
local BB_CPU=$(head -1 "$CFGFILE" | cut -b 3-)
local SYSROOT="$TCDIR/$TARGET"
cp "$CFGFILE" "$OUTPUT/.config"
export KBUILD_OUTPUT="$OUTPUT"
make -C "$INPUT" O="$OUTPUT" ARCH="$BB_CPU" CROSS_COMPILE="${TARGET}-" oldconfig
sed -i "$OUTPUT/.config" -e 's,^CONFIG_CROSS_COMPILE=.*,CONFIG_CROSS_COMPILE="'$TARGET'-",'
sed -i "$OUTPUT/.config" -e 's,^CONFIG_SYSROOT=.*,CONFIG_SYSROOT="'$SYSROOT'",'
make -C "$INPUT" O="$OUTPUT" ARCH="$BB_CPU" CROSS_COMPILE="${TARGET}-" -j $NUMJOBS
}
deploy() {
local SOURCE="$1"
local BUILD="$2"
local DEPLOY="$3"
mkdir -p "$DEPLOY/bin"
cp "$BUILD/busybox" "$DEPLOY/bin"
ln -s "/bin/busybox" "$DEPLOY/bin/sh"
}

25
pkg/boot-rpi3/build

@ -0,0 +1,25 @@
# inherit package details from kernel package
source "$SCRIPTDIR/pkg/firmware-rpi3/build"
prepare() {
return
}
build() {
return
}
deploy() {
local SOURCE="$1"
local BUILD="$2"
local DEPLOY="$3"
cp -r ${SOURCE}/boot/* "$DEPLOY/"
rm $DEPLOY/kernel7.img
rm $DEPLOY/kernel.img
rm $DEPLOY/COPYING.linux
rm $DEPLOY/*.dtb
cp "$SCRIPTDIR/cfg/$CFG/boot-config.txt" "$DEPLOY/config.txt"
}

238
pkg/coreutils/0001.patch

@ -0,0 +1,238 @@
--- a/Makefile.in
+++ b/Makefile.in
@@ -2594,7 +2594,7 @@ am__DIST_COMMON = $(doc_coreutils_TEXINFOS) $(srcdir)/Makefile.in \
$(top_srcdir)/build-aux/texinfo.tex \
$(top_srcdir)/build-aux/ylwrap $(top_srcdir)/doc/local.mk \
$(top_srcdir)/lib/alloca.c $(top_srcdir)/lib/config.hin \
- $(top_srcdir)/lib/local.mk $(top_srcdir)/man/local.mk \
+ $(top_srcdir)/lib/local.mk \
$(top_srcdir)/src/local.mk $(top_srcdir)/src/single-binary.mk \
$(top_srcdir)/tests/local.mk ABOUT-NLS AUTHORS COPYING \
ChangeLog INSTALL NEWS README THANKS TODO build-aux/compile \
@@ -2695,7 +2695,6 @@ EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@
EOVERFLOW_VALUE = @EOVERFLOW_VALUE@
ERRNO_H = @ERRNO_H@
EXEEXT = @EXEEXT@
-EXTRA_MANS = @EXTRA_MANS@
FLOAT_H = @FLOAT_H@
FNMATCH_H = @FNMATCH_H@
GETADDRINFO_LIB = @GETADDRINFO_LIB@
@@ -3972,7 +3971,6 @@ libexecdir = @libexecdir@
lispdir = @lispdir@
localedir = @localedir@
localstatedir = @localstatedir@
-man1_MANS = @man1_MANS@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -4165,8 +4163,8 @@ EXTRA_DIST = .mailmap .prev-version .version .vg-suppressions \
lib/xgetcwd.h lib/xnanosleep.h lib/xreadlink.h lib/xstrtod.h \
lib/xstrtol.h lib/xstrtod.c lib/xstrtod.h lib/xalloc.h \
lib/yesno.h src/dcgen src/dircolors.hin src/primes.h \
- src/tac-pipe.c src/extract-magic man/help2man man/dummy-man \
- $(man1_MANS:.1=.x) $(EXTRA_MANS:.1=.x) $(all_tests) init.cfg \
+ src/tac-pipe.c src/extract-magic \
+ $(all_tests) init.cfg \
tests/Coreutils.pm tests/CuSkip.pm tests/CuTmpdir.pm \
tests/d_type-check tests/envvar-check tests/factor/run.sh \
tests/factor/create-test.sh tests/filefrag-extent-compare \
@@ -4275,7 +4273,7 @@ CLEANFILES = lib/configmake.h lib/configmake.h-t lib/charset.alias \
lib/ref-add.sed lib/ref-del.sed $(SCRIPTS) \
$(no_install__progs) src/coreutils_symlinks \
src/coreutils_shebangs src/fs-def src/fs-magic \
- src/fs-kernel-magic $(ALL_MANS) $(factor_tests)
+ src/fs-kernel-magic $(factor_tests)
MOSTLYCLEANDIRS = lib/arpa lib/netinet lib/selinux lib/sys lib/sys \
lib/sys lib/sys lib/sys lib/sys lib/sys lib/sys
AM_CPPFLAGS = -Ilib -I$(top_srcdir)/lib -Isrc -I$(top_srcdir)/src
@@ -5139,18 +5137,6 @@ find_upper_case_var = \
} \
END {$$m and (warn "$@: do not use upper case in \@var{...}\n"), exit 1}'
-@HAVE_PERL_FALSE@run_help2man = $(SHELL) $(srcdir)/man/dummy-man
-@HAVE_PERL_TRUE@run_help2man = $(PERL) -- $(srcdir)/man/help2man
-ALL_MANS = $(man1_MANS) $(EXTRA_MANS)
-
-# Dependencies common to all man pages. Updated below.
-
-# Depend on this to get version number changes.
-
-# This is required so that changes to e.g., emit_bug_reporting_address
-# provoke regeneration of all the manpages.
-mandeps = .version $(top_srcdir)/src/system.h $(am__append_5)
-
# Indirections required so that we'll still be able to know the
# complete list of our tests even if the user overrides TESTS
# from the command line (as permitted by the test harness API).
@@ -5978,10 +5964,10 @@ all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
-.SUFFIXES: .1 .c .dvi .log .o .obj .pl .pl$(EXEEXT) .ps .sed .sh .sh$(EXEEXT) .sin .trs .x .xpl .xpl$(EXEEXT) .y
+.SUFFIXES: .c .dvi .log .o .obj .pl .pl$(EXEEXT) .ps .sed .sh .sh$(EXEEXT) .sin .trs .x .xpl .xpl$(EXEEXT) .y
am--refresh: Makefile
@:
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/lib/local.mk $(srcdir)/lib/gnulib.mk $(top_srcdir)/src/local.mk $(srcdir)/src/cu-progs.mk $(top_srcdir)/src/single-binary.mk $(top_srcdir)/doc/local.mk $(top_srcdir)/man/local.mk $(top_srcdir)/tests/local.mk $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/lib/local.mk $(srcdir)/lib/gnulib.mk $(top_srcdir)/src/local.mk $(srcdir)/src/cu-progs.mk $(top_srcdir)/src/single-binary.mk $(top_srcdir)/doc/local.mk $(top_srcdir)/tests/local.mk $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -6003,7 +5989,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
-$(top_srcdir)/lib/local.mk $(srcdir)/lib/gnulib.mk $(top_srcdir)/src/local.mk $(srcdir)/src/cu-progs.mk $(top_srcdir)/src/single-binary.mk $(top_srcdir)/doc/local.mk $(top_srcdir)/man/local.mk $(top_srcdir)/tests/local.mk $(am__empty):
+$(top_srcdir)/lib/local.mk $(srcdir)/lib/gnulib.mk $(top_srcdir)/src/local.mk $(srcdir)/src/cu-progs.mk $(top_srcdir)/src/single-binary.mk $(top_srcdir)/doc/local.mk $(top_srcdir)/tests/local.mk $(am__empty):
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
@@ -14750,149 +14736,6 @@ sc-lower-case-var:
check-local: check-texinfo
-# This is a kludge to remove generated 'man/*.1' from a non-srcdir build.
-# Without this, "make distcheck" might fail.
-distclean-local:
- test x$(srcdir) = x$(builddir) || rm -f $(ALL_MANS)
-
-$(ALL_MANS): $(mandeps)
-# Most prog.1 man pages depend on src/prog. List the exceptions:
-@SINGLE_BINARY_FALSE@man/install.1: src/ginstall$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/test.1: src/[$(EXEEXT)
-
-@SINGLE_BINARY_FALSE@man/arch.1: src/arch$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/b2sum.1: src/b2sum$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/base32.1: src/base32$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/base64.1: src/base64$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/basename.1: src/basename$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/cat.1: src/cat$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/chcon.1: src/chcon$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/chgrp.1: src/chgrp$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/chmod.1: src/chmod$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/chown.1: src/chown$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/chroot.1: src/chroot$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/cksum.1: src/cksum$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/comm.1: src/comm$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/coreutils.1: src/coreutils$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/cp.1: src/cp$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/csplit.1: src/csplit$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/cut.1: src/cut$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/date.1: src/date$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/dd.1: src/dd$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/df.1: src/df$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/dir.1: src/dir$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/dircolors.1: src/dircolors$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/dirname.1: src/dirname$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/du.1: src/du$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/echo.1: src/echo$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/env.1: src/env$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/expand.1: src/expand$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/expr.1: src/expr$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/factor.1: src/factor$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/false.1: src/false$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/fmt.1: src/fmt$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/fold.1: src/fold$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/groups.1: src/groups$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/head.1: src/head$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/hostid.1: src/hostid$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/hostname.1: src/hostname$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/id.1: src/id$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/join.1: src/join$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/kill.1: src/kill$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/link.1: src/link$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/ln.1: src/ln$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/logname.1: src/logname$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/ls.1: src/ls$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/md5sum.1: src/md5sum$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/mkdir.1: src/mkdir$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/mkfifo.1: src/mkfifo$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/mknod.1: src/mknod$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/mktemp.1: src/mktemp$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/mv.1: src/mv$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/nice.1: src/nice$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/nl.1: src/nl$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/nohup.1: src/nohup$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/nproc.1: src/nproc$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/numfmt.1: src/numfmt$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/od.1: src/od$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/paste.1: src/paste$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/pathchk.1: src/pathchk$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/pinky.1: src/pinky$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/pr.1: src/pr$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/printenv.1: src/printenv$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/printf.1: src/printf$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/ptx.1: src/ptx$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/pwd.1: src/pwd$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/readlink.1: src/readlink$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/realpath.1: src/realpath$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/rm.1: src/rm$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/rmdir.1: src/rmdir$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/runcon.1: src/runcon$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/seq.1: src/seq$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/sha1sum.1: src/sha1sum$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/sha224sum.1: src/sha224sum$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/sha256sum.1: src/sha256sum$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/sha384sum.1: src/sha384sum$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/sha512sum.1: src/sha512sum$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/shred.1: src/shred$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/shuf.1: src/shuf$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/sleep.1: src/sleep$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/sort.1: src/sort$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/split.1: src/split$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/stat.1: src/stat$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/stdbuf.1: src/stdbuf$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/stty.1: src/stty$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/sum.1: src/sum$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/sync.1: src/sync$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/tac.1: src/tac$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/tail.1: src/tail$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/tee.1: src/tee$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/timeout.1: src/timeout$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/touch.1: src/touch$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/tr.1: src/tr$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/true.1: src/true$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/truncate.1: src/truncate$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/tsort.1: src/tsort$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/tty.1: src/tty$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/uname.1: src/uname$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/unexpand.1: src/unexpand$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/uniq.1: src/uniq$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/unlink.1: src/unlink$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/uptime.1: src/uptime$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/users.1: src/users$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/vdir.1: src/vdir$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/wc.1: src/wc$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/who.1: src/who$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/whoami.1: src/whoami$(EXEEXT)
-@SINGLE_BINARY_FALSE@man/yes.1: src/yes$(EXEEXT)
-
-.x.1:
- $(AM_V_GEN)name=`echo $@ | sed 's|.*/||; s|\.1$$||'` || exit 1; \
- case $$name in \
- install) prog='ginstall'; argv=$$name;; \
- test) prog='['; argv='[';; \
- *) prog=$$name; argv=$$prog;; \
- esac; \
- rm -f $@ $@-t \
- && t=$*.td \
- && rm -rf $$t \
- && $(MKDIR_P) $$t \
- && (cd $$t && $(LN_S) '$(abs_top_builddir)/src/'$$prog$(EXEEXT) \
- $$argv$(EXEEXT)) \
- && : $${SOURCE_DATE_EPOCH=`cat $(srcdir)/.timestamp 2>/dev/null || :`} \
- && export SOURCE_DATE_EPOCH && $(run_help2man) \
- --source='$(PACKAGE_STRING)' \
- --include=$(srcdir)/man/$$name.x \
- --output=$$t/$$name.1 \
- --info-page='\(aq(coreutils) '$$name' invocation\(aq' \
- $$t/$$argv$(EXEEXT) \
- && sed \
- -e 's|$*\.td/||g' \
- -e '/For complete documentation/d' \
- $$t/$$name.1 > $@-t \
- && rm -rf $$t \
- && chmod a-w $@-t \
- && mv $@-t $@
.PHONY: check-root
check-root:
$(MAKE) check TESTS='$(root_tests)' SUBDIRS=.

32
pkg/coreutils/build

@ -0,0 +1,32 @@
VERSION="8.28"
SRCDIR="coreutils-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="https://ftp.gnu.org/gnu/coreutils/"
SHA256SUM="1117b1a16039ddd84d51a9923948307cfa28c2cea03d1a2438742253df0a0c65"
prepare() {
local PKGSCRIPTDIR="$1"
for PATCH in ${PKGSCRIPTDIR}/*.patch; do
patch -p1 < $PATCH
done
}
build() {
local INPUT="$1"
local OUTPUT="$2"
$INPUT/configure --prefix="" --host="$TARGET" \
--enable-no-install-program=kill,uptime,dir,vdir,chcon,pinky,runcon
make -j $NUMJOBS
}
deploy() {
local SOURCE="$1"
local BUILD="$2"
local DEPLOY="$3"
make DESTDIR="$DEPLOY" install-strip
rm -r "$DEPLOY/share"
}

43
pkg/firmware-rpi3/build

@ -0,0 +1,43 @@
VERSION="1.20170427"
SRCDIR="firmware-${VERSION}"
TARBALL="${VERSION}"
URL="https://codeload.github.com/raspberrypi/firmware/tar.gz"
SHA256SUM="e253084463a0a3ba908396ac383169397d53bc55307d0d8471f2814f2458fa1b"
#export BRCM43430FW_BUILD_DIR=$(BUILD_DIR)/brcm43430fw
#export BRCM43430FW_SOURCE_DIR=$(SOURCE_DIR)/brcm43430fw
#export BRCM43430FW_DEPLOY_DIR=$(DEPLOY_DIR)/brcm43430fw
#BRCM43430FW_VERSION=brcmfmac43430-sdio
#BRCM43430FW_SRCDIR=$(BRCM43430FW_BUILD_DIR)/brcm43430fw-$(BRCM43430FW_VERSION)
#BRCM43430FW_FILE=$(BRCM43430FW_VERSION).txt
#BRCM43430FW_URL=https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm80211/brcm/${BRCM43430FW_FILE}
#
#brcm43430fw_deploy:
# mkdir -p $(BRCM43430FW_DEPLOY_DIR)/lib/firmware/brcm/
# cp $(BRCM43430FW_BUILD_DIR)/${BRCM43430FW_FILE} $(BRCM43430FW_DEPLOY_DIR)/lib/firmware/brcm/
# rsync -aH $(BRCM43430FW_DEPLOY_DIR)/lib $(PRE_ROOTFS_DEPLOY_DIR)/rootfs/
prepare() {
return
}
build() {
return
}
deploy() {
local SOURCE="$1"
local BUILD="$2"
local DEPLOY="$3"
local DEVDEPLOY="$4"
cp -r "$SOURCE/hardfp/opt" "$DEPLOY/"
mkdir -p "$DEVDEPLOY/opt/vc"
mv "$DEPLOY/opt/vc/include" "$DEVDEPLOY"
cp -r "$DEPLOY/opt/vc/lib" "$DEVDEPLOY/opt/vc"
rm ${DEPLOY}/opt/vc/lib/*.a
rm -r "${DEPLOY}/opt/vc/lib/pkgconfig"
rm -r "${DEPLOY}/opt/vc/src"
}

98
pkg/initrd/build

@ -0,0 +1,98 @@
filetype() {
local argv1="$1"
# symlink test must come before file test
if [ -L "${argv1}" ]; then
echo "slink"
elif [ -f "${argv1}" ]; then
echo "file"
elif [ -d "${argv1}" ]; then
echo "dir"
else
echo "invalid"
fi
return 0
}
# for each file print a line in following format
# <filetype> <name> <path to file> <octal mode> <uid> <gid>
# for links, devices etc the format differs. See gen_init_cpio for details
parse() {
local location="$1"
local name="/${location#${srcdir}}"
# change '//' into '/'
name=$(echo "$name" | sed -e 's://*:/:g')
local mode="$2"
local uid="$3"
local gid="$4"
local ftype=$(filetype "${location}")
local str="${mode} 0 0 "
[ "${ftype}" = "invalid" ] && return 0
[ "${location}" = "${srcdir}" ] && return 0
case "${ftype}" in
"file")
str="${ftype} ${name} ${location} ${str}"
;;
"slink")
local target=`readlink "${location}"`
str="${ftype} ${name} ${target} ${str}"
;;
*)
str="${ftype} ${name} ${str}"
;;
esac
echo "${str}"
return 0
}
# process one directory (incl sub-directories)
dir_filelist() {
srcdir=$(echo "$1" | sed -e 's://*:/:g')
dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n")
# If $dirlist is only one line, then the directory is empty
if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then
echo "${dirlist}" | while read x; do
parse ${x}
done
fi
}
prepare() {
return
}
build() {
local INPUT="$1"
local OUTPUT="$2"
# populate with default directory structure
for dir in dev proc sys bin lib newroot images; do
mkdir -p "$OUTPUT/$dir"
done
ln -s "/bin" "$OUTPUT/sbin"
# add init script
cp "$SCRIPTDIR/pkg/initrd/initrd.skel" "$OUTPUT/init"
chmod +x "$OUTPUT/init"
# 'install' packages to initrd
cp -r ${PKGDEPLOYDIR}/bbstatic/* "$OUTPUT"
}
deploy() {
local SOURCE="$1"
local BUILD="$2"
local DEPLOY="$3"
local LSTFILE="$DEPLOY/initrd.list"
dir_filelist "$BUILD" > "$LSTFILE"
echo "dir /dev 0755 0 0" >> "$LSTFILE"
echo "nod /dev/console 600 0 0 c 5 1" >> "$LSTFILE"
}

1
pkg/initrd/depends

@ -0,0 +1 @@
bbstatic

77
pkg/initrd/initrd.skel

@ -0,0 +1,77 @@
#!/bin/sh
PATH=/bin
/bin/busybox --install
busybox sleep 1
busybox mount -t proc proc /proc
busybox mount -t sysfs sysfs /sys
busybox mount -t devtmpfs none /dev
root_sfs=""
root=""
singleuser=0
for param in `cat /proc/cmdline`; do
case $param in
root=*)
root="${param##root=}"
;;
root_sfs=*)
root_sfs="${param##root_sfs=}"
;;
single*)
singleuser=1
;;
esac
done
if [ -z "${root}" ]; then
echo "No root drive specified!"
exec /bin/busybox sh
fi
if [ -z "${root_sfs}" ]; then
echo "No squashfs image specified!"
exec /bin/busybox sh
fi
while [ ! -e ${root} ]; do
echo "Waiting for root"
busybox sleep 1
done
mount ${root} /images
if [ ! -e /images/${root_sfs} ]; then
echo "${root_sfs} not found!"
exec /bin/busybox sh
exit 1
fi
mount -t squashfs /images/${root_sfs} /newroot
mount -t devtmpfs none /newroot/dev
mount -t proc proc /newroot/proc
mount -t sysfs sysfs /newroot/sys
mount -t tmpfs none /newroot/tmp
mount -t tmpfs none /newroot/var
mount -t tmpfs none /newroot/run
chmod 755 /newroot/var
mkdir -p /newroot/run/log/journal
mkdir -p /newroot/var/log/fsck
mkdir -p /newroot/var/log/nginx
mkdir -p /newroot/var/log/mpd
mkdir -p /newroot/var/spool/
mkdir -p /newroot/var/lib/
mkdir -p /newroot/var/tmp
ln -s /run /newroot/var/run
ln -s /run/lock /newroot/var/lock
# cleanup mounts
umount -l /images
umount -l /dev
umount /sys
umount /proc
exec /bin/busybox switch_root /newroot /bin/bash

42
pkg/linux-rpi3/build

@ -0,0 +1,42 @@
VERSION="1.20170427-1"
SRCDIR="linux-raspberrypi-kernel_${VERSION}"
TARBALL="raspberrypi-kernel_${VERSION}"
URL="https://codeload.github.com/raspberrypi/linux/tar.gz"
SHA256SUM="c9b60483e901556a2fbab64c06be8a9eba884f3eaac98ba39347e82bb0a00f5b"
prepare() {
return
}
build() {
local INPUT="$1"
local OUTPUT="$2"
local CFGFILE="$SCRIPTDIR/cfg/$CFG/linux.config"
local INITRDLIST="$PKGDEPLOYDIR/initrd/initrd.list"
export KBUILD_OUTPUT="$OUTPUT"
make -C "$INPUT" O="$OUTPUT" ARCH="arm" CROSS_COMPILE="${TARGET}-" mrproper
cp "$CFGFILE" "$OUTPUT/.config"
sed -i "$OUTPUT/.config" -e 's,^CONFIG_CROSS_COMPILE=.*,CONFIG_CROSS_COMPILE="'$TARGET'-",'
sed -i "$OUTPUT/.config" -e 's,^CONFIG_INITRAMFS_SOURCE=.*,CONFIG_INITRAMFS_SOURCE="'$INITRDLIST'",'
make -C "$INPUT" O="$OUTPUT" ARCH="arm" CROSS_COMPILE="${TARGET}-" oldconfig
sed -i "$OUTPUT/.config" -e 's,^CONFIG_CROSS_COMPILE=.*,CONFIG_CROSS_COMPILE="'$TARGET'-",'
sed -i "$OUTPUT/.config" -e 's,^CONFIG_INITRAMFS_SOURCE=.*,CONFIG_INITRAMFS_SOURCE="'$INITRDLIST'",'
make -C "$INPUT" O="$OUTPUT" ARCH="arm" CROSS_COMPILE="${TARGET}-" -j $NUMJOBS zImage dtbs
}
deploy() {
local SOURCE="$1"
local BUILD="$2"
local DEPLOY="$3"
local CFGFILE="$SCRIPTDIR/cfg/$CFG/linux.config"
pushd $BUILD
install -m 755 "arch/arm/boot/zImage" "$DEPLOY/kernel.img"
cp arch/arm/boot/dts/*.dtb "$DEPLOY/"
popd
}

1
pkg/linux-rpi3/depends

@ -0,0 +1 @@
initrd

49
pkg/linux/build

@ -0,0 +1,49 @@
MAJOR="4"
MINOR="14"
RELEASE="1"
VERSION="$MAJOR.$MINOR.$RELEASE"
SRCDIR="linux-$VERSION"
TARBALL="linux-$VERSION.tar.xz"
URL="https://www.kernel.org/pub/linux/kernel/v$MAJOR.x"
SHA256SUM="6fb9f67002f986ce3905b35466e35c394e0fa3eb7c32df508514717955cb4de7"
prepare() {
return
}
build() {
local INPUT="$1"
local OUTPUT="$2"
local CFGFILE="$SCRIPTDIR/cfg/$CFG/linux.config"
local LINUX_CPU=$(head -1 "$CFGFILE" | cut -b 3-)
local LINUX_TGT=$(head -2 "$CFGFILE" | tail -1 | cut -b 3-)
local INITRDLIST="$PKGDEPLOYDIR/initrd/initrd.list"
export KBUILD_OUTPUT="$OUTPUT"
make -C "$INPUT" O="$OUTPUT" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" mrproper
cp "$CFGFILE" "$OUTPUT/.config"
make -C "$INPUT" O="$OUTPUT" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" oldconfig
sed -i "$OUTPUT/.config" -e 's,^CONFIG_CROSS_COMPILE=.*,CONFIG_CROSS_COMPILE="'$TARGET'-",'
sed -i "$OUTPUT/.config" -e 's,^CONFIG_INITRAMFS_SOURCE=.*,CONFIG_INITRAMFS_SOURCE="'$INITRDLIST'",'
make -C "$INPUT" O="$OUTPUT" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" -j $NUMJOBS $LINUX_TGT
}
deploy() {
local SOURCE="$1"
local BUILD="$2"
local DEPLOY="$3"
local CFGFILE="$SCRIPTDIR/cfg/$CFG/linux.config"
local LINUX_CPU=$(head -1 "$CFGFILE" | cut -b 3-)
local LINUX_TGT=$(head -2 "$CFGFILE" | tail -1 | cut -b 3-)
mkdir -p "$DEPLOY/boot"
pushd $BUILD
install -m 755 "arch/$LINUX_CPU/boot/$LINUX_TGT" "$DEPLOY/boot/vmlinuz-$VERSION"
popd
}

1
pkg/linux/depends

@ -0,0 +1 @@
initrd

36
pkg/linux_modules/build

@ -0,0 +1,36 @@
# inherit package details from kernel package
source "$SCRIPTDIR/pkg/$LINUXPKG/build"
prepare() {
return
}
build() {
local INPUT="$1"
local OUTPUT="$2"
local CFGFILE="$SCRIPTDIR/cfg/$CFG/linux.config"
local LINUX_CPU=$(head -1 "$CFGFILE" | cut -b 3-)
export KBUILD_OUTPUT="$OUTPUT"
make -C "$INPUT" O="$OUTPUT" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" mrproper
cp "$CFGFILE" "$OUTPUT/.config"
make -C "$INPUT" O="$OUTPUT" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" oldconfig
sed -i "$OUTPUT/.config" -e 's,^CONFIG_CROSS_COMPILE=.*,CONFIG_CROSS_COMPILE="'$TARGET'-",'
make -C "$INPUT" O="$OUTPUT" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" -j $NUMJOBS modules
}
deploy() {
local SOURCE="$1"
local BUILD="$2"
local DEPLOY="$3"
local CFGFILE="$SCRIPTDIR/cfg/$CFG/linux.config"
local LINUX_CPU=$(head -1 "$CFGFILE" | cut -b 3-)
mkdir -p "$DEPLOY/lib/modules"
export KBUILD_OUTPUT="$BUILD"
make -C "$SOURCE" O="$BUILD" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" INSTALL_MOD_PATH="$DEPLOY" modules_install
}

58
pkg/ncurses/build

@ -0,0 +1,58 @@
VERSION="6.0"
SRCDIR="ncurses-${VERSION}"
TARBALL="${SRCDIR}.tar.gz"
URL="https://ftp.gnu.org/gnu/ncurses/"
SHA256SUM="f551c24b30ce8bfb6e96d9f59b42fbea30fa3a6123384172f9e7284bcf647260"
prepare() {
return
}
build() {
local INPUT="$1"
local OUTPUT="$2"
$INPUT/configure --prefix="" --host="$TARGET" \
--with-shared --without-debug \
--without-ada --enable-widec \
--with-pkg-config-libdir=/lib/pkgconfig \
--enable-pc-files
make -j $NUMJOBS
}
deploy() {
local SOURCE="$1"
local BUILD="$2"
local DEPLOY="$3"
local DEVDEPLOY="$4"
make DESTDIR="$DEPLOY" install
rm -r "$DEPLOY/share/man"
rm "$DEPLOY/bin/ncursesw6-config"
mkdir -p "$DEVDEPLOY/lib"
mv "$DEPLOY/include" "$DEVDEPLOY"
cp -r "$DEPLOY/lib" "$DEVDEPLOY"
rm ${DEPLOY}/lib/*.a
rm -r "$DEPLOY/lib/pkgconfig"
mkdir -p "${DEVDEPLOY}/include/ncurses"
for hdr in ${DEVDEPLOY}/include/ncursesw/*.h; do
local fname=$(basename $hdr)
local target="../$fname"
mv "$hdr" "${DEVDEPLOY}/include"
ln -s "$target" "${DEVDEPLOY}/include/ncursesw/${fname}"
ln -s "$target" "${DEVDEPLOY}/include/ncurses/${fname}"
done
ln -s "libncursesw.so.$VERSION" "$DEPLOY/lib/libtinfo.so"
ln -s "libncursesw.so.$VERSION" "$DEPLOY/lib/libtinfo.so.$VERSION"
ln -s "libncursesw.so.$VERSION" "$DEVDEPLOY/lib/libtinfo.so"
ln -s "libncursesw.so.$VERSION" "$DEVDEPLOY/lib/libtinfo.so.$VERSION"
ln -s "libncursesw.a.$VERSION" "$DEVDEPLOY/lib/libtinfo.a"
}

32
pkg/readline/build

@ -0,0 +1,32 @@
VERSION="7.0"
SRCDIR="readline-${VERSION}"
TARBALL="${SRCDIR}.tar.gz"
URL="https://ftp.gnu.org/gnu/readline/"
SHA256SUM="750d437185286f40a369e1e4f4764eda932b9459b5ec9a731628393dd3d32334"
prepare() {
return
}
build() {
local INPUT="$1"
local OUTPUT="$2"
$INPUT/configure --prefix="" --host="$TARGET" --disable-static
make SHLIB_LIBS="-lncursesw" -j $NUMJOBS
}
deploy() {
local SOURCE="$1"
local BUILD="$2"
local DEPLOY="$3"
local DEVDEPLOY="$4"
make SHLIB_LIBS="-lncursesw" DESTDIR="$DEPLOY" install
mv "$DEPLOY/include" "$DEVDEPLOY"
rm -r "$DEPLOY/share"
cp -r "$DEPLOY/lib" "$DEVDEPLOY/"
}

1
pkg/readline/depends

@ -0,0 +1 @@
ncurses

16
pkg/rootfs/build

@ -0,0 +1,16 @@
prepare() {
return
}
build() {
return
}
deploy() {
local SOURCE="$1"
local BUILD="$2"
local DEPLOY="$3"
mkdir -p "$DEPLOY/dev" "$DEPLOY/sys" "$DEPLOY/proc"
mkdir -p "$DEPLOY/tmp" "$DEPLOY/var" "$DEPLOY/run"
}

25
tcpkg/binutils/build

@ -0,0 +1,25 @@
VERSION="2.29.1"
SRCDIR="binutils-$VERSION"
TARBALL="binutils-$VERSION.tar.bz2"
URL="http://ftp.gnu.org/gnu/binutils"
SHA256SUM="1509dff41369fb70aed23682351b663b56db894034773e6dbf7d5d6071fc55cc"
prepare() {
return
}
build() {
local INPUT="$1"
local OUTPUT="$2"
$INPUT/configure --prefix="$TCDIR" --target="$TARGET" \
--with-sysroot="$TCDIR/$TARGET" \
--disable-nls --disable-multilib
make configure-host
make -j $NUMJOBS
}
deploy() {
make install
}

17
tcpkg/cloog/build

@ -0,0 +1,17 @@
VERSION="0.18.1"
SRCDIR="cloog-$VERSION"
TARBALL="cloog-$VERSION.tar.gz"
URL="ftp://gcc.gnu.org/pub/gcc/infrastructure"
SHA256SUM="02500a4edd14875f94fe84cbeda4290425cb0c1c2474c6f75d75a303d64b4196"
prepare() {
return
}
build() {
return
}
deploy() {
return
}

46
tcpkg/gcc1/build

@ -0,0 +1,46 @@
VERSION="7.2.0"
SRCDIR="gcc-$VERSION"
TARBALL="gcc-$VERSION.tar.xz"
URL="http://ftp.gnu.org/gnu/gcc/gcc-$VERSION"
SHA256SUM="1cf7adf8ff4b5aa49041c8734bbcf1ad18cc4c94d0029aae0f4e48841088479a"
prepare() {
for child in cloog gmp isl mpc mpfr; do
unset -f build deploy prepare
unset -v VERSION TARBALL URL SRCDIR SHA256SUM
source "$SCRIPTDIR/tcpkg/$child/build"
if [ ! -e "$child" ]; then
echo "installing symlink to $child..."
ln -s "$PKGSRCDIR/$SRCDIR" "$child"
else
if [ ! -L "$child" ]; then
echo "ERROR: $child " \
"exists but is not a symlink!"
exit 1
fi
fi
done
}
build() {
local INPUT="$1"
local OUTPUT="$2"
$INPUT/configure --prefix="$TCDIR" --target="$TARGET" \
--build="$HOSTTUPLE" --host="$HOSTTUPLE" \
--with-sysroot="$TCDIR/$TARGET" \
--disable-nls --disable-shared --without-headers \
--disable-multilib --disable-decimal-float \
--disable-libgomp --disable-libmudflap \
--disable-libssp --disable-libatomic \
--disable-libquadmath --disable-threads \
--enable-languages=c --with-newlib \
--with-arch="$GCC_CPU" $GCC_EXTRACFG
make -j $NUMJOBS all-gcc all-target-libgcc
}
deploy() {
make install-gcc install-target-libgcc
}

7
tcpkg/gcc1/depends

@ -0,0 +1,7 @@
binutils
cloog
gmp
isl
mpc
mpfr
linux_hdr

28
tcpkg/gcc2/build

@ -0,0 +1,28 @@
# inherit package details from first stage GCC
source "$SCRIPTDIR/tcpkg/gcc1/build"
prepare() {
return
}
build() {
local INPUT="$1"
local OUTPUT="$2"
$INPUT/configure --prefix="$TCDIR" --target="$TARGET" \
--build="$HOSTTUPLE" --host="$HOSTTUPLE" \
--with-sysroot="$TCDIR/$TARGET" \
--disable-nls --enable-languages=c,c++ \
--enable-c99 --enable-long-long \
--disable-libmudflap --disable-multilib \
--disable-libmpx --disable-libssp \
--disable-libsanitizer \
--with-arch="$GCC_CPU" $GCC_EXTRACFG \
--with-native-system-header-dir="/include"
make -j $NUMJOBS
}
deploy() {
make install
}

2
tcpkg/gcc2/depends

@ -0,0 +1,2 @@
gcc1
musl

17
tcpkg/gmp/build

@ -0,0 +1,17 @@
VERSION="6.1.2"
SRCDIR="gmp-$VERSION"
TARBALL="gmp-$VERSION.tar.bz2"
URL="http://ftp.gnu.org/gnu/gmp"
SHA256SUM="5275bb04f4863a13516b2f39392ac5e272f5e1bb8057b18aec1c9b79d73d8fb2"
prepare() {
return
}
build() {
return
}
deploy() {
return
}

17
tcpkg/isl/build

@ -0,0 +1,17 @@
VERSION="0.18"
SRCDIR="isl-$VERSION"
TARBALL="isl-$VERSION.tar.bz2"
URL="ftp://gcc.gnu.org/pub/gcc/infrastructure"
SHA256SUM="6b8b0fd7f81d0a957beb3679c81bbb34ccc7568d5682844d8924424a0dadcb1b"
prepare() {
return
}
build() {
return
}
deploy() {
return
}

16
tcpkg/libgcc/build

@ -0,0 +1,16 @@
prepare() {
return
}
build() {
return
}
deploy() {
local INPUT="$1"
local OUTPUT="$2"
local DEPLOY="$3"
rsync -aH --files-from="$SCRIPTDIR/cfg/$CFG/libgcc_files.txt" \
"$TCDIR/$TARGET" "$DEPLOY"
}

1
tcpkg/libgcc/depends

@ -0,0 +1 @@
gcc2

28
tcpkg/linux_hdr/build

@ -0,0 +1,28 @@
# inherit package details from kernel package
source "$SCRIPTDIR/pkg/$LINUXPKG/build"
prepare() {
return
}
build() {
local INPUT="$1"
local OUTPUT="$2"
local CFGFILE="$SCRIPTDIR/cfg/$CFG/linux.config"
local LINUX_CPU=$(head -1 "$CFGFILE" | cut -b 3-)
make -C "$INPUT" O="$OUTPUT" ARCH="$LINUX_CPU" mrproper
make -C "$INPUT" O="$OUTPUT" ARCH="$LINUX_CPU" headers_check
}
deploy() {
local INPUT="$1"
local OUTPUT="$2"
local CFGFILE="$SCRIPTDIR/cfg/$CFG/linux.config"
local LINUX_CPU=$(head -1 "$CFGFILE" | cut -b 3-)
export KBUILD_OUTPUT="$OUTPUT"
make -C "$INPUT" O="$OUTPUT" ARCH="$LINUX_CPU" INSTALL_HDR_PATH="$TCDIR/$TARGET" headers_install
}

17
tcpkg/mpc/build

@ -0,0 +1,17 @@
VERSION="1.0.3"
SRCDIR="mpc-$VERSION"
TARBALL="mpc-$VERSION.tar.gz"
URL="http://ftp.gnu.org/gnu/mpc"
SHA256SUM="617decc6ea09889fb08ede330917a00b16809b8db88c29c31bfbb49cbf88ecc3"
prepare() {
return
}
build() {
return
}
deploy() {
return
}

17
tcpkg/mpfr/build

@ -0,0 +1,17 @@
VERSION="3.1.4"
SRCDIR="mpfr-$VERSION"
TARBALL="mpfr-$VERSION.tar.bz2"
URL="http://ftp.gnu.org/gnu/mpfr"
SHA256SUM="d3103a80cdad2407ed581f3618c4bed04e0c92d1cf771a65ead662cc397f7775"
prepare() {
return
}
build() {
return
}
deploy() {
return
}

31
tcpkg/musl/build

@ -0,0 +1,31 @@
VERSION="1.1.18"
SRCDIR="musl-$VERSION"
TARBALL="$SRCDIR.tar.gz"
URL="http://www.musl-libc.org/releases"
SHA256SUM="d017ee5d01aec0c522a1330fdff06b1e428cb409e1db819cc4935d5da4a5a118"
prepare() {
return
}
build() {
local INPUT="$1"
local OUTPUT="$2"
CC="${TARGET}-gcc" $INPUT/configure --prefix=/ --target="$TARGET"
CC="${TARGET}-gcc" make -j $NUMJOBS
}
deploy() {
local INPUT="$1"
local OUTPUT="$2"
local DEPLOY="$3"
DESTDIR="$TCDIR/$TARGET" make install
DESTDIR="$DEPLOY" make install-libs
rm $DEPLOY/lib/*.a $DEPLOY/lib/*.o
mkdir -p "$DEPLOY/etc"
cp ${SCRIPTDIR}/cfg/${CFG}/ld-musl-* "$DEPLOY/etc/"
}

1
tcpkg/musl/depends

@ -0,0 +1 @@
gcc1

30
tcpkg/pkg-config/build

@ -0,0 +1,30 @@
VERSION="0.29.2"
SRCDIR="pkg-config-$VERSION"
TARBALL="$SRCDIR.tar.gz"
URL="https://pkg-config.freedesktop.org/releases/"
SHA256SUM="6fc69c01688c9458a57eb9a1664c9aba372ccda420a02bf4429fe610e7e7d591"
prepare() {
return
}
build() {
local SOURCE="$1"
local BUILD="$2"
$SOURCE/configure --prefix="$TCDIR" --target="$TARGET" \
--build="$HOSTTUPLE" --host="$HOSTTUPLE" \
--with-sysroot="$TCDIR/$TARGET" \
--with-pc-path="$TCDIR/$TARGET/lib/pkgconfig" \
--with-system-include-path="/include" \
--with-system-library-path="/lib" \
--with-internal-glib
make -j $NUMJOBS
}
deploy() {
make install
ln -s pkg-config "$TCDIR/bin/$TARGET-pkg-config"
}

11
tcpkg/toolchain/build

@ -0,0 +1,11 @@
prepare() {
return
}
build() {
return
}