2023-06-11 11:30:27 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
TARGET=$1
|
2023-10-05 14:48:40 +02:00
|
|
|
VERSION=$(date +%g.%m)
|
2023-06-11 11:30:27 +02:00
|
|
|
OUTPUT=${TARGET}/output/${VERSION}
|
|
|
|
DEBIAN_CODENAME='bookworm'
|
2024-02-12 15:28:37 +01:00
|
|
|
KERNEL_VERSION='6.5.0-0.deb12.4-amd64'
|
2023-10-05 14:48:40 +02:00
|
|
|
KERNEL_REPO="bookworm-backports"
|
2024-02-12 15:28:37 +01:00
|
|
|
MEMTEST_URL="https://memtest.org/download/v7.00/mt86plus_7.00.binaries.zip"
|
2023-06-11 11:30:27 +02:00
|
|
|
ARCH='amd64'
|
|
|
|
|
|
|
|
QUIET=1
|
|
|
|
export MKRESCUE_VERBOSE=1
|
|
|
|
|
|
|
|
export LANGUAGE=C
|
|
|
|
export LANG=C
|
|
|
|
export LC_ALL=C
|
|
|
|
|
|
|
|
umask 022
|
|
|
|
|
|
|
|
if [ -z "${TARGET}" ]; then
|
|
|
|
echo "Usage: $0 <work_dir>"
|
|
|
|
exit 255
|
|
|
|
fi
|
|
|
|
|
|
|
|
SCRIPTDIR="$(dirname "$(realpath "$0")")"
|
|
|
|
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
mkdir ${TARGET}
|
|
|
|
mkdir ${TARGET}/ramdisk
|
|
|
|
mkdir ${TARGET}/firmware
|
|
|
|
mkdir -p ${OUTPUT}/netboot/${ARCH}
|
|
|
|
|
|
|
|
if [ !$QUIET ]; then echo '\n### Executing basefs_init ###'; fi
|
|
|
|
${SCRIPTDIR}/bin/basefs_init ${TARGET}/basefs ${DEBIAN_CODENAME}
|
|
|
|
|
|
|
|
cp -a ${TARGET}/basefs ${TARGET}/rootfs
|
|
|
|
cp -a ${TARGET}/basefs ${TARGET}/helperfs
|
|
|
|
|
|
|
|
if [ !$QUIET ]; then echo '\n### Executing helperfs_config ###'; fi
|
|
|
|
${SCRIPTDIR}/bin/helperfs_config ${TARGET}/helperfs ${KERNEL_VERSION} ${KERNEL_REPO}
|
|
|
|
|
|
|
|
# ROOTFS
|
|
|
|
|
|
|
|
mkdir -p ${TARGET}/rootfs/lib/modules
|
|
|
|
rsync -aS ${TARGET}/helperfs/lib/modules/ ${TARGET}/rootfs/lib/modules/
|
|
|
|
if [ !$QUIET ]; then echo '\n### Executing rootfs_config ###'; fi
|
|
|
|
${SCRIPTDIR}/bin/rootfs_config ${TARGET}/rootfs ${DEBIAN_CODENAME}
|
|
|
|
if [ !$QUIET ]; then echo '\n### Executing rootfs_clear ###'; fi
|
|
|
|
${SCRIPTDIR}/bin/rootfs_clear ${TARGET}/rootfs
|
|
|
|
if [ !$QUIET ]; then echo '\n### Executing rootfs_mksquashfs ###'; fi
|
|
|
|
${SCRIPTDIR}/bin/rootfs_mksquashfs ${TARGET}/rootfs ${TARGET}/ramdisk/rootfs.squash
|
|
|
|
|
|
|
|
# RAMDISK
|
|
|
|
|
|
|
|
mkdir -p ${TARGET}/ramdisk/bin
|
|
|
|
mkdir -p ${TARGET}/ramdisk/dev
|
|
|
|
mkdir -p ${TARGET}/ramdisk/usr/lib/modules
|
|
|
|
ln -s usr/lib ${TARGET}/ramdisk/lib
|
|
|
|
mkdir -p ${TARGET}/ramdisk/proc
|
|
|
|
mkdir -p ${TARGET}/ramdisk/sys
|
|
|
|
cp ${TARGET}/helperfs/bin/busybox ${TARGET}/ramdisk/bin/busybox
|
|
|
|
if [ !$QUIET ]; then echo '\n### Executing ramdisk_modules ###'; fi
|
|
|
|
${SCRIPTDIR}/bin/ramdisk_modules ${TARGET}/ramdisk ${TARGET}/rootfs ${KERNEL_VERSION}
|
|
|
|
if [ !$QUIET ]; then echo '\n### Executing ramdisk_config ###'; fi
|
|
|
|
${SCRIPTDIR}/bin/ramdisk_config ${TARGET}/ramdisk ${KERNEL_VERSION}
|
|
|
|
if [ !$QUIET ]; then echo '\n### Executing ramdisk_make ###'; fi
|
|
|
|
${SCRIPTDIR}/bin/ramdisk_make ${OUTPUT}/netboot/${ARCH}/initrd.img ${TARGET}/ramdisk
|
|
|
|
|
|
|
|
# FIRMWARE
|
|
|
|
tar cf ${TARGET}/firmware/firmware.tar --owner=root --group=root -C ${TARGET}/helperfs ./lib/firmware
|
|
|
|
if [ !$QUIET ]; then echo '\n### Executing ramdisk_make ###'; fi
|
|
|
|
${SCRIPTDIR}/bin/ramdisk_make ${OUTPUT}/netboot/firmware.img ${TARGET}/firmware
|
|
|
|
|
|
|
|
# KERNEL
|
|
|
|
|
|
|
|
cp ${TARGET}/helperfs/boot/vmlinuz-${KERNEL_VERSION} ${OUTPUT}/netboot/${ARCH}/vmlinuz
|
|
|
|
|
|
|
|
|
|
|
|
# DIST
|
|
|
|
tar cvf ${OUTPUT}/wmirescue_${ARCH}-netboot.tar -C ${OUTPUT}/netboot .
|
|
|
|
if [ !$QUIET ]; then echo '\n### Executing dist_ipxe ###'; fi
|
|
|
|
${SCRIPTDIR}/bin/dist_ipxe ${VERSION} ${OUTPUT}
|
|
|
|
if [ !$QUIET ]; then echo '\n### Executing dist_ipxe --nofirmware ###'; fi
|
|
|
|
${SCRIPTDIR}/bin/dist_ipxe ${VERSION} ${OUTPUT} --nofirmware
|
|
|
|
if [ !$QUIET ]; then echo '\n### Executing dist_iso ###'; fi
|
2024-02-12 15:28:37 +01:00
|
|
|
${SCRIPTDIR}/bin/dist_iso ${VERSION} ${ARCH} ${OUTPUT} ${MEMTEST_URL}
|
2023-06-11 11:30:27 +02:00
|
|
|
if [ !$QUIET ]; then echo '\n### Executing dist_iso --nofirmware ###'; fi
|
2024-02-12 15:28:37 +01:00
|
|
|
${SCRIPTDIR}/bin/dist_iso ${VERSION} ${ARCH} ${OUTPUT} ${MEMTEST_URL} --nofirmware
|