modified: .github/workflows/mikrotik_patch.yml

modified:   patch.py
This commit is contained in:
zyb 2024-06-19 14:29:49 +08:00
parent a8911399f6
commit 4f9f7b8150
2 changed files with 0 additions and 6 deletions

View File

@ -167,7 +167,6 @@ jobs:
sudo qemu-img convert -f raw -O qcow2 chr-$LATEST_VERSION.img chr-$LATEST_VERSION.qcow2
sudo rm chr-$LATEST_VERSION.img
sudo qemu-nbd -c /dev/nbd0 chr-$LATEST_VERSION.qcow2
sudo ls /dev/nbd*
sudo -E python3 patch.py boot /dev/nbd0p1
sudo mkdir ./routeros
sudo mount /dev/nbd0p2 ./routeros

View File

@ -80,13 +80,8 @@ def patch_bootloader(key_dict,boot_dev):
f.write(new_bzImage[index*BLOCK_SIZE:(index+1)*BLOCK_SIZE])
f.flush()
print(']')
stdout,stderr = run_shell_command(f"lsblk -no pkname {boot_dev}")
print(f'{stdout.decode().strip()}')
print(f'/dev/{stdout.decode().strip()}')
with open(f'/dev/{stdout.decode().strip()}','wb') as f:
f.seek(0x100)
f.write(bytes.fromhex('00000000000000000000BDE800000000'))
f.seek(0x150)
f.write(b'\x00')
f.flush()