Make Xpenology boot loader 1.02b for DSM 6.1 on Ubuntu

If you are reading this you problebly already knew what is Xpenology. I havn’t had a chance to try it. Recently jun released the Xpenology boot loader 1.02b for DSM 6.1. I tried it on my ESXi 6.5 and found it works quite well so I am going to try it on a bare metal PC.

To setup the Xpenology NAS, the first thing you need to do is making the boot loader onto an USB stick so your NAS will boot from it. Then it will guide you to install the DSM 6.1.

There are lots tutorials on how to makethe USB boot loader from a Windows PC. The process is simple but still needs you to get on Windows and download/install few programs to have the job done. We all know that Xpenology is based on Linux system, so why not just make the boot loader on Linux?

Here I’ll show you how to make the boot loader from Ubuntu. For this we need:

  1. A computer with Ubuntu installed. (Other Linux OS should also works.)
  2. An USB drive
If you don't have an Ubuntu/Linux PC, you may just boot from an Ubuntu Live DVD.

OK, Let’s start!

Download the boot loader

Following the link provided by jun’s post on the Xpenology Forum, download the boot loader ISO file.

I am going to try the DS3617xs build so I downloaded this file and saved it at /home/pztop/xpenology/:

DS3617xs 6.1 Jun’s Mod V1.02b.iso

Gather information

Find the MAC address of the NIC on your NAS

I connect an USB external DVD-ROM to my NAS and boot up with an Ubuntu Live DVD. Then I use ifconfig command to find the MAC addesss.

$ ifconfig 
eno1 Link encap:Ethernet HWaddr 54:04:a6:19:21:a2
inet addr:192.168.1.77 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::5604:a6ff:fe19:21a2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9375 errors:0 dropped:3 overruns:0 frame:0
TX packets:4558 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12211676 (12.2 MB) TX bytes:464897 (464.8 KB)
Interrupt:18 Memory:fb500000-fb520000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:1087 errors:0 dropped:0 overruns:0 frame:0
TX packets:1087 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:116687 (116.6 KB) TX bytes:116687 (116.6 KB)

I see the MAC address (HWaddr) is 54:04:a6:19:21:a2.

Find the USB stick info

Plug in the USB stick (I got an old 1GB USB drive), then issue command lsusb

$ lsusb
Bus 001 Device 015: ID 0204:6025 Chipsbank Microelectronics Co., Ltd CBM2080 / CBM2090 Flash drive controller
Bus 001 Device 002: ID 0409:013e NEC Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

I noticed the two numbers I needed:
Vendor ID(VID) is 0204. Product ID(PID) is 6025.

Obtian a SN for the NAS

I used the serial number generator at here to get my SN.
Select DS3617xs as the model then click on “Generate” then I got the SN.
SN=1230ODN613301

Customize your own boot loader ISO image

The ISO image file jun provided is just an example ISO image. We need customize it according to our own system. This involves to modify a single file grub.cfg inside the ISO image I just downloaded. So lets begin.

What the ISO file contains?

First I analyzed the ISO image file. Switch to root user and show the image layout. Here is the output:

fdisk -lu  DS3617xs\ 6.1\ Jun\'s\ Mod\ V1.02b.iso
Disk DS3617xs 6.1 Jun's Mod V1.02b.iso: 50 MiB, 52428800 bytes, 102400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: C94E55EA-A4D2-4E78-9D73-46CBAE7A03EF

Device Start End Sectors Size Type
DS3617xs 6.1 Jun's Mod V1.02b.iso1 2048 32767 30720 15M EFI System
DS3617xs 6.1 Jun's Mod V1.02b.iso2 32768 94207 61440 30M Linux filesystem
DS3617xs 6.1 Jun's Mod V1.02b.iso3 94208 102366 8159 4M BIOS boot

Here we got some importabt infomation: (1) The Sector size is 512 bytes; (2) The first partition (15MB size) start at cylinder 2048; (3)The first partition is the EFI partition.

Now I calculated the offset from the start of the image to the partition start:
Sector size x Start = 512 x 2048 = 1048576

Mount loop device

Mount it on /dev/loop0 using this offset number:

# losetup -o 1048576 /dev/loop0 DS3617xs\ 6.1\ Jun\'s\ Mod\ V1.02b.iso

Mount the EFI partition

Now the partition resides on /dev/loop0. mount it:

# mkdir /mnt/xpeboot
# mount /dev/loop0 /mnt/xpeboot

Edit the Grub configration file

The boot partition is mounted and I am able to edit the grub.cfg file:

nano /mnt/xpeboot/grub/grub.cfg

Modify the file using the infomation I’ve got:

set vid=0x0204
set pid=0x6025
set sn=1230ODN613301
set mac1=5404a61921a2

set default='0'
set timeout='5'

As showed above, I changed vid, pid, sn and mac1 accordingly. I also set the timeout to 5 sec. (If you want use the boot loader on ESXi, you may also want to set the default to “2”.)

Save the file when done.

Clean up

Unmount the image:

umount /mnt/xpeboot
losetup -d /dev/loop0

Now I got my customized ISO image. To confirm this, use command ls -l or stat you can check the timestamp of the iso file, it should be a newly modified file.

Make the boot loader USB stick

With the customized image iso file ready, I can start make the bootable USB stick.

Insert the USB stick and check dmesg ,
dmesg

look at the lines on the bottom and I see the system recognized the USB drive as /dev/sdd (NOTE: Yours may be different! Check it carefully or you may accidentally wipe the wrong drive.)

Still as root user,navigate to the iso file reside directory, then use dd command to burn the ISO image to the USB stick:

dd if=DS3617xs\ 6.1\ Jun\'s\ Mod\ V1.02b.iso of=/dev/sdd bs=512

Now I have the USB boot loader drive ready!

Install DSM 6.1

I am not going to go to details about this. You can find lots instructions online. Just insert the USB stick just made, then boot NAS from it, finish the DSM installation and ENJOY!