2022-07-01 23:57:55 +07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2023-11-03 02:15:04 +07:00
|
|
|
. scripts/func.sh
|
|
|
|
|
|
|
|
IMAGE_FILE="arc.img"
|
|
|
|
gzip -dc "files/grub.img.gz" >"${IMAGE_FILE}"
|
|
|
|
fdisk -l "${IMAGE_FILE}"
|
|
|
|
|
|
|
|
LOOPX=$(sudo losetup -f)
|
|
|
|
sudo losetup -P "${LOOPX}" "${IMAGE_FILE}"
|
|
|
|
|
2023-11-07 00:40:07 +07:00
|
|
|
echo "Mounting Image File"
|
|
|
|
sudo rm -rf "/tmp/files/p1"
|
|
|
|
sudo rm -rf "/tmp/files/p3"
|
|
|
|
sudo mkdir -p "/tmp/files/p1"
|
|
|
|
sudo mkdir -p "/tmp/files/p3"
|
|
|
|
sudo mount ${LOOPX}p1 "/tmp/files/p1"
|
|
|
|
sudo mount ${LOOPX}p3 "/tmp/files/p3"
|
2023-11-03 02:15:04 +07:00
|
|
|
|
|
|
|
echo "Get Buildroot"
|
2023-11-04 17:37:58 +07:00
|
|
|
read -rp 'Version (2023.02.x): ' br_version
|
2023-11-04 17:04:44 +07:00
|
|
|
[ -z "${br_version}" ] && br_version="2023.02.x"
|
2024-01-13 10:49:31 +07:00
|
|
|
getBuildroot "${br_version}" "br"
|
2023-11-07 00:40:07 +07:00
|
|
|
[[ ! -f "br/bzImage-arc" || ! -f "br/initrd-arc" ]] && return 1
|
2023-11-03 02:15:04 +07:00
|
|
|
|
|
|
|
VERSION=$(date +'%y.%-m.dev')
|
|
|
|
echo "${VERSION}" >files/p1/ARC-VERSION
|
|
|
|
echo "${VERSION}" >VERSION
|
|
|
|
sed 's/^ARC_VERSION=.*/ARC_VERSION="'${VERSION}'"/' -i files/initrd/opt/arc/include/consts.sh
|
|
|
|
|
2023-11-07 00:40:07 +07:00
|
|
|
read -rp "Build: ${VERSION}? Press ENTER to continue"
|
2023-11-03 02:15:04 +07:00
|
|
|
|
2023-11-07 00:40:07 +07:00
|
|
|
echo "Repack initrd"
|
|
|
|
sudo cp -f "br/bzImage-arc" "/tmp/files/p3/bzImage-arc"
|
|
|
|
repackInitrd "br/initrd-arc" "files/initrd" "/tmp/files/p3/initrd-arc"
|
2023-11-03 02:15:04 +07:00
|
|
|
|
2023-11-03 02:30:51 +07:00
|
|
|
echo "Copying files"
|
2023-11-07 00:40:07 +07:00
|
|
|
sudo cp -Rf "files/p1/"* "/tmp/files/p1"
|
|
|
|
sudo cp -Rf "files/p3/"* "/tmp/files/p3"
|
|
|
|
# Get extractor, LKM, addons and Modules
|
|
|
|
getExtractor "/tmp/files/p3/extractor"
|
|
|
|
getLKMs "/tmp/files/p3/lkms" true
|
|
|
|
getAddons "/tmp/files/p3/addons" true
|
|
|
|
getModules "/tmp/files/p3/modules" true
|
|
|
|
getConfigs "/tmp/files/p3/configs" true
|
|
|
|
getPatches "/tmp/files/p3/patches" true
|
2023-11-03 02:15:04 +07:00
|
|
|
|
|
|
|
sync
|
|
|
|
|
2023-11-07 00:40:07 +07:00
|
|
|
echo "Unmount Image File"
|
|
|
|
sudo umount "/tmp/files/p1"
|
|
|
|
sudo umount "/tmp/files/p3"
|
2023-11-03 02:15:04 +07:00
|
|
|
|
|
|
|
sudo losetup --detach ${LOOPX}
|
|
|
|
|
|
|
|
qemu-img convert -O vmdk arc.img arc-dyn.vmdk
|
|
|
|
qemu-img convert -O vmdk -o adapter_type=lsilogic arc.img -o subformat=monolithicFlat arc.vmdk
|