2024-07-16 11:14:20 +03:00
|
|
|
#!/bin/bash
|
2024-07-16 11:23:21 +03:00
|
|
|
apt-get install -y sgdisk extlinux > /dev/null 2>&1
|
2024-07-16 11:10:24 +03:00
|
|
|
dd if=/dev/zero of=/dev/sda bs=1 count=512 conv=notrunc
|
|
|
|
sgdisk --set-alignment=2 --new=1::+32M --typecode=1:8300 --change-name=1:"RouterOS Boot" --attributes=1:set:2 --new=2::-0 --typecode=2:8300 --change-name=2:"RouterOS" --gpttombr=1:2 /dev/sda
|
2024-07-16 09:41:30 +03:00
|
|
|
dd if=/dev/sda of=pt.bin bs=1 count=66 skip=446
|
2024-07-16 09:20:09 +03:00
|
|
|
echo -e "\x80" | dd of=pt.bin bs=1 count=1 conv=notrunc
|
2024-07-16 11:10:24 +03:00
|
|
|
dd if=/dev/zero of=/dev/sda bs=1 count=512 conv=notrunc
|
|
|
|
sgdisk --set-alignment=2 --new=1::+32M --typecode=1:8300 --change-name=1:"RouterOS Boot" --attributes=1:set:2 --new=2::-0 --typecode=2:8300 --change-name=2:"RouterOS" /dev/sda
|
2024-07-16 10:08:55 +03:00
|
|
|
wget -O mbr.bin https://raw.gitmirror.com/elseif/MikroTikPatch/main/mbr.bin
|
2024-07-16 09:41:30 +03:00
|
|
|
dd if=mbr.bin of=/dev/sda bs=1 count=446 conv=notrunc
|
|
|
|
dd if=pt.bin of=/dev/sda bs=1 count=66 seek=446 conv=notrunc
|
2024-07-16 11:10:24 +03:00
|
|
|
sync
|
2024-07-16 09:41:30 +03:00
|
|
|
mkfs.vfat -n "Boot" /dev/sda1
|
|
|
|
mkfs.ext4 -F -L "RouterOS" -m 0 /dev/sda2
|
2024-07-16 09:42:07 +03:00
|
|
|
mkdir -p /tmp/{boot,routeros}
|
2024-07-16 09:41:30 +03:00
|
|
|
mount -o loop,rw /dev/sda1 /tmp/boot
|
2024-07-16 09:20:09 +03:00
|
|
|
mkdir -p /tmp/boot/{BOOT,EFI/BOOT}
|
2024-07-16 10:42:15 +03:00
|
|
|
wget -O /tmp/boot/EFI/BOOT/BOOTX64.EFI https://hub.gitmirror.com/https://github.com/elseif/MikroTikPatch/releases/download/7.15.2/BOOTX64.EFI
|
2024-07-16 11:23:21 +03:00
|
|
|
extlinux --install -H 64 -S 32 ./img/boot/BOOT
|
|
|
|
echo -e "default system\nlabel system\n\tkernel /EFI/BOOT/BOOTX64.EFI\n\tappend load_ramdisk=1 root=/dev/ram0 quiet" > /tmp/boot/BOOT/syslinux.cfg
|
2024-07-16 09:39:48 +03:00
|
|
|
umount /tmp/boot
|
2024-07-16 09:41:30 +03:00
|
|
|
mount -o loop,rw /dev/sda2 /tmp/routeros
|
2024-07-16 09:42:07 +03:00
|
|
|
mkdir -p /tmp/routeros/{var/pdb/{system,option},boot,rw}
|
2024-07-16 10:42:15 +03:00
|
|
|
wget -O /tmp/routeros/var/pdb/option/image https://hub.gitmirror.com/https://github.com/elseif/MikroTikPatch/releases/download/7.15.2/option-7.15.2.npk
|
|
|
|
wget -O /tmp/routeros/var/pdb/system/image https://hub.gitmirror.com/https://github.com/elseif/MikroTikPatch/releases/download/7.15.2/routeros-7.15.2.npk
|
2024-07-16 09:39:48 +03:00
|
|
|
umount /tmp/routeros
|