wmirescue/stretch-amd64/mkrescue

49 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
TARGET=$1
if [ -z "${TARGET}" ]; then
echo "Usage: $0 <work_dir>"
exit 255
fi
mkdir ${TARGET}
mkdir ${TARGET}/ramdisk
mkdir ${TARGET}/firmware
mkdir ${TARGET}/output
./bin/basefs_init ${TARGET}/basefs
cp -a ${TARGET}/basefs ${TARGET}/rootfs
cp -a ${TARGET}/basefs ${TARGET}/helperfs
./bin/helperfs_config ${TARGET}/helperfs
# ROOTFS
mkdir -p ${TARGET}/rootfs/lib/modules
rsync -aS ${TARGET}/helperfs/lib/modules/ ${TARGET}/rootfs/lib/modules/
./bin/rootfs_config ${TARGET}/rootfs
./bin/rootfs_clear ${TARGET}/rootfs
./bin/rootfs_mksquashfs ${TARGET}/rootfs ${TARGET}/ramdisk/rootfs.squash
# RAMDISK
mkdir -p ${TARGET}/ramdisk/bin
mkdir -p ${TARGET}/ramdisk/dev
mkdir -p ${TARGET}/ramdisk/lib/modules
mkdir -p ${TARGET}/ramdisk/proc
mkdir -p ${TARGET}/ramdisk/sys
cp ${TARGET}/helperfs/bin/busybox ${TARGET}/ramdisk/bin/busybox
./bin/ramdisk_modules ${TARGET}/ramdisk ${TARGET}/rootfs 4.9.0-3-amd64
./bin/ramdisk_config ${TARGET}/ramdisk
./bin/ramdisk_make ${TARGET}/output/initrd.img ${TARGET}/ramdisk
# FIRMWARE
tar cf ${TARGET}/firmware/firmware.tar --owner=root --group=root -C ${TARGET}/helperfs ./lib/firmware
./bin/ramdisk_make ${TARGET}/output/firmware.img ${TARGET}/firmware
# KERNEL
cp ${TARGET}/helperfs/boot/vmlinuz-4.9.0-3-amd64 ${TARGET}/output/vmlinuz