This repository contains a number of tools for modifying the firmware of Western Digital My Cloud DL2100 NAS Systems. The tools allow you to
- create backups of the firmware stored in flash memory (MTD),
- extract the firmware images contained in WD firmware .bin files,
- assemble firmware .bin files from firmware images,
- extract and (re-)asseble the initial ramdisk image (uRamdisk) with the root filesystem,
- extract and (re-)assemle the SquashFS container (image.cfs) with the filesystem mounted to /usr/local/modules/, and
- patch editable startup scripts into the original firmware.
Modifications to the firmware of your device may render your device unusable. Moreover, modifications to the firmware may void the warranty for your device.
You are using the programs in this repository at your own risk. We are not responsible for any damage caused by these programs, their incorrect usage, or inaccuracies in this manual.
All scripts are designed to be run directly on the DL2100 (as root user over SSH). However, some scripts may be used on other Linux systems as well.
You can create backups in the form of whole-disk images of the flash memory (MTD), in the form of all accessible firmware partitions, or of the files stored on those partitions with the script dl2100_fw_create_backup.sh. The corresponding command line options are:
- -d to create whole-disk images,
- -p to create partition images, and
- -f to create file system archives.
Use the following command to create a full backup of the installed firmware and store it on the "Public" share:
./dl2100_fw_create_backup.sh -dpf -x /shares/Public/
You can extract the images packed into a firmware .bin file with the script dl2100_fwimage_extract.sh. Use the following command to extract from the firmware file My_Cloud_DL2100_2.21.119.bin located on the "Public" share:
./dl2100_fwimage_extract.sh -x /shares/Public/My_Cloud_DL2100_2.21.119.bin
This creates the files
- My_Cloud_DL2100_2.21.119-codename.txt (codename from the magic value of the firmware file),
- My_Cloud_DL2100_2.21.119-version.txt (version of the firmware file),
- My_Cloud_DL2100_2.21.119-uImage (kernel image),
- My_Cloud_DL2100_2.21.119-uRamdisk (initial ramdisk image),
- My_Cloud_DL2100_2.21.119-image.cfs (SquashFS container),
- My_Cloud_DL2100_2.21.119-config_default.tar.gz (archive with the default configuration files),
- My_Cloud_DL2100_2.21.119-ext_0000.head (header of the first extraction target), and
- My_Cloud_DL2100_2.21.119-ext_0000.data (data of the first extraction target, grub.tgz).
You can assemble a firmware .bin file from image files with the script dl2100_fwimage_build.sh. Use the following command to assemble the files in /shares/Public/customized_fw/ to the firmware file My_Cloud_DL2100_customized.bin located on the "Public" share:
./dl2100_fwimage_build.sh -x -i /shares/Public/customized_fw/ /shares/Public/My_Cloud_DL2100_customized.bin
You can extract the root filesystem from the initial ramdisk image (uRamdisk) into a directory with the script dl2100_fw_initrd_unpack.sh. Use the following command to extract the file /shares/Public/My_Cloud_DL2100_2.21.119-uRamdisk to /shares/Public/customized_rd/:
./dl2100_fw_initrd_unpack.sh -f -i /shares/Public/My_Cloud_DL2100_2.21.119-uRamdisk /shares/Public/customized_rd
Alternatively, you can directly extract the initial ramdisk of the installed firmware:
./dl2100_fw_initrd_unpack.sh -f /shares/Public/customized_rd
Both commands will create the file /shares/Public/customized_rd/uBoot-header and the directory /shares/Public/customized_rd/initramfs-root/ containing the file tree of the filesystem.
You can (re-)assemble the root filesystem of the initial ramdisk into a uRamdisk image with the script dl2100_fw_initrd_pack.sh. Use the following command to pack the files in /shares/Public/customized_rd/ into the file /shares/Public/customized_fw/uRamdisk. The command expects the same structure as that created by dl2100_fw_initrd_unpack.sh.
./dl2100_fw_initrd_pack.sh -o /shares/Public/customized_fw/uRamdisk /shares/Public/customized_rd
Alternatively, you can directly install the packed initial ramdisk to the flash memory:
./dl2100_fw_initrd_pack.sh /shares/Public/customized_rd
You can extract the filesystem from the SquashFS container image.cfs into a directory with the script dl2100_fw_cfs_unpack.sh. Use the following command to extract the file /shares/Public/My_Cloud_DL2100_2.21.119-image.cfs to /shares/Public/customized_cfs/:
./dl2100_fw_cfs_unpack.sh -f -i /shares/Public/My_Cloud_DL2100_2.21.119-image.cfs /shares/Public/customized_cfs
Alternatively, you can directly extract the SquashFS container of the installed firmware:
./dl2100_fw_cfs_unpack.sh -f /shares/Public/customized_cfs
Both commands will create the file /shares/Public/customized_cfs/image.squashfs and the directory /shares/Public/customized_cfs/squashfs-root/ containing the file tree of the filesystem.
You can (re-)assemble the SquashFS filesystem into a SquashFS container image.cfs with the script dl2100_fw_cfs_pack.sh. Use the following command to pack the files in /shares/Public/customized_cfs/ into the file /shares/Public/customized_fw/image.cfs. The command expects the sub-directory squashfs-root/ in the source directory (as created by dl2100_fw_cfs_unpack.sh).
./dl2100_fw_cfs_pack.sh -o /shares/Public/customized_fw/image.cfs /shares/Public/customized_cfs
Alternatively, you can directly install the packed SquashFS container to the flash memory:
./dl2100_fw_cfs_pack.sh /shares/Public/customized_cfs
You can patch support for editable (i.e. residing in the configuration partition) startup hooks into the SquashFS filesystem with the script dl2100_patch_startup_cfs.sh. Use the following command to patch an extracted SquashFS file tree located in /shares/Public/customized_cfs/squashfs-root/:
./dl2100_patch_startup_cfs.sh /shares/Public/customized_cfs/squashfs-root
You can patch the customizable startup hook scripts into the configuration partition with the script dl2100_patch_startup_config.sh. Use the following command to patch the configuration partition in flash memory:
./dl2100_patch_startup_config.sh
This repository includes the following precompiled tools and libraries from the Debian 8 ("jessie") release:
- cpio from the package cpio_2.11+dfsg-4.1+deb8u1_amd64.deb. You can get the source package here.
- liblzma.so.5 from the package liblzma5_5.1.1alpha+20120614-2+b3_amd64.deb. You can get the source package here.
- mksquashfs and unsquashfs from the package squashfs-tools_4.2+20130409-2_amd64.deb. You can get the source package here.
- mkimage from the package u-boot-tools_2014.10+dfsg1-5_amd64.deb. You can get the source package here.
Find documentation and grab the latest version on GitHub https://github.com/michaelroland/wdnas-firmware-modding
- Copyright (c) 2016 Michael Roland <[email protected]>
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
License: GNU General Public License v3.0