All posts by simernes

Flashing Stock or Custom Firmware with Heimdall (on linux)

I had a bit of a learning curve when learning how to use Heimdall to flash images onto my phone (i9506, aka ks01lte) so hopefully this can help others with what I learned.

First of all, Heimdall is a flashing software for putting firmware into the different partitions of Android phones. It's cross platform, and supposedly equivalent in functionality to that of Odin, although I've never tried Odin. Heimdall is also cross platform so you can follow this guide if you're on mac or windows I think.

Heimdall basics
There are two executable programs:
1. heimdall
2. heimdall-frontend

I recommend using heimdall-frontend, but you need both because heimdall-frontend depends on heimdall.

Heimdall version
At the time of this post, the newest version was 1.4.2. I had to compile that myself from source though, but it was relatively easy if you just follow the build instructions inside the readme. I had to use 1.4.2 to get it to work with my phone so if you have issues you should try getting the newest one. There were binaries of 1.4.0 on the official website, and 1.4.1 in the ubuntu repo.

Installing Heimdall
At the time, I could also install heimdall from ubuntu repos with apt-get install, however the packages were called heimdall-flash and heimdall-flash-frontend. Idk why, but they're the same. Also they were 1.4.1 so they unfortunately didn't work for me, so I had to install them myself after compiling.

So briefly how to install it, although I'm not gonna give the whole command specific walk through as it is in the readme:
It's located at the github page:
https://github.com/Benjamin-Dobell/Heimdall

clone the directory:
git clone https://github.com/Benjamin-Dobell/Heimdall.git

Enter the directory and follow the build instructions as detailed (the last time I checked) at the very bottom of the readme file, specific for Linux, so it was inside the Linux folder.

Now after building you'll have two executable files:
heimdall
heimdall-frontend

The problem now is that you need to run these as root to connect to your phone, and heimdall-frontend uses heimdall, so you need to add them to your PATH.
However, by running sudo the PATH gets reset, so if you just export PATH=$PATH:$HOME/heimdalldirectory its not gonna find it so what I did (which you shouldn't really do because it should be reserved for system applications but whatever, it works, and you can just delete the heimdall files after you finished to keep a clean system) was to put both files in /bin/
sudo mv ./heimdall /bin/
sudo mv ./heimdall-frontend /bin/
Now you can sudo heimdall-frontend

Other problems with heimdall
If you get libusb errors when trying to export pid or anything else, try a different USB cable, and try different ports on your computer. That actually worked for me.

Flashing of firmware
First of all, your phone needs to be in Download mode, so google how you do that. For me I had to power off the phone, and then hold Power+Vol Up+Home. Or Vol Down I can't remember.

Then sudo heimdall-frontend and go to Utilities, and try to detect device. It should show a little messages saying it was detected.

Download and save .pit file
Next you'll want to Download the pit file from your device. This is also a good way to check if heimdall is working correctly, by just trying to print the pit. But you should really download the pit file and store it because you'll need it for flashing. It works as a sort of partition map (Partition Information Table).

So go ahead and download that and save it.

Now that you have that, you've done a very good job so pat yourself on the back. You're a really advanced hacker person aren't you? Wow. Good job. Now the real shit begins though so get ready. This is where you might brick your device so beware.

Really. Be careful. If you flash the wrong thing you're fucked so. Yeah.

Also, the warranty of your phone will be void after you flash anything onto it like this, so this is a kind of point of no return, although you might be able to flash it back to warranty condition if you have the stock recovery img. Not sure if phones can recognize that or not.

Flash custom recovery first
The first thing you might want to do is install a custom recovery like TWRP. TWRP lets you backup all your partitions, which can be nice in case you flash the wrong thing and want to get back to square one. You can also save your partitions with dd but I'm not gonna get into that here.
Like I said, this might void your warranty, and after doing this, I could not update through the stock phone update mechanism anymore (I mean, as a regular person going into Settings->about->Check for updates on your phone, it said something like "Your phone has been changed, no updates for you".

So to flash TWRP, open up heimdall-frontend again, go to the Flash tab, browse for your .pit file. Then Add a partition file, and select RECOVERY as the name, and find your recovery.img file: See figure 1.

Figure 1 -- heimdall-frontend with RECOVERY flashing

Now, start, and it will reboot when it finishes probably so be ready, and make it reboot straight into recovery right away. If not the custom recovery will be wiped. For me, booting into recovery was the same as to boot into download, just the opposite direction volume.

Now go into BACKUP and backup everything, and store that somewhere on your computer. In case something goes wrong. TWRP backs up to a directory on your phone located in /TWRP/Backups/.....

Flashing the rest of the firmware
Next, we'll be flashing some more interesting things. Like the full firmware, with modem and everything.

In my case I wanted to flash the newest stock rom update, because I needed the updated bootloader and modem firmware to install LineageOS 15.1 (Android 8.1), which I could later simply install from within TWRP.
So I downloaded the newest stock rom update from sammobile.
You can get the newest firmware from there for free if you sign up, but have to pay for older ones it seemed.
It might also be important that you get the right ROM for the right region or country, I don't know if that affects the ability for the phone to boot or not, but I'd try to get the right one if I were you.
For me it was a large file of about 1.5 GB. A .zip file to be exact, which upon extraction revealed two files, one of them being a .tar.md5 file.
If I just renamed the .tar.md5 file to a .tar file (removing the .md5 part of the name) I could extract it, and it revealed the files that can be flashed by heimdall.

In my case the files were:
aboot.mbn
boot.img
cache.img.ext4
hidden.img.ext4
modem.bin
NON-HLOS.bin
recovery.img
rpm.bin
sbl1.mbn
sdi.mbn
system.img.ext4
tz.mbn

Which made me very anxious and insecure, and I felt that this was perhaps a bit much, but then I figured it out.
Just like that recovery file from before, all these files correspond to a Partition name in Heimdall Frontend, from the .pit file. So what we'll actually do here with heimdall is just put the contents of these files/images into the partitions of our devices, and then they'll replace whatever was there from before. So it's all quite simple really if you think about it.
The name of the partition isn't always the same as the file, but there is a file name hint below the name so look at that. For example the APNHLOS partition name corresponds to NON-HLOS.bin. See figure 2.

Figure 2: APNHLOS file name hint

Now just keep adding all these until they're all in heimdall (figure 3). This should be a pointer also to whether or not you're using the right firmware. All files should fit into a partition. However, you might want to not flash the RECOVERY to preserve the custom recovery previously installed. You might have to boot directly into recovery again after flashing this time too to avoid reseting to the stock recovery, but I'm not sure. Just in case.

Figure 3: Heimdall Frontend with all firmware files added, except for the recovery image.

Now, if you dare, hit the Start button, and wait in excitement. Remember that your phone should be in Download mode right now. Also be sure to boot into recovery right away! And then just reboot, but your recovery might ask you if you want to remove the "Read only" permissioning, which I think you should do.

Great! That's it! Hopefully you didn't brick your phone. If you did, then hopefully you backed up with TWRP like I said before, and then you can restore it in TWRP. I think though that's just if you "soft bricked" and not "hard bricked", which is worse probably.

Good riddance! Thanks for reading. I hope it helped.

Donate bitcoin if you want:
3KEghQ3pfkRESZMki1HePNRfbxdNNpDiUT

mine doge

How to mine bitcoin with NVIDIA card and Ubuntu 16.04 using ccminer

ccminer is a NVIDIA-CUDA GPU miner, based on the old CudaMiner which allegedly was discontinued in 2014.

ccminer has support for pretty much all of the popular hashing algorithms, except ethash as far as I can tell, so you can mine not only Bitcoin, but also pretty much any other coin.

I found a few guides out there, but none were complete in the sense that if I simply followed them to the point I could compile ccminer. This here is a sort of compilation of the resources that I used to get ccminer by tpruvot to work, with a bit of explanation in steps. You should probably be a little familiar with the terminal because it's not 100% accurate in terms of the commands to write.

Please keep in mind that GPU mining is not really profitable unless you have free electricity, or you mine a coin that is favored by GPU (and it hasn't become popular yet).

Step 1: install the newest NVIDIA driver in Additional Drivers

Step 2: Install CUDA Toolkit using run-file downloaded from NVIDIA newbsite
sudo chmod +x ./Downloads/cuda_*.run
sudo ./cuda_*.run
Don't install the driver as we just installed it in Additional Drivers, but accept everything else (samples, toolkit..)
It might warn that you are running on an unsupported platform, but it worked fine for me, so just say yes.

Here 6.5 is used because that's what tpruvot specified in ccminer, but you can try newer versions. Older no. I couldn't get it to work with 9.1.
According to NVIDIA it should work: https://devtalk.nvidia.com/default/topic/1027578/cuda-setup-and-installation/does-later-versions-of-cuda-support-older-gpus-/post/5226822/#5226822

add -override compiler if it complains

add cuda to environment variables:
gedit ~/.bashrc
Add the following to the end of the document – “
PATH=$PATH:/usr/local/cuda-6.5/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-6.5/lib64:/lib “

https://d3adbra1n.wordpress.com/2014/05/03/cuda-miner-installation-on-a-fresh-ubuntu-14-04-lts/

then either close and reopen the terminal, or write "source .bashrc".
write echo $PATH to make sure it contains the cuda directory.

mine doge
wow

Step 3: install ccminer https://github.com/tpruvot/ccminer/blob/linux/INSTALL
ccminer is based on CudaMiner

TL;DR install ccminer
git clone https://github.com/tpruvot/ccminer.git
sudo apt-get install libcurl4-openssl-dev libssl-dev libjansson-dev automake autotools-dev build-essential

gedit Makefile.am
Around line 85 find this.
nvcc_ARCH = -gencode=arch=compute_50,code=\"sm_50,compute_50\"
nvcc_ARCH += -gencode=arch=compute_52,code=\"sm_52,compute_52\"
#nvcc_ARCH += -gencode=arch=compute_61,code=\"sm_61,compute_61\"
#nvcc_ARCH += -gencode=arch=compute_35,code=\"sm_35,compute_35\"
#nvcc_ARCH += -gencode=arch=compute_30,code=\"sm_30,compute_30\"
#nvcc_ARCH += -gencode=arch=compute_20,code=\"sm_21,compute_20\"

If you only have one graphics card, comment each line with # except the one corresponding to your GPU. Find out which one is for you here: https://github.com/tpruvot/ccminer/wiki/Compatibility
Make sure it doesn't say +=, but = after nvcc_ARCH at your first instance of the line. Only the equals sign.

./build.sh
./ccminer --version

now sign up at multipool.us or anywhere else and do something like:
./ccminer -o stratum+tcp://us.multipool.us:3334 -a scrypt -u simernes.1 -p myPassword
where simernes is the login to the site, and 1 is the worker name. So basically the entered username is the worker to use. This varies from pool to pool how it's done, and some pools don't even require registration -- and maybe the password is your bitcoin address.



Troubleshooting:
Installing CUDA Toolkit:
"
Hello! i have same problem and decide theese next decisions:
unfortunately try export PERL5LIB and see in log whatever installer not seem file InstallUtils.pm
1. unpack .run file ./cuda*.run --tar mxvf
2. copy InstallUtils.pm to /usr/lib/x86_64-linux-gnu/perl-base
3. export $PERL5LIB
enjoy
"

https://devtalk.nvidia.com/default/topic/983777/can-t-locate-installutils-pm-in-inc/

compiling ccminer
sudo apt-get install gcc-4.8 g++-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50

If you feel like it please donate with Bitcoin, I would really appreciate it.

3KEghQ3pfkRESZMki1HePNRfbxdNNpDiUT

Dogecoin is funny and that’s why it will succeed

In my continous empirical study of asking people about their thoughts and impressions of Bitcoin, I can't help but notice that most people have no faith in its success. That is if they at all have ever heard about it. Most of the people I ask -- especially the ones that are not in IT -- still think of it as silly internet money that can't be used to buy anything.

First of all I want to clarify that this text is purely an opinion. That opinion is that Dogecoin will make it simply because it is exactly what people think Bitcoin is. Silly Internet money. Think about it. One day someone makes an altcoin based on a meme as a joke, and suddenly Dogecoin has a market cap of more than 14 million US dollars. That's hilarious. It still can't be used for very much (at least in terms of buying groceries and such), but for now it allows people to play around with crypto currencies without having to invest large amounts of money.

That's where I see the real value of Dogecoin. In being the gateway drug of crypto currencies. For not-so-technical people I think Bitcoin can be confusing at first, and I think it can be frightening that you have to invest so much money (~USD 290 = BTC 1) to get even one bitcoin. With Dogecoin on the other hand where 1 USD currently approximates to 7,000 Doge (March 15, 2015), it's possible to play around with something that feels like a real amount without having to risk your life savings.

Anyways. The reason why I love Bitcoin based currencies is because of the security and simplicity it offers. That said, it does undoubtedly take some time to get used to, and I understand that it may seem complicated at first. Dogecoin is fun and simple, and it let's people get familiar with the technology with close to zero risk. That's where I think its potential lies, and I think that's why it will succeed and grow alongside other blockchains. At least it's how I got introduced to and fell in love with Bitcoin.

Very doge
Nice.

If you want to check out the community you can visit the Dogecoin subreddit.

Why this site exists

I made this site just because I wanted to have a website, so I don't really know exactly what to put here yet. I've done some app development, so I put that up and chances are that if you're visiting this site, you're either a robot or you came across one of my apps. Anyways, I'm glad you're here -- artificial or not -- so please, enjoy your stay.

Who knows, maybe when you read this the site has become copious in content.