mirror of
https://github.com/pygos/build.git
synced 2024-11-22 11:09:46 +01:00
Move rootfs generation to dedicated packages
Add rootfs-<cfg> packages that create the skeleton system, copy the files and create the squashfs images. Old "SQUASHFS" package list is depends file of rootfs-<cfg> package. This removes some of the special case code. Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
This commit is contained in:
parent
4ca9d6b14c
commit
4039cd1c81
11 changed files with 82 additions and 49 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
rootfs-alix
|
||||||
bbstatic
|
bbstatic
|
||||||
initrd
|
initrd
|
||||||
linux
|
linux
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
/lib
|
|
|
@ -1,2 +1,3 @@
|
||||||
|
rootfs-rpi3
|
||||||
linux-rpi3
|
linux-rpi3
|
||||||
boot-rpi3
|
boot-rpi3
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
/lib
|
|
||||||
/opt/vc/lib
|
|
27
mk.sh
27
mk.sh
|
@ -24,7 +24,6 @@ PKGDOWNLOADDIR="$BUILDROOT/download"
|
||||||
PACKAGELIST="$BUILDROOT/$CFG/pkglist"
|
PACKAGELIST="$BUILDROOT/$CFG/pkglist"
|
||||||
|
|
||||||
SQFS="$BUILDROOT/$CFG/rootfs.img"
|
SQFS="$BUILDROOT/$CFG/rootfs.img"
|
||||||
SQFS_DIR="$BUILDROOT/$CFG/squashfs"
|
|
||||||
|
|
||||||
mkdir -p "$PKGDOWNLOADDIR" "$PKGSRCDIR" "$PKGBUILDDIR" "$PKGLOGDIR"
|
mkdir -p "$PKGDOWNLOADDIR" "$PKGSRCDIR" "$PKGBUILDDIR" "$PKGLOGDIR"
|
||||||
mkdir -p "$PKGDEPLOYDIR" "$TCDIR/bin"
|
mkdir -p "$PKGDEPLOYDIR" "$TCDIR/bin"
|
||||||
|
@ -73,8 +72,7 @@ save_toolchain
|
||||||
############################### build packages ###############################
|
############################### build packages ###############################
|
||||||
echo "--- resolving package dependencies ---"
|
echo "--- resolving package dependencies ---"
|
||||||
|
|
||||||
cat "$SCRIPTDIR/cfg/$CFG/PACKAGES" "$SCRIPTDIR/cfg/$CFG/SQUASHFS" | \
|
cat "$SCRIPTDIR/cfg/$CFG/PACKAGES" | sort -u > "$BUILDROOT/$CFG/rawpkg"
|
||||||
sort -u > "$BUILDROOT/$CFG/rawpkg"
|
|
||||||
|
|
||||||
dependencies "$BUILDROOT/$CFG/rawpkg" "$PACKAGELIST" "pkg"
|
dependencies "$BUILDROOT/$CFG/rawpkg" "$PACKAGELIST" "pkg"
|
||||||
cat "$PACKAGELIST"
|
cat "$PACKAGELIST"
|
||||||
|
@ -96,29 +94,6 @@ while read pkg; do
|
||||||
restore_toolchain
|
restore_toolchain
|
||||||
done < "$PACKAGELIST"
|
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 ###############################
|
############################## release package ###############################
|
||||||
|
|
||||||
echo "--- building release package ---"
|
echo "--- building release package ---"
|
||||||
|
|
39
pkg/rootfs-alix/build
Executable file
39
pkg/rootfs-alix/build
Executable file
|
@ -0,0 +1,39 @@
|
||||||
|
prepare() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
local SOURCE="$1"
|
||||||
|
local BUILD="$2"
|
||||||
|
local DEPLOY="$3"
|
||||||
|
|
||||||
|
# setup skeleton
|
||||||
|
mkdir -pv ${BUILD}/{bin,etc,dev,sys,proc,tmp,var,run}
|
||||||
|
|
||||||
|
echo "/lib" > "$BUILD/etc/ld-musl-i386.path"
|
||||||
|
|
||||||
|
# install packages to rootfs
|
||||||
|
cat "$SCRIPTDIR/pkg/rootfs-alix/depends" | sort -u > "$BUILD/rawpkg"
|
||||||
|
|
||||||
|
dependencies "$BUILD/rawpkg" "$BUILD/etc/packages" "pkg"
|
||||||
|
echo "toolchain" >> "$BUILD/etc/packages"
|
||||||
|
rm -f "$BUILD/rawpkg"
|
||||||
|
|
||||||
|
while read pkgname; do
|
||||||
|
if [ ! -e "$PKGDEPLOYDIR/$pkgname" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp -ru --remove-destination ${PKGDEPLOYDIR}/${pkgname}/* "$BUILD"
|
||||||
|
done < "$BUILD/etc/packages"
|
||||||
|
}
|
||||||
|
|
||||||
|
deploy() {
|
||||||
|
local SOURCE="$1"
|
||||||
|
local BUILD="$2"
|
||||||
|
local DEPLOY="$3"
|
||||||
|
|
||||||
|
rm -f "$SQFS"
|
||||||
|
|
||||||
|
mksquashfs "$BUILD" "$SQFS" -all-root -no-progress -no-xattrs
|
||||||
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
coreutils
|
coreutils
|
||||||
bash
|
bash
|
||||||
rootfs
|
|
||||||
nano
|
nano
|
||||||
util-linux
|
util-linux
|
||||||
grep
|
grep
|
40
pkg/rootfs-rpi3/build
Executable file
40
pkg/rootfs-rpi3/build
Executable file
|
@ -0,0 +1,40 @@
|
||||||
|
prepare() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
local SOURCE="$1"
|
||||||
|
local BUILD="$2"
|
||||||
|
local DEPLOY="$3"
|
||||||
|
|
||||||
|
# setup skeleton
|
||||||
|
mkdir -pv ${BUILD}/{bin,etc,dev,sys,proc,tmp,var,run}
|
||||||
|
|
||||||
|
echo "/lib" > "$BUILD/etc/ld-musl-arm.path"
|
||||||
|
echo "/opt/vc/lib" >> "$BUILD/etc/ld-musl-arm.path"
|
||||||
|
|
||||||
|
# install packages to rootfs
|
||||||
|
cat "$SCRIPTDIR/pkg/rootfs-rpi3/depends" | sort -u > "$BUILD/rawpkg"
|
||||||
|
|
||||||
|
dependencies "$BUILD/rawpkg" "$BUILD/etc/packages" "pkg"
|
||||||
|
echo "toolchain" >> "$BUILD/etc/packages"
|
||||||
|
rm -f "$BUILD/rawpkg"
|
||||||
|
|
||||||
|
while read pkgname; do
|
||||||
|
if [ ! -e "$PKGDEPLOYDIR/$pkgname" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp -ru --remove-destination ${PKGDEPLOYDIR}/${pkgname}/* "$BUILD"
|
||||||
|
done < "$BUILD/etc/packages"
|
||||||
|
}
|
||||||
|
|
||||||
|
deploy() {
|
||||||
|
local SOURCE="$1"
|
||||||
|
local BUILD="$2"
|
||||||
|
local DEPLOY="$3"
|
||||||
|
|
||||||
|
rm -f "$SQFS"
|
||||||
|
|
||||||
|
mksquashfs "$BUILD" "$SQFS" -all-root -no-progress -no-xattrs
|
||||||
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
coreutils
|
coreutils
|
||||||
bash
|
bash
|
||||||
rootfs
|
|
||||||
linux_modules
|
linux_modules
|
||||||
firmware-rpi3
|
firmware-rpi3
|
||||||
nano
|
nano
|
|
@ -1,16 +0,0 @@
|
||||||
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"
|
|
||||||
}
|
|
|
@ -26,6 +26,4 @@ deploy() {
|
||||||
rm $DEPLOY/lib/*.a $DEPLOY/lib/*.o
|
rm $DEPLOY/lib/*.a $DEPLOY/lib/*.o
|
||||||
|
|
||||||
mkdir -p "$DEPLOY/etc"
|
mkdir -p "$DEPLOY/etc"
|
||||||
|
|
||||||
cp ${SCRIPTDIR}/cfg/${CFG}/ld-musl-* "$DEPLOY/etc/"
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue