Building CHBMB's unraid-dvb builds in an unRAID VM

From unRAID
Jump to: navigation, search

Create an unRAID VM

Use Spaceinvader One's youtube instructions to create an unRAID VM within unRAID OR Use the script to create an image file, then create the VM

Use Spaceinvader One's youtube instructions to create an unRAID VM within unRAID

[1]

Automated image build

Image creation steps thanks to [2]

Run these commands in an unRAID terminal

#Download latest syslinux and unzip syslinux and mkdiskimage
cd /tmp
wget https://mirrors.edge.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.zip
unzip syslinux-6.03.zip bios/utils/mkdiskimage bios/linux/syslinux

#Download latest unraid and unzip to unraid dir
wget https://s3.amazonaws.com/dnld.lime-technology.com/stable/unRAIDServer-6.6.6-x86_64.zip
unzip unRAIDServer-6.6.6-x86_64.zip -d /tmp/unraid

#Create image file, fat32 formatted
offset=$(/tmp/bios/utils/mkdiskimage -o -F -M unRAID.img 300 255 63)

#Can't find another way to set the partition name to UNRAID, so do it by formatting again

#First download and install dosfstools
wget -nc http://mirrors.slackware.com/slackware/slackware64-current/slackware64/FILE_LIST
slack_package_current_urlbase="http://mirrors.slackware.com/slackware/slackware64-current/slackware64"
wget "$slack_package_current_urlbase"$(grep "/dosfstools-[[:digit:]].*.txz$" FILE_LIST | cut -d . -f2-7)
installpkg $(grep "/dosfstools-[[:digit:]].*.txz$" FILE_LIST | cut -d / -f3)

#Create loop device for image to enable block mode write
loop=$(losetup --offset $((512*63)) --sizelimit $((512*610407)) --show --find unRAID.img)

#Now format and set label
mkfs.vfat $loop -n UNRAID

#Make bootable
/tmp/bios/linux/syslinux --offset $((512*63)) unRAID.img

#Mount image and copy unraid files to it
mkdir -p /tmp$loop
mount $loop /tmp$loop
cp -r /tmp/unraid/* /tmp$loop

#Unmount image and free loop device
umount /tmp$loop
losetup -d $loop

VM XML

Change UUID. Icon from Spaceinvader One custom icons [3]

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm'>
  <name>unRAID</name>
  <uuid>4cbe0d3e-bc67-1fc5-4ee5-53515fd04c8b</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Linux" icon="unraid.png" os="linux"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>1</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-3.0'>hvm</type>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough' check='none'>
    <topology sockets='1' cores='1' threads='1'/>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/isos/unRAID/unRAID.img'/>
      <target dev='hdc' bus='usb'/>
      <boot order='1'/>
      <address type='usb' bus='0' port='2'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x10'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x11'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0x12'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0x14'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x4'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:cd:03:6e'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0' keymap='en-us'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>

VNC into the unRAID VM to run CHBMB's unraid-dvb build scripts

Once connected via VNC to the unRAID VM, run these commands:

wget https://github.com/CHBMB/Unraid-DVB/raw/master/user.scripts/scripts/unraid-dvb/script
sed 's/mnt\/disk1/tmp/g' script | sed -E 's/rm(.*)\/\*/mkdir\1/g' > script
chmod +x script
./script

Remove upload.sh step from build.sh

Get CHBMB to remove that line from build.sh or do it manually

Execute build.sh

  • To do: modify .config in standard build to include customisations that CHBMB made in [4]
cd /tmp/dvb
./build.sh