Tag: flash

How to Flash OpenWRT onto a Zsun Card

Background

EDIT JAN 7, 2019
Warning! Before beginning this tutorial, note that I have **fried** two Zsun devices nearly immediately after doing these steps. My theory appears to be correct that as soon as you flash to OpenWRT the default power output is way, way too high and so it starts heating up and frying it. Within about 15 minutes of flashing both devices were dead and inaccessible – their SSID didn’t even show up. I am now testing another one where I dropped the power to low and it’s still alive after about 45 minutes. Therefore pay special attention I’m going to test another one now, but in case you find this blog today, you might want to wait a few days for my findings….

I found a lot of pages on the internet showing that it’s possible to flash OpenWRT onto a Zsun Smart Card Reader. A friend gave me a couple and I wanted to try some mesh network ideas. However, for some reason I couldn’t find everything in one spot for Ubuntu, so I’m writing this guide for anyone else who might want to try. There was also a significant bug I encountered which I overcame which might help you if you have tried and failed in the past.

I also recommend staying fully disconnected from your home wifi while you are doing this to avoid confusion. If you have access to an ethernet cable and router this will make things a bit more simple.

What You Will Need

  1. Zsun Reader
  2. micro SD card to insert into reader – BONUS! I just discovered you only need this for the flashing process and then can remove and use again for flashing other devices (microSD not required to function as extender!)
  3. Ubuntu machine with understanding of how to open a Terminal
  4. (optional) A dedicated folder/directory on your computer where you can ‘do all your actions’. I find this reduces risks and helps you keep your files in one place. You can even download this blog to PDF and put it in the same folder.
  5. All the stuff you need in one place on local machine (because your internet will go down while flashing)

Step 1: Download to local machine the File you will need to flash onto the Zsun

I found it really hard to find the file on this page. Here is a direct link to the file and save this in a memorable location on your computer as we’ll need to access it soon.

Direct link to download

Step 2: Make sure your micro SD card is formatted to FAT32

On ubuntu you can do this by pressing the super key, typing ‘disk’and using the disk utility. Note – always unplug all external drives you do not want to accidentally kill! Also pay super-special attention you are not accidentally formatting your own computer’s hard drive (I’ve done this hard life lesson and you don’t want it)

Step 3: Insert empty and correctly formatted card into the Zsun card reader

Self explanatory

Step 4: Plug in Zsun card reader into your computer (or any powered usb slot)

Self explanatory

Step 5: Connect the Zsun to your WIFI network

This is funny because I totally missed this step and (obviously) it has to be connected to the network in order for it to show up in network and be able to access the admin page. I had an attempted connection which failed and then the second time it connected. You connect to it like any wifi network but it won’t ask for a password.

Step 6: Make Card Accessible to Admin

I ‘guess’ that this step in one of the tutorials I read preps the card to be able to access via Samba. Not sure, I could not access the files on the card until I performed this step so let’s do that now. In a browser, copy/paste this:

http://10.168.168.1:8080/goform/Setcardworkmode?workmode=0

It should spit back this:
{"status":"0"}

Note: if you get ‘connection refused’ message in the next step you may have to re-try this command a few times. Make sure you are actually connected by wifi to device. One time I had to do a full computer reboot too and then it seemed to work.

Step 7: Access the Zsun via Samba (SMB)

(reminder this is an Ubuntu tutorial so you might have to do it a different way on your machine if it isn’t the same)

The super painful part of this tutorial for me is that this easy part was subject to a weird Ubuntu bug that tracks back nearly 10 years. If you are bored you can read about it here, but probably, like me, you just want to hack this zsun and then put evertyhing back the way it was. So let’s do that:

Step 8: Overcoming the Ubuntu Samba Username password bug

  1. in a terminal enter this:
    sudo nano /etc/samba/smb.conf
  2. Scroll down into the ‘Authentification’ section.
  3. at the very bottom in the space just above the “Domains” section, paste in (with control shift paste) this:

security = user
client use spnego = no

  1. ctrl x to get out
  2. ctrl y to agree to write the changes

Step 9: Continue with Tutorial and Accesss the Zsun via Samba

  1. Open Nautilus (called ‘Files’ on the launcher) (the file cabinet icon thing…)
  2. Go to ‘Other locations’ on the left menu at the bottom. A ‘Enter server address’ field will appear.
  3. Type in zsun address as follows: smb://10.168.168.1
  4. enter admin/admin pass/user (don’t worry about ‘workgroup’)
  5. when greeted with ‘public’ enter that directory
  6. hit ‘contrl h’ on your keyboard which will show hidden folders. If you don’t do this step you might not think the next step will work since it’s a hidden folder.
  7. You should see ‘trash~’ something. But if you don’t… whatever. Seems to work if it’s fully blank too… Here is where you create the following folder (with the dot/period in front):
    .update if it doesn’t appear after creating this folder, review step 6 above…
  8. Drag and drop the file you downloaded way above (SD100-openwrt.tar.gz) into this new .update folder. Yes, the whole tar file, don’t extract it.
  9. CRITICAL STEP! Before doing step 10, make sure you skip ahead, and deeply familiarize yourself with the steps following it because you will have a short time to do those steps before the device fries and dies. Once you have read it all (especially big step 11 below) then come back here and execute step 10.
  10. After you are sure that the file is done copying in, go to a browser and enter this:

http://10.168.168.1:8080/goform/upFirmWare

When you see this, things should be working:
{"status":2}

Here is a fair-use paste from buddy’s blog

Wait for the reboot into OpenWRT

Wait for long LED flash, then multiple fast flashes – now OpenWRT is booting for the first time.
There will be a long period of (normal slow) flashing, then one long flash, then a whole bunch of very fast flashes. The ZSun Wifi network disappears, and eventually re-appears as OpenWRT.

What he didn’t add that I discovered was when everything is totally done it will be a solid light colour.

SUPER IMPORTANT NOTE (in case you missed my other 20 warnings…) immediately as quickly as possible and reduce transmission power on device! Learn how to do this in Big Step 11 below …if it’s not too late.

Step 10: Log into your new OpenWRT Mini Router!

I have another OpenWRT router going in my house so right away I’m going to log into the new little guy here and change it’s IP address to something different to make sure they don’t conflict. The default OpenWRT is 192.168.1.1 so we’ll access it there now.

You’ll get a browser warning that it’s not secure. No problem, add exception, move forward.

You’ll be greeted with a log in screen with no password set.

Log in.

Step 11: Turn Down Radio Transmission Power to Prevent Deep Fried Zsun!

IMMEDIATELY reduce the transmission power of the device. The default is set to the maximum power and it will fry/kill this device in less than 10 minutes after you flash it. I lost two devices this way so act quickly as follows:

1. Go to network

2. go to ‘wifi’

3. click ‘edit’ on the ‘OpenWRT’ entry

4. Drop transmit power to 4 (lowest)

5. ‘save and apply’ button at the bottom

This will momentarily disconnect you from the device while it makes these settings. From here, assuming my theory above is true, you can start doing other things now such as resetting your device access password:

Go to ‘system’ and ‘system administration’ and create a new user/password

Step 12: Undo whatever we did to that Samba bug above (If you want)

Remember when we fixed that Samba bug above? I’m frankly not sure if that was a secure thing to do so let’s undo it in your computer just in case by going back in the same way, deleting those lines you added, and then saving.

Step 13: Remove microSD

As mentioned above, the microSD is no longer required if you are just using device as a wifi range extender (see this tutorial). You can unplug, remove microSD and plug it in now.

Step 13: Enjoy!

The rest, my friends, is up to you. Hope this helps!

Thanks to the following resources

  1. This nice video helped me create this Ubuntu guide
  2. This great blog entry mentioned at the beginning.
  3. Of course the awesome people who hacked this thing here

Tags : , , , ,

How to Flash Cyanogen Mod on Nexus 4 Using Ubuntu

If you ended up on my first tutorial showing how to get ‘android back’ I did post that too hastily and forgot that Cyanogen mod is a much, much safer version of android because it doesn’t connect to the mothership of Google.  If you have been running Ubuntu on the Nexus 4 and been challenged and need a temporary solution while some bugs are worked out at ubuntu, this is a safer option while you buy some time.  I hope this is helpful resource so that busy and broke people can stick with Ubuntu during times of code tribulation.

This tutorial assumes you already have adb set up on your Ubuntu desktop/laptop.

This tutorial assumes you have Ubuntu on your laptop/desktop.  If not, good luck.  You’re on your own, sorry…

NOTE: Cyanogen mod does not come with a google play store.

  1. get recovery image from here: https://dl.twrp.me/mako/  (note if you want more info you can go here: https://twrp.me/devices/lgnexus4.html)
  2. download cyanogen mod for nexus 4 here: http://download.cyanogenmod.org/?device=mako
  3. plug in phone with usb
  4. navigate with terminal to place where you downloaded that twrp.img thing above
  5. type fastboot flash recovery and start typing name of big twrp file and hit ‘tab’ to auto-fill it
  6. press enter
  7. when done, should say ‘finished’ in terminal
  8. test to see if it worked by using your volume up/down button until you come to ‘recovery mode’ on your fastboot screen. should get some ‘team messages’
  9. swipe to allow modifications to partitions (not sure if you should but I did for speed)
  10. push the cyanogen mod install .zip file onto sd card by entering this in terminal: adb push filename.zip /sdcard/ where ‘filename’ is the name of the cyanogen mod install thing you downloaded in step #2 above. You can again use the tab button to auto-fill your filename after you start typing.  My command looked like this as reference: adb push cm-12.1-20151007-SNAPSHOT-YOG4PAO334-mako.zip /sdcard/ – this takes a bit of time and will show you how much moved and how long it took when complete. Don’t interrupt it until it’s complete.
  11. Within the TEAM thing again select ‘wipe’ and ‘factory reset’.  Of course don’t do this if you haven’t backed up pictures of the wife and kids…
  12. Super root your phone if it’s not done already…. skip this if you have
  13. ‘install’
  14. select storage (in this case it’s internal storage since the dumb thing didn’t come with SD card)
  15. you’ll see your cyanogen mod file sitting there that you moved over from step #10 above.  go ahead. touch it.
  16. swipe the blue arrows to ‘swipe to confirm flash” if everything goes well you will see stuffs happening and your phone will be heading towards a slightly less evil version of Android.  the phone will turn off, then turn on again, and you’ll have blue arrows to swipe again to unlock.
  17. Unlock it.
  18. Reboot system. Phone will turn off again (I sound like a broken record!).  Cool looking blue robot thing will show up.

I hope this helps a few Ubuntu fans keep their Nexus 4 alive for days with less bugs if you are in desperate need of the phone for business or otherwise during the pioneer days.  We are very close to no longer needing Cyanogen and other versions and because Ubuntu will soon converge into desktop, laptop and tablet, there really is no need to explore other OS.

That said, I’m very thankful for Cyanogen mod and the folks who built it and it was very good while google reigned in terror and thanks for this tutorial upon which I based mine: http://wiki.cyanogenmod.org/w/Install_CM_for_mako

Tags : , , , , , ,

How to Flash Back to Android from Ubuntu Phone

UPDATE:  This tutorial below will flash you back under the nasty tracking eyes of Google/Alphabet.  You will get the google play store and all the ‘fun’ but you will also get spied on and ultimately regret it.  I have since updated my tutorial/solution to this:

How to Flash Cyanogen Mod on Nexus 4 Using Ubuntu

There is no play store out of box but there are workarounds, etc, to hold you over for app-stuff.

————————————-

First, I hope you never have to perform this tutorial.  I would never do this if I wasn’t in such a time and money crunch.  What I would do instead, is buy an ubuntu phone out of box.  But my situation is that I have a Nexus 4 which wasn’t designed out of box for Ubuntu so there are some bugs which I cannot find time to work around (for now).

Anyway, my hope is that the bugs will be solved in the next couple of months and I’ll flash right back to Ubuntu or have enough dough to buy a new device with it pre-installed.  It’s very important that I say this because I feel like a dirty dog for even writing this tutorial but I know that I’m not alone amongst those who may need to flash in and out while the kinks are worked out in ubuntu phone.  My goal here, to be crystal clear, is to give busy or broke ubuntu fans and believers a chance to stay on the team by allowing them to ‘temporarily flash out and in’ rather than, say, flash out and stay out, or buy some horrid apple or android phone before an out-of-box ubuntu phone is available for purchase in their neighbourhood.

Here’s the time-saving set of steps for you:

Assumptions: your phone is sitting there at the fast boot bootloader screen thing with the green robot with the usb cable plugged in in the same way that it was when you flashed Ubuntu onto your phone.

  1. download the evil compressed file of nastiness here: https://developers.google.com/android/nexus/images#instruction
  2. extract the stench in a safe file that will never defile the rest of your ubuntu machine
  3. navigate to it with the cd command (change directory command) contents should look like this:

001-whats-in-droid-folder

4. type this, assuming you can see the ‘flash-all.sh’ there  –>   ./flash-all.sh

5. wait, cry, and think about the error of your ways and how you are putting yourself and others at risk.  Also, make note in calender to flash back to Ubuntu. You’ll have a lot of time to do this because the flash seems to take extra long…

6.

Tags : , , , , ,

How to Flash from Cyanogen Mod to Ubuntu on Nexus 4

Normally in the past, it was very easy for me to flash from android to Ubuntu for phone.  I just used the usual ubuntu tutorial and it worked.

Then, somewhere in the middle I switched to Cyanogen mod (android) as the ‘lesser of two evils’ while I was waiting for bluetooth to improve.

I heard today that everything is working so I went back to flash and boom.  Snagged.  It woudn’t recognize adb devices when I was in fastboot mode.

I searched and tried a hundred commands but the answer turned out easy.  I just had to switch to recovery mode, not fastboot mode.

How you do that is on your green robot screen you just push the down arrow (volume) until the screen says ‘recovery mode’ at the top and then press the usual power button at the top right.

Then you go back and follow the install instructions from this command:

ubuntu-device-flash touch --channel=ubuntu-touch/stable/ubuntu

All good in the hood.


 

EDIT: All was NOT good in the hood.  I got stuck in a perpetual Cyanogen Mod recovery mode loop.  It turns out that nothing else worked for me.  The ubuntu flash process from the above command worked. I could see all the images going to the device. But it would continually reboot back into CM.

The solution?  Oddly, all I had to do was add back in the –bootstrap at the end of the command and everything worked instantly.  So the command looked like this:

ubuntu-device-flash touch --channel=ubuntu-touch/stable/ubuntu --bootstrap

I suspect this is not ideal because the official tutorial shows clearly you should only need the bootstrap option at first install only but mine always needs it.  If anyone knows what’s up it would be cool to know.  Please comment!  Otherwise, we’re back to Ubuntu – hopefully forever.

Tags : , , , ,