sgnh / my-passport-wireless-pro-custom-fw

Custom firmware for Western Digital My Passport Wireless Pro
GNU General Public License v2.0
25 stars 6 forks source link

Details on successful compilation? #4

Open kitchung opened 4 years ago

kitchung commented 4 years ago

I'm been encountering a lot of trouble compiling this. Can you please detail your build environment? Distro, GCC/G++ versions, etc?

sgnh commented 4 years ago

Hi

Yes it can be a bit of a nightmare to get it to build. It took me a long time to figure it out. It's been 2 years since I did it but I've had a look at my files from back then and I've put together a small guide. I hope I have remembered everything.

First of all you must use Ubuntu 14.04. I tested with older and newer releases and they all caused various problems with the firmware.

Install the build dependencies:

apt-get update
apt-get -y install build-essential unzip gcc-multilib php5-cli libz-dev zlib1g:i386 tree ncurses-dev mercurial git subversion

Then you must download and extract the official sources from western digital as this repo does not include the binary files due to Githubs file size limits.

wget https://downloads.wdc.com/gpl/MyPassportWirelessPro-GPL-FW1_04_17.tgz
tar axvf MyPassportWirelessPro-GPL-FW1_04_17.tgz

From here you have to look at the BuildRelease.sh and SDKbuild.sh scripts as well as https://buildroot.org/ to get an idea of how it's put together and how to make the changes you want.

I hope it's helpful to you, just be careful as there is of course a risk of breaking the hard disk.

kitchung commented 4 years ago

Thanks for the tip! I've been trying to build using a dockerized Ubuntu 18.04 downgraded GCC/G++ to 5.x but now run into compile problems with libgphoto2 not linking properly. Did you downgrade Perl too or did you just patched around it?

sgnh commented 4 years ago

I did not change anything, I just used the packages from Ubuntu as is. You mention you are using Ubuntu 18.04. You should try with Ubuntu 14.04. As I said this is the only version I've been able to use.

All the newer versions I tried have various compilation and runtime problems. One of them caused a near brick for me where I had to use some of the obscure command line utilities from WD to reflash it.

Also the buildroot distribution itself is from early 2015, so I see no way to run newer version of either buildroot or the build environment (Ubuntu 14.04) without putting in a massive amount of work.

kitchung commented 4 years ago

Yeah, i had a lot more success after downgrading to 14.04. I'm now getting the following error while building for korra_spi:

FATAL: RSDK is corrupted. Please reinstall.

Have you encountered this before?

sgnh commented 4 years ago

I don't remember seeing that error message. I did however get various errors from time to time which I think is because the build scripts downloads dependencies that are sometimes corrupted. Resetting the build environment always fixed any errors I experienced.

pudlez commented 3 years ago

Sorry to ping on an "old issue" but do you still have the details on the obscure cli stuff to unbrick? I'm asking because I started messing with my drive again and want to make sure I have a way to recover.

sgnh commented 3 years ago

I don't remember the specific commands and I have sold my drive so I can't check. But the web interface calls command line scripts to reflash with the latest official firmware. So if you somehow kill the web interface, you can call the scripts on the command line instead. You'll have to dig around to find them. As far as I remember there's also a way to restore the firmware from a SD card if there's no access to the drive at all.

pudlez commented 3 years ago

Thanks for the reply!

I know how to trigger recovery through ssh and the sd card way (basically setup sd card with update direcotry, place firmware in there, and constantly push the battery button during boot if you're not using uart). I was thinking the brick you mentioned was worse and had to do uboot commands.

sgnh commented 3 years ago

Ah no I always managed to get back to the official firmware with just scripts.

kitchung commented 3 years ago

Install the build dependencies:

apt-get update
apt-get -y install build-essential unzip gcc-multilib php5-cli libz-dev zlib1g:i386 tree ncurses-dev mercurial git subversion

Run this first or else zlib1g:386 will fail:

dpkg --add-architecture i386

Also, my docker needed wget and bc, so the full build process for me was:

dpkg --add-architecture i386
apt-get update
apt-get -y install build-essential unzip gcc-multilib php5-cli libz-dev zlib1g:i386 tree ncurses-dev mercurial git subversion wget bc
wget https://downloads.wdc.com/gpl/MyPassportWirelessPro-GPL-FW1_04_17.tgz
tar axvf MyPassportWirelessPro-GPL-FW1_04_17.tgz
cd buildroot-GPL
./BuildRelease.sh build

As far as my "FATAL: RSDK is corrupted. Please reinstall.", it comes from buildroot-GPL/output_korra_spi/build/rtkpackage_bootcode-KD3_02/tmp/asdk-4.8.1-a7-EL-3.10-0.9.33-a32nt-130828/bin/arm-linux-gnueabi-gcc

It's definitely related to my build environment being a Docker instance. I've been comparing strace between docker and vm of Ubuntu 14.04 and may be related to how the toolchain extracted to my filesystem.

gree303 commented 5 months ago

I installed the firmware x.x.17c.bin onto my WD. SSH does work without issues. Can you tell me if this also include the custom UI mypassport.local:8810 which is seen in the Hackwifidrive / youtube vidoes (WD MyPassport videos)?

Q1: Is your firmware the same as shown in the videos by Hackwifidrive on YT? Q2: If so, where can i find these folders to install the MOD / the extra web-ui to access plugins etc.? Hackwifidrive.com is online, but it does not allow me to purchase their mod. Tried to contact them, but all mails result in a dead-end. Any info/tip is very much appreciated. I started customizing the default web-ui, basically rebuilding the same functions which were already implemented by these guys (not sure if this is you).

Thanks.