How to install a Linux program on WD myCloud/ Busybox?

Hello!

I have got a WD My Cloud 2TB or 4TB NAS with Busybox embedded linux on it. I want to record a H264 stream from a network camera with it.

Is there a H264 stream ripper extension for Busybox?

If not, how can I install a Linux program on Busybox from source?

Thanks
Consuli

There are no official documents available related to what you would like to accomplish. Hopefully an experienced User will be able to assist.

A general guidance how to install linux programs on Busybox (from source, if necessary) would be highly appreciated, if it is possible to do so.

I have changed the topic of the thread in this direction now, to assess the general installation issue with Busybox.

Consuli

If you want to install a program from source on the gen2. It needs to be compiled with 64k pagesize and be linked static. If you search the forum you will find instructions on how to setup a build environment. Once you have that environment setup you can install you source and compile.

You will also need Fox_exe 's WDCrack package, and need to install it as a 3rd party app. This is because the root filesystem of the Gen2 is retardedly dumb, and is hosted completely out of volatile storage. Installed applications live on the hard disk, and get started at user-level init. These can be system daemons, whatever.

You can get a full Debian deployment from Fox_exe’s pack. It might be possible (have not checked) to add the needed VideoForLinux modules, and USB driver modules to that package after installing it, if you dont mind compiling them from source. That would (in theory) allow the MyCloud to have a USB camera installed, and be able to make use of it natively.

One of these days, I am going to just say ‘screw it’, and solder the serial console header pins on, hook it up, and do some serious modifications to my Gen2 to make it behave like a proper linux-- but so far… the thought of the physical pain involved (joint damage) with that process has stymied my efforts.

Regardless, to do what you want, you will need VideoForLinux modules, and a USB Camera driver module, and the usermode application stack of your choice. Those are all going to have to be things you compile yourself. The MyCloud does not provide support for any of it out of the box.

The gen2 is easier to put the connector on than the gen1. On the gen1 you need to solder the pins to a flat surface. On the gen2 you have thru holes that you can solder the pins to. I used to have an H8 system in the past. It had inline connector pins maybe 40 or 50 across. I just cut of 5 pins. cleaned out the solder from the thru holes and soldered the pins. I then used the female connector to plug onto the pins. So it is removable. At some point I may put a three conductor jack in the back of the gen2. But currenly the disk is setting on the counter top.

Mostly, I am just curious if WD configured UBoot to do digital signature checking on kernel and initrd images.

It looks like the images are loaded from the sata device by uboot (not in an MTD partition on the flash module), meaning I should be able to do a complete system replacement (bake up a new initrd with a proper startup script that properly mounts the internal disk as /, then invokes rc.local and pals like a real linux box) that has all the bells and whistles enabled.

I just really stink at doing webUIs, and do everything by the ssh console anyway. That means my custom firmware would not be useful to most people. I suppose it would be a starting point for the other alternative OSes available for the Gen1 though… Jeeze I wish my wrists werent all jacked up. I would NEED that serial interface to force loading a custom kernel to safely test if signature checking is in effect or not to warrant any further planning on that front.

1 Like

Below is the serial output from a gne2 boot sequence. Not sure where the USB devices that it talks about are located. I may have had a USB device connected. But I didn’t have 4 devices. If necessary I could redo the boot sequence with no USB drives connected. I was playing around with trying to get the device to boot a kernel that I had on a USB drive. But couldn’t figure out how to do it. Hope this helps.
Restarting system.
BootROM - 1.51
Booting from SPI flash
General initialization - Version: 1.0.0
High speed PHY - Version: 0.1.1 (COM-PHY-V20)
USB2 UTMI PHY initialized succesfully
USB2 UTMI PHY initialized succesfully
High speed PHY - Ended Successfully
DDR3 Training Sequence - Ver 5.7.1
DDR3 Training Sequence - Run with PBS.
DDR3 Training Sequence - Ended Successfully
BootROM: Image checksum verification PASSED
** LOADER **
U-Boot 2013.01_v1.03 (Nov 20 2014 - 16:39:45) Marvell version: 2014_T2.0p3
Board: WD_Glacier_DB-88F6720-V2
SoC: MV88F6720 Rev A0
running 2 CPUs
CPU: ARM Cortex A9 MPCore (Rev 1) LE
CPU 0
CPU @ 800 [MHz]
L2 @ 400 [MHz]
TClock @ 200 [MHz]
DDR @ 534 [MHz]
DDR 16Bit Width, FastPath Memory Access, DLB Enabled
DRAM: 512 MiB
Map: Code:0x1fed6000:0x1ff92c90
BSS:0x1ffefa20
Stack:0x1f9c5f20
Heap:0x1f9c6000:0x1fed6000
SF: Detected MX25L8006E with page size 64 KiB, total 1 MiB
*** Warning - bad CRC, using default environment
PCI-e 0: Detected No Link.
PCI-e 1: Detected No Link.
SF: Detected MX25L8006E with page size 64 KiB, total 1 MiB
MAC addr: 00:90:A9:EF:89:55
### Loading Firmware from USB 3.0 Disk ###
USB2.0 0: Host Mode
USB2.0 1: Device Mode
USB3.0 0: Host Mode
Board configuration detected:
GE-PHY-0 on MAC0
SERDES configuration:
Lane #0: PCIe0
Lane #1: PCI1
Lane #2: SATA0
Lane #3: USB3
Net: egiga0 [PRIME]
*** ERROR: ping address not given
Hit any key to stop autoboot: 1 0
(Re)start USB…
USB0: Port (usbActive) : 0Interface (usbType = 3) : USB XHCI 1.00
scanning bus 0 for devices… 2 USB Device(s) found
scanning usb for storage devices… 0 Storage Device(s) found
** Bad device usb 0 **
** Bad device usb 0 **
## Booting image at 00a00000 …
### Loading Firmware from USB 2.0 Disk ###
(Re)start USB…
USB0: Port (usbActive) : 1Interface (usbType = 2) : USB EHCI 1.00
scanning bus 0 for devices… 4 USB Device(s) found
scanning usb for storage devices… 2 Storage Device(s) found
*: Unrecognized filesystem type **
** Unrecognized filesystem type **
## Booting image at 00a00000 …
### Loading Firmware from Disk ###
Reset IDE:
Marvell Serial ATA Adapter
Integrated Sata device found
Device 0 @ 0 0:
Model: WDC WD60EFRX-68L0BN1 Firm: 82.00A82 Ser#: WD-WX11D76NYDZK
Type: Hard Disk
Supports 48-bit addressing
Capacity: 5723166.5 MB = 5589.0 GB (11721045168 x 512)
3913436 bytes read in 75 ms (49.8 MiB/s)
2647368 bytes read in 52 ms (48.6 MiB/s)
## Booting image at 00a00000 …
## Booting kernel from Legacy Image at 00a00000 …
Image Name: Linux-375
Created: 2015-08-02 4:24:55 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 3913372 Bytes = 3.7 MiB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum … OK
## Loading init Ramdisk from Legacy Image at 00f00000 …
Image Name: Ramdisk
Created: 2016-11-10 10:45:09 UTC
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 2647303 Bytes = 2.5 MiB
Load Address: 00e00000
Entry Point: 00e00000
Verifying Checksum … OK
Loading Kernel Image … OK
OK
Starting kernel …
Uncompressing Linux… done, booting the kernel.
Booting Linux on physical CPU 0x0
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu

1 Like

The USB stick likely needs to be FAT filesystem in order to load a kernel and initrd from it. This is interesting. I will see if that works for me.

Fox_exe has some in-work stuff on his google drive for a recovery USB stick for the gen2, so maybe he has figured out how to make it boot from USB. I will examine his files more closely, and see if I can load a custom compiled kernel that has zram enabled. That would be easy enough to test with. Just check for presence of /dev/zram0 after booting. if it is there, success. Otherwise, fail.

Getting custom kernel and initrd would make this thing much more useful, as full replacement is then possible.

Thank you guys for your recommendations. However, what you recommend seems to be far out of my scope (for the reasons of know how).

Meanwhile I have found this guideline, how to install ffmpeg on busybox.

http://buildroot-busybox.2317881.n4.nabble.com/Add-ffmpeg-support-td18627.html

It still seems to be pretty complicated, but at least it explains every single step for linux dummies like me. I hope you agree, that the ffmpeg installation guide applies to my case.

Regards
Consuli

1 Like

That appears to be a set of four patch files to modify the configuration of something that builds a BusyBox image, adding ffmpeg support into the BusyBox image. My immediate concerns are:

i) what is it a patch to? (i.e. what release of code is it intended to patch?)
ii) do you really want to be messing about building BusyBox images to replace the entire image used by WD?
iii) it looks pretty gnarly stuff to me… but then I’m not familiar with building BusyBox, and only have very limited experience of building Linux kernels, from some years ago, when I wasn’t really sure what I was doing…

The “easy mode” solution is to lug a hole debian chroot around, install ffmpeg and pals with apt-get, and let the init script turn on any daemons inside that chroot for you on every boot.

fox_exe has already done all the legwork. Just install the WDCrack package, then install his debian image. Hop on ssh, and jump into the chroot folder, then go to town.

I only build static compiled binaries because useful tools are useful to other people who have not done such modifications. (testdisk, et al.) ffmpeg will be monstrous huge if compiled that way (if it even CAN be compiled that way…) and I really don’t see the value really, except if you want to get the MyCloud to make thumbnails programmatically or something.

I have a little time before work, I can see if I can get ffmpeg static compiled… but it wont be pretty if I succeed. Just a heads up, the binary will be absurdly large, what with all the image and video libraries it normally calls.

1 Like

I tested a chroot on the gen2 by doing the following on a gen1 system.
dd if=/dev/sda1 of=/mnt/USB bs=64k
Then put the USB on the gen2 and did a chroot. In the chroot you all of the commands that are on the gen1.
Still testing to see if there are any problems.

Fox_exe 's package has the advantage of having functional systemd, and automatically starting daemons configured for that chroot. This means you can configure cron jobs and the like inside it, and they will run at boot.

Being true debian jessie (aside from the weaksauce kernel…) you can use apt-get to install basically anything. ffmpeg included.

Since this guy wants to have it automatically grab and start dumping a captured feed from an IP camera, having it all just start working after a reboot is very much a plus I think.

That said, there might be useful situations where static ffmpeg is handy to have around, so I am compiling it anyway and will add it to my useful tools loose-pack.

You do know that there is a way to run a script on reboot.

Yes I do. The installable module format is just very reliable.

Installable module format?

Fox_exe’s installable package for debian. It installs the whole chroot all at once. It configures all the things for you, no questions asked. You just need to set up wdcrack first.

It relies on the 3rd party application module packaging format WD created for the more expensive commercial class MyClouds. There is an init system for them and everything. WDCrack makes use of it to restore the app-installation crack after every boot for you. Packages installed all have their own init script that fires, that turns on the package like a service. Fox’s debian package’s init script mounts all the needed system things, and starts the chroot’s systemd service, which starts up the chroot as if it were a real linux box, including starting another cron, and all the trappings. It also mounts the contents of /shares inside the chroot, so you can get to it easily from there.

Really, a whole lot of work has already been done for you, so you dont have to do it manually unless you really want to.

I guess I’m trying to just use the WD code and use the features that WD uses. I don’t need other applications. Other than minidlna.

I use it as a sandbox for doing native compile jobs directly on the gen2, instead of doing a cross compile. Makes compiling all those one-off tools I have been cooking lately much easier.

Speaking of one-offs, do you need or want any tools? I am still looking for useful software to add to my loose pack. I think the next one I will do is sshpass. It lets you use a password file to initate an ssh session (and rsync sessions… ;)) totally from a script. Useful if you want to make use of the mycloud’s ability to rsync, without having to fire it off manually and enter passwords.

1 Like