FORUMS
Remove All Ads from XDA

Commander: [Cygwin + Cmder]

25 posts
Thanks Meter: 7
 
By Ferather, Junior Member on 13th March 2019, 09:59 PM
Post Reply Email Thread
Commander:

Cygwin + Cmder, this pack is intended for Android, but does much more. I consolidated the pack myself, and thought it might help others using Windows.

Features:

Easy admin and shell switching, with tabs and multi shell support.
Full drag and drop "to-path" support, even as admin.
Various user defined settings and features.
Fully portable (usb for example).

----

Shortcut:

Right click "Cmder.exe" and select "create shortcut", then right click it and "rename" it to "Commander".
Press the "Windows key + R" and copy-paste the following directory location:

%ProgramData%\Microsoft\Windows\Start Menu\Programs

Right click and "cut" your shortcut, then right click "paste" into the folder, then close the folder.

Note: You can also change the icon of the shortcut, there are more in the "icons" folder.

----

Change the "startup shell" if you want to replace-combine CMD and PowerShell.

----

I take no credit for the app and binary's, I simply consolidated the two and pre-configured it.

http://www.mediafire.com/folder/lzsf7xd2wwsm4/Commander
Current version: 2019-03-14 (14-03-2019, UK), stable.

----

Screenshots and more info below

----
The Following 2 Users Say Thank You to Ferather For This Useful Post: [ View ] Gift Ferather Ad-Free
 
 
14th March 2019, 03:23 PM |#2  
OP Junior Member
Flag Near London
Thanks Meter: 7
 
Donate to Me
More
Example usage and path strings:

https://ibb.co/nQML4zd

https://ibb.co/GQJsRvM
https://ibb.co/k1VYkCx


Add path to environmental path:

https://ibb.co/KqvM2v0


Optional install method:

https://ibb.co/jkkM3r9

----
17th March 2019, 12:17 AM |#3  
OP Junior Member
Flag Near London
Thanks Meter: 7
 
Donate to Me
More
How to setup working directories, plus a few other tricks. In this guide I will be using 'bootimg' which unpacks-repacks boot.img and recovery.img files, it also requires a working directory.

Method 1 is the quickest, but teaches much less. Method 2 takes longer but teaches you a few tricks along the way.

----

Method 1:

First I make a 'TMP' folder on my 'D:' drive || mkdir D:\TMP
Next I move my 'boot.img' to 'TMP' || mv D:\Files\Desktop\boot.img D:\TMP
Now I check all is well || ls D:\TMP
Next to set the working directory || cd /d D:\TMP
Now I run 'bootimg' || bootimg --unpack-bootimg boot.img

https://ibb.co/6nV8dCw


Method 2:

First I make a working directory || mkdir %commander%\rom
Next I check that worked || ls %commander%
Now I move 'bootimg.exe' to '\rom' || mv %commander%\bin\bootimg.exe %commander%\rom
Next I check that worked || ls %commander%\rom

https://ibb.co/ZxRQhXz

Now I make a winlink as 'admin', making things easier || mklink %commander%\bin\bootimg.exe %commander%\rom\bootimg.exe

https://ibb.co/YbYPwm9

Now I check the symlink is working' || bootimg /?
Next I copy my 'boot.img' to '\rom' || xcopy D:\Files\Desktop\boot.img %commander%\rom

https://ibb.co/yW2mVP5

Now I set the working directory || cd /d %commander%\rom
Next I run 'bootimg' || bootimg --unpack-bootimg boot.img

https://ibb.co/njZ2fdz


Note: %commander% is an environmental path, which points to my Commander location (see post 2).

----

Notes:

You can run more than one command per line, by using '&' or '&&' (and then), which can be used more than once.
Make a folder and explore it || mkdir %commander%\rom & explorer %commander%\rom

Winlinks are symlinks, they also accept 'posixpath' as strings, example: "/vendor".

----

Useful apps (limited use with Android): OSFMount | Ext2fsd | VirtualBox

VB Images: https://www.osboxes.org/virtualbox-images/

----

Screenshot weblinks fixed, I apologize.

----
17th March 2019, 05:02 PM |#4  
OP Junior Member
Flag Near London
Thanks Meter: 7
 
Donate to Me
More
How to customize, and in some part produce a rom from another rom (ideally a stock one), without data corruption and incorrect metadata, corrupt other.
Note: OSFMount + Ext2fsd, and also FreeBSD (Unix) do not interface with non-standard data for android partitions (ext4, lightly modded).

----

Interestingly both OSFMount + Ext2fsd and FreeBSD fail at the same general issue, metadata and file attributes (ext is not native).
With FreeBSD, chattr and lsattr do not function, they run, but read and write nothing, 'noatime' is not applied to files.

Note: FreeBSD will allow you to change permissions on symlinks (chmod -h), whereas linux does not.

----

First, it's likely the 'system.img' file is a sparse one, and cannot be mounted, so you will need to convert it to a raw 'system.img'.
simg2img Path-to-in\system.img Path-to-out\system.img

----

Now you will need to setup a debian distro on VirtualBox, I suggest 'Lubuntu', it's lighter and faster, and fully compatible., here is a quick after install guide:

Install guest additions via the iso, and terminal as 'root' (sudo), simply type 'sudo' and drag and drop the linux setup file into the console.
Setup shares for the current user || sudo usermod -aG vboxsf YOURUSERNAME

Full install guide: https://linuxhint.com/install_ubuntu_18-04_virtualbox/
Share: https://www.whonix.org/wiki/VirtualBox/Guest_Additions

----

Once you have setup shared folders (in my case 'D:\Files' as '/home/ferather/Files') copy the 'system.img' to '/'.
You can now mount it, and modify almost everything without metadata corruption.

Lubuntu (18.10):

sudo mkdir /system & sudo mount /system.img /system & sudo pcmanfm-qt /system
or
sudo mkdir /system & sudo losetup -fP /system.img & sudo mount -o noatime /dev/loop1 /system & sudo pcmanfm-qt /system

NomadBSD (1.2):

sudo mkdir /system & sudo mdconfig -a -t vnode -f /system.img -u 1 & sudo mount -t ext2fs -o noatime /dev/md1 /system & sudo pcmanfm /system

Note: 'pcmanfm-qt' and 'pcmanfm' are file managers, with root icons and theme.

----

How to boot:

You will need to unpack your 'boot.img', see post 3 for more details. Once unpacked you will need to modify the 'fstab.xxxx', where xxx varies with device.
I am using 'Programmers notepad' to modify linux files under windows, it's fully compatible with LF and CR line endings.

Now open your 'fstab.xxx' file, and find /system, and remove the verify part, example:

Old || /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/system /system ext4 ro wait,verify=/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/metadata
New || /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/system /system ext4 ro wait

Now you will need to repack your modified boot back into 'boot.img', for good measure you should unpack and do the same to the 'recovery.img'.

Note: If you wish to add tweaks to a '.prop' file, but want to maintain stock and verify, add them to 'default.prop' in 'boot.img'.

----

Tips:

Using 7-zip on windows you can inspect the raw 'system.img', which includes permissions, file attributes and symlink targets.
If you go to 'File > Properties' you can also see additional drive and-or partition information, and hidden bits.

Setting attributes (noatime) to symlinks may be difficult with Linux and Unix, try Android (xattr?).
Cygwin symlinks are actual files, and can have file attributes (using 'chattr').

You can also run Lubuntu direct from live cd-dvd or usb.

----

If you need to install the 'VirtualBox Extension Pack', use Commader as Admin:

https://ibb.co/nwBbnd7

----

Helpful commands for Android, alter to suit, various commands also work with Commander, enjoy:

https://www.mediafire.com/file/t03wq...1/Commands.zip

----
18th March 2019, 04:08 PM |#5  
OP Junior Member
Flag Near London
Thanks Meter: 7
 
Donate to Me
More
How to convert a less common drive image into a more common drive image, and then convert it into a virtual drive image, which is dynamic and is 12GB in size.
In this example I will be using 'NomadBSD' which normally flashes to a USB, and has no drive install method (setup for current drive, usb).

First I need to convert the '.efi' file into an '.img' file using Commander || dd if=D:\Files\Downloads\nomadbsd-1.2-RC2.efi of=D:\Files\Downloads\NomadBSD.img
Next I convert it into a dynamic '.vdi' file || "C:\Program Files\Virtual Box\VBoxManage" convertfromraw -format VDI "D:\Files\Downloads\NomadBSD.img" "D:\Files\Downloads\NomadBSD.vdi" --variant Standard
Now I want to resize it to 12GB || "C:\Program Files\Virtual Box\VBoxManage" modifyhd "D:\Files\Downloads\NomadBSD.vdi" --resize 12288
I prefer another format '.vmdk' || "C:\Program Files\Virtual Box\VBoxManage" clonehd "D:\Files\Downloads\NomadBSD.vdi" "D:\Virtual\NomadBSD.vmdk" --format vmdk
Next I delete unused files || del /f D:\Files\Downloads\NomadBSD.img & del /f D:\Files\Downloads\NomadBSD.vdi
For good measure I check before closing || ls D:\Files\Downloads\ & ls D:\Virtual\

https://ibb.co/3NW22Wz

Now setup VirtualBox, when at the drive setup part, drag and drop your created drive into the VirtualBox created folder, in this case 'D:\Virtual\Nomad\'.
Select 'Existing drive' and add your created drive image, I have a SSD, so I also check the 'SSD' option within the machine preferences.

----

How to setup nomad as a virtual guest:

sudo su
pkg update && pkg upgrade
pkg install virtualbox-ose
pw groupmod vboxusers -m nomad
pw groupmod operator -m nomad
pkg autoremove

geany /boot/loader.conf

Add || vboxdrv_load="YES"
Add || vboxvfs_load="YES"

geany /etc/rc.conf

Add || vboxservice_enable="YES"
Add || vboxguest_enable="YES"

reboot

--

How to mount a drive img:

After mdconfig (see post 4) || sudo dsbmc || This will open the mount manager as 'root'.
Generic method || sudo mount -t FILESYSTEM /DEVICE /LOCATION

--

How to fix the screen resolution:

Menu > Settings > ARandR > Outputs > Select a supported resolution > Save as: monitor > Open Pcmanfm > View > Show Hidden > .screenlayout > Edit 'monitor.sh' to suit.

https://ibb.co/1sCK0qP

Menu > Settings > DSBAutostart > Add: ~./screenlayout/monitor.sh > Move up to the top > Delete: redphase, batterymon and the audio monitor.

https://ibb.co/ZVpHrhM

--

How to setup shared folders:

In your virtual machine, select: Settings > Shared Folders > Add > Select your folder, but don't bother with auto-mount as it does not work with FreeBSD.

https://ibb.co/p3KQ4dx

Now I make a folder to mount my shared folder || mkdir ~/Files & chmod 777 ~/Files || Note '~' means current user home: /home/nomad

https://ibb.co/3pzDbqR

Next I create a script that will auto-mount drives || >~/.config/shared.sh
Now I need to edit the script || geany ~/.config/shared.sh
Header: #!/bin/sh || Code: mount -t vboxvfs Files ~/Files

https://ibb.co/qgkJ3Zb

Next I add the script to auto start || dsbautostart

https://ibb.co/4YD3VhD

reboot

----

Note for Lubuntu:

To install Lubuntu on virtualbox, disconnect the network cable (in preferences), I believe a web address has changed.
Do not 'disable' the virtual adapter, otherwise the install will not setup any drivers by default.

https://ibb.co/fXGqN3p

----

How to create a shared storage drive:

This method uses a virtual drive with NTFS as a universal filesystem bridge between OS's.
The drive can be mounted via Windows, which allows you to transfer files.

https://ibb.co/6RmzT5t
https://ibb.co/3Fr3g3m
https://ibb.co/qyzKRvs
https://ibb.co/71y5TVr
https://ibb.co/d2DMG99
https://ibb.co/2nvpqJZ
https://ibb.co/kSvDw4T
https://ibb.co/gSWmwNd
https://ibb.co/j4PtzCj
https://ibb.co/DwLjfgJ

Tips:

Drive image files (example, system.img) can be directly mounted from the storage.
Remember to unmount, detach the virtual disk in Windows.

----

If you have 'su', superuser on your phone, you can use Commander as the terminal:

adb shell || Then || su || To test || ls /system/bin

----

Helpful links:

Linux manual | FreeBSD manual | A-Z bash commands | ADB shell manual

----
2nd April 2019, 08:21 PM |#6  
OP Junior Member
Flag Near London
Thanks Meter: 7
 
Donate to Me
More
Android for PC, can be used in VirtualBox, or installed to a hard-drive or usb-flash.

Recommended: PrimeOS - I tested the classic edition.
Other: PhoenixOS, Bliss ROM's, Android-x86.

My UEFI motherboard allows me to fully power down internal sata devices.
This prevents boot installers from overwriting the current one.

Tip: You can download apps (example: Terminal) via the market or Chrome.

----
5th April 2019, 05:22 PM |#7  
OP Junior Member
Flag Near London
Thanks Meter: 7
 
Donate to Me
More
Guide updated slightly, also the command 'cp' can preserve attributes, including symlink attributes (noatime).

http://man7.org/linux/man-pages/man1/cp.1.html
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes