How To Guide How To Install Windows Or Linux ISOs on your Android Devices - Windows 10 Nox Lab + Working Arm Distros for your phone using Termux

Search This thread

tehdomic

Member
Oct 8, 2012
13
4
1. I managed to boot the pre-made image by changing the -hda command :)

2. But, inside the "VM" it says it's a 1 GHz CPU. Would it matter if I tried running a different -cpu option?
I have a Snapdragon 865+ SoC and there's quite a lot of power in this chip.

3. Also, the Windows mouse cursor in the VNC connection isn't quite on par with the VNC cursor. It's often out of sync. (I will likely install TigerVNC server (or similar inside Windows to get around that problem), alternatively try a "-vga vmware" setting. (Do you know which vga settings would work fine on Snapdragon 865? I don't plan on running 3D applications on it.)
 
  • Love
Reactions: jenneh

jenneh

Senior Member
@tehdomic,
1. This makes me really happy!
2. you can def use different options! it doesn't hurt anything to edit the script, you can always revert back if needed. Just make sure to close termux first or force stop it and you can either rewrite the script on your pc and repush it or you can edit the script in termux. To edit it in termux see these steps
1.PNG
3. The vnc app problem is in need of a solution unfortunately. I have the same troubles. I linked a thread in the comments above with an article by David Bombal, in it he is talking about a Linux machine, however they use a different VNC app, it may work better I just haven't had the time to test it
 
Last edited:

anthonycolucci

New member
Jan 28, 2023
1
1
Currently working on this build. The first step calls for the use of an efi driver. The programming notes have been updated to include this. The SOURCES tree now includes the novice code I'm using to build. WIN11ARM must first be understood before building Android.
 
  • Like
Reactions: jenneh

jenneh

Senior Member
P.S. this guide can kinda help give some starter code on an AARCH64 qemu build as well and helps evidence what Anthony said about how the efi driver comes into play

https://futurewei-cloud.github.io/ARM-Datacenter/qemu/how-to-launch-aarch64-vm/

another link to gain inspiration from https://gist.github.com/CombinedEffort/bb7ffd950692f80a42f0400bd9c10ac3

this one is a step by step with ubuntu can replace with windows: https://gist.github.com/billti/d904fd6124bf6f10ba2c1e3736f0f0f7

Following that Ubuntu guide- This code seemed to get past the board and attempt to load but the "-nographic " needs to be fixed
Code:
qemu-system-aarch64 -m 2048 -cpu cortex-a72 -smp 4 -M virt -nographic -bios QEMU_EFI.fd -drive if=none,file=ubuntu.img,id=hd0 -device virtio-blk-device,drive=hd0 -drive file=user-data.img,format=raw -device virtio-net-device,netdev=net0 -netdev user,id=net0 -vnc 127.0.0.1:3

I am paused here for today

TESTERS FOR UBUNTU ARM
if you want everything in one folder from that link along with scripts to push the files

you will need to edit hrun.sh and add -vnc 127.0.0.1:your choice of port number or else it wont boot in vnc

then you can open pushall.txt and copy and paste line by line to get the files sent to your device through adb

Thanks to anyone who shares anything big or small!

Here's the efi driver:

Here's a copy of win11arm if anyone would like to help solve this problem!
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    Working Ubuntu ARM 64 for Termux with GUI
    SOURCE:

    Code:
    pkg install x11-repo
    pkg update
    pkg install git wget -y
    git clone --depth=1 https://github.com/modded-ubuntu/modded-ubuntu.git
    cd modded-ubuntu
    bash setup.sh

    1678963103823.png

    This will start the script and it will install Ubuntu for us.

    1678963225405.png

    When the setup script is done, it will ask you to restart Termux. Then run the user script.

    1678963406830.png

    So force stop Termux in settings and reopen it. Run this code:
    Code:
    ubuntu
    bash user.sh

    1678963598635.png

    When you get here make sure to use an all lowercase name, don't use numbers it will mess things up

    When you are done, force close and restart termux as we did before, then run this code:
    Code:
    ubuntu
    sudo bash gui.sh

    This will take about 30mins to an hour to complete. When it is done you will have a working modded Ubuntu Arm 64 machine running in Termux with a GUI.

    Type vncstart then use the VNC APP of your choice, I used Nethunter Kex.

    WHAT IT LOOKS LIKE:
    Screenshot_20230316-055207.png
    Screenshot_20230316-055216.png
    Screenshot_20230316-055153.png
    If you encounter any interesting Termux scripts in your travels, please do share!
    1
    That's great to hear, man! I want to get a Pixel 3A XL, as this is the model UBports promotes as having 100% functionality. Do you think that I can get Android Tools on this and flash my little brother's tablet? I can access the menu that says:

    Recovery <===
    Fastboot
    Normal Boot

    Have you tried something like this?
    Yes but for me it fails to see my device when I run fastboot devices. This may be something related to just the nvidia shield, not sure. When I have another device that will let me flash images normally, will report back. That or maybe someone who has tried before could share their experience with us
    1.png
    1
    Hi there.

    I want to explain better what these termux scripts are doing, as it pertains to something I am trying to figure out how to do. (PS I did not create any of the scripts I shared above and everything being shared below is theory right now)

    These scripts are using the termux package called proot-distro to download, build, and maintain the distro. Proot-distro is storing and managing everything in the /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ directory.

    I want to be able to take a fully built machine and copy it and be able to easily reinstall it, instead of having to spend an hour installing. I also want to be able to share these prebuilt machines with others. I tried in a couple of terminal emulators a couple of different ways to copy the Ubuntu directory from the installed-rootfs directory but it spits out symbolic link errors.

    Upon reading the github page for the proot-distro, it appears they have their own methods built in for backup which I think is due to the fact that proot shares the kernel with our android device that we are running it on, therefore it inherits all selinux / other security parameters, thus creating the symlinks. Not sure? Maybe someone can explain this part better


    Backup:
    1.PNG


    and here is how to restore:
    2.PNG


    This is just a knowledge dump for now. Waiting on phone to charge more and will start with the ubuntu machine and see if it can be backed up and restored as imagined.

    PS I think if I am reading the restore instructions correctly, it is saying if you already had an Ubuntu distro installed, if you were to "restore" using a backed up tar archive, that the archive will completely override the old machine's values fully with the backup's values. So there would be no need to uninstall the current distro if I am understanding correctly.

    --edit yes I understood correctly, but here is the missing part, you Must have an ubuntu distro installed in order to restore a backup. It doesn't have to be populated with anything, just simply proot-distro install ubuntu must be ran prior to the restore command if you didn't already have ubuntu installed.

    I looked at the source code for the ubuntu modded machine and it helped to illustrate how this all works, maybe looking at it will help you too?
    Code:
    #!/bin/bash
    
    R="$(printf '\033[1;31m')"
    G="$(printf '\033[1;32m')"
    Y="$(printf '\033[1;33m')"
    B="$(printf '\033[1;34m')"
    C="$(printf '\033[1;36m')"
    W="$(printf '\033[1;37m')"
    
    CURR_DIR=$(realpath "$(dirname "$BASH_SOURCE")")
    UBUNTU_DIR="$PREFIX/var/lib/proot-distro/installed-rootfs/ubuntu"
    
    banner() {
        clear
        cat <<- EOF
            ${Y}    _  _ ___  _  _ _  _ ___ _  _    _  _ ____ ___
            ${C}    |  | |__] |  | |\ |  |  |  |    |\/| |  | |  \
            ${G}    |__| |__] |__| | \|  |  |__|    |  | |__| |__/
    
        EOF
        echo -e "${G}     A modded gui version of ubuntu for Termux\n\n"${W}
    }
    
    package() {
        banner
        echo -e "${R} [${W}-${R}]${C} Checking required packages..."${W}
     
        [ ! -d '/data/data/com.termux/files/home/storage' ] && echo -e "${R} [${W}-${R}]${C} Setting up Storage.."${W} && termux-setup-storage
    
        if [[ $(command -v pulseaudio) && $(command -v proot-distro) ]]; then
            echo -e "\n${R} [${W}-${R}]${G} Packages already installed."${W}
        else
            yes | pkg upgrade
            packs=(pulseaudio proot-distro)
            for x in "${packs[@]}"; do
                type -p "$x" &>/dev/null || {
                    echo -e "\n${R} [${W}-${R}]${G} Installing package : ${Y}$x${C}"${W}
                    yes | pkg install "$x"
                }
            done
        fi
    }
    
    distro() {
        echo -e "\n${R} [${W}-${R}]${C} Checking for Distro..."${W}
        termux-reload-settings
     
        if [[ -d "$UBUNTU_DIR" ]]; then
            echo -e "\n${R} [${W}-${R}]${G} Distro already installed."${W}
            exit 0
        else
            proot-distro install ubuntu
            termux-reload-settings
        fi
     
        if [[ -d "$UBUNTU_DIR" ]]; then
            echo -e "\n${R} [${W}-${R}]${G} Installed Successfully !!"${W}
        else
            echo -e "\n${R} [${W}-${R}]${G} Error Installing Distro !\n"${W}
            exit 0
        fi
    }
    
    sound() {
        echo -e "\n${R} [${W}-${R}]${C} Fixing Sound Problem..."${W}
        [ ! -e "$HOME/.sound" ] && touch "$HOME/.sound"
        echo "pulseaudio --start --exit-idle-time=-1" >> "$HOME/.sound"
        echo "pacmd load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" >> "$HOME/.sound"
    }
    
    downloader(){
        path="$1"
        [ -e "$path" ] && rm -rf "$path"
        echo "Downloading $(basename $1)..."
        curl --progress-bar --insecure --fail \
             --retry-connrefused --retry 3 --retry-delay 2 \
              --location --output ${path} "$2"
        echo
    }
    
    setup_vnc() {
        if [[ -d "$CURR_DIR/distro" ]] && [[ -e "$CURR_DIR/distro/vncstart" ]]; then
            cp -f "$CURR_DIR/distro/vncstart" "$UBUNTU_DIR/usr/local/bin/vncstart"
        else
            downloader "$CURR_DIR/vncstart" "https://raw.githubusercontent.com/modded-ubuntu/modded-ubuntu/master/distro/vncstart"
            mv -f "$CURR_DIR/vncstart" "$UBUNTU_DIR/usr/local/bin/vncstart"
        fi
    
        if [[ -d "$CURR_DIR/distro" ]] && [[ -e "$CURR_DIR/distro/vncstop" ]]; then
            cp -f "$CURR_DIR/distro/vncstop" "$UBUNTU_DIR/usr/local/bin/vncstop"
        else
            downloader "$CURR_DIR/vncstop" "https://raw.githubusercontent.com/modded-ubuntu/modded-ubuntu/master/distro/vncstop"
            mv -f "$CURR_DIR/vncstop" "$UBUNTU_DIR/usr/local/bin/vncstop"
        fi
        chmod +x "$UBUNTU_DIR/usr/local/bin/vncstart"
        chmod +x "$UBUNTU_DIR/usr/local/bin/vncstop"
    }
    
    permission() {
        banner
        echo -e "${R} [${W}-${R}]${C} Setting up Environment..."${W}
    
        if [[ -d "$CURR_DIR/distro" ]] && [[ -e "$CURR_DIR/distro/user.sh" ]]; then
            cp -f "$CURR_DIR/distro/user.sh" "$UBUNTU_DIR/root/user.sh"
        else
            downloader "$CURR_DIR/user.sh" "https://raw.githubusercontent.com/modded-ubuntu/modded-ubuntu/master/distro/user.sh"
            mv -f "$CURR_DIR/user.sh" "$UBUNTU_DIR/root/user.sh"
        fi
        chmod +x $UBUNTU_DIR/root/user.sh
    
        setup_vnc
        echo "$(getprop persist.sys.timezone)" > $UBUNTU_DIR/etc/timezone
        echo "proot-distro login ubuntu" > $PREFIX/bin/ubuntu
        chmod +x "$PREFIX/bin/ubuntu"
        termux-reload-settings
    
        if [[ -e "$PREFIX/bin/ubuntu" ]]; then
            banner
            cat <<- EOF
                ${R} [${W}-${R}]${G} Ubuntu-22.04 (CLI) is now Installed on your Termux
                ${R} [${W}-${R}]${G} Restart your Termux to Prevent Some Issues.
                ${R} [${W}-${R}]${G} Type ${C}ubuntu${G} to run Ubuntu CLI.
                ${R} [${W}-${R}]${G} If you Want to Use UBUNTU in GUI MODE then ,
                ${R} [${W}-${R}]${G} Run ${C}ubuntu${G} first & then type ${C}bash user.sh${W}
            EOF
            { echo; sleep 2; exit 1; }
        else
            echo -e "\n${R} [${W}-${R}]${G} Error Installing Distro !"${W}
            exit 0
        fi
    
    }
    
    package
    distro
    sound
    permission

    👾👾👾👾
    1
    How to backup your machine:
    Code:
    proot-distro backup --output ubuntu-backup.tar.gz ubuntu
    You can change the distro name "ubuntu" to whichever one you are trying to backup. This is just an example

    How to pull the backup from your phone:
    Code:
    termux-setup-storage
    cp ubuntu-backup.tar.gz storage/downloads
    adb pull sdcard/Download/ubuntu-backup.tar.gz

    1.png



    1680091382758.png


    The ubuntu premade is 800mb zipped.
  • 4
    Update: A new thread is created to house "premade" virtual machines
    https://forum.xda-developers.com/t/prebuilt-arm-virtual-machines-for-termux.4570275/

    This machine seems to be working fine out of the box
    This machine runs amazing once you do all the troubleshooting steps included in the comments
    This one can really use some work, maybe someone can figure out what is wrong with it
    You can do the same for win11, get the image off archive.org but it wont work well unless your phone supports KVM or you have a work around
    As an edit and an update, the method listed below uses x86_64 version of qemu which will not run well on our phones. This guide also uses an android emulator to teach basics of building a virtual machine in qemu, but in practice on a phone it will be much different, when we use an Arm version of qemu. I am leaving this guide up though as it was fundamental in helping myself personally to even begin to understand qemu and the architectures and how to use the code.

    This guide uses a modded nox android emulator which can be found HERE

    Hello Friends~!

    Today I will be walking you through using Termux, QEMU, and a VNC server to Run Windows or Linux isos on Your Android Devices as well as Android Emulators like Nox on Windows 10.
    DOWNLOAD TERMU:

    Paste your iso and termu's apps in Barenox/bin, then install them in Nox.
    1.PNG

    Then install the apks by using the apk button on nox
    2.PNG
    BUILDING QEMU

    In Termux, type:

    Code:
    pkg install x11-repo
    apt-get upgrade -y
    pkg install qemu-utils -y
    pkg install qemu-system-x86-64-headless -y

    BUILDING THE VIRTUAL MACHINE'S ENVIRONMENT

    In Termux, type:

    Code:
    mkdir win7
    cd win7
    qemu-img create -f qcow2 win7.img 100G

    A note here is that the name or command "win7" can be any iso you want to install.

    For instance, you have an Ubuntu iso you want to install, use:

    Code:
    mkdir ubuntu
    cd ubuntu
    qemu-img create -f qcow2 ubuntu.img 100G

    Then change the name of your iso to "ubuntu.iso" and so forth

    100G can be edited as well. If you are worried about hard drive space, no need.

    It is saved in qemu's take on sparse image format, "qcow2 files" (QEMU Copy On Write) thus only taking up space as you use it.

    USING ADB TO PUSH THE ISO

    In Barenox/bin

    Open command prompt from the toolbar and run:

    Code:
    adb push win7.iso /data/data/com.termux/files/home/win7

    Take note that /data/data/com.termux/... etc is where termux stores everything
    4.PNG
    5.PNG
    BUILDING THE VIRTUAL MACHINE

    In termux type:

    Code:
    qemu-system-x86_64 -smp 2 -net nic -net user -device AC97 -m 2048 -vnc 127.0.0.1:7 -cdrom win7.iso -hda win7.img

    Take note that the port of "7" after our local server ip of 127.0.0.1 can be edited. I set this to 7 since this is windows 7

    This is in reference to the "5900" port number asked for with VNC.

    Install your vnc app. I used "vnc viewer"

    The server ip will be 127.0.0.1 if asked and the port is 5907

    or

    127.0.0.1:5907
    7.PNG
    8.PNG

    tadah~!
    9.PNG
    RUNNING THE MACHINE LATER

    In termux

    Code:
    cd win7
    qemu-system-x86_64 -smp 2 -net nic -net user -device AC97 -m 2048 -vnc 127.0.0.1:7 -hda win7.img

    Then reopen the VNC App

    These steps have all been automated, see the EXECUTABLE SCRIPTS section

    IF YOU LEARN BETTER VISUALLY HERE IS A VIDEO OF THE STEPS

    Termux Direct Apk DL:
    VNC:
    This Guide Helped Me Get Started:
    This Guide Helped Me To Understand How To "Run a Batch" in Linux (.sh)
    What is a VNC?
    Helped Me To Reprogram Parameters
    ## Development
    Urs Wolfer started QtEmu as school project. Ben Klopfenstein began adding some features that he wanted.
    And in 2009 the project stoped its development.

    In 2017 Sergio Carlavilla started from scrach the development of the 2.0 version. The new UI has based on
    VirtualBox OSE and Virt-manager.
    original repo
    Android On Windows, With Windows~!
    2
    Working Ubuntu ARM 64 for Termux with GUI
    SOURCE:

    Code:
    pkg install x11-repo
    pkg update
    pkg install git wget -y
    git clone --depth=1 https://github.com/modded-ubuntu/modded-ubuntu.git
    cd modded-ubuntu
    bash setup.sh

    1678963103823.png

    This will start the script and it will install Ubuntu for us.

    1678963225405.png

    When the setup script is done, it will ask you to restart Termux. Then run the user script.

    1678963406830.png

    So force stop Termux in settings and reopen it. Run this code:
    Code:
    ubuntu
    bash user.sh

    1678963598635.png

    When you get here make sure to use an all lowercase name, don't use numbers it will mess things up

    When you are done, force close and restart termux as we did before, then run this code:
    Code:
    ubuntu
    sudo bash gui.sh

    This will take about 30mins to an hour to complete. When it is done you will have a working modded Ubuntu Arm 64 machine running in Termux with a GUI.

    Type vncstart then use the VNC APP of your choice, I used Nethunter Kex.

    WHAT IT LOOKS LIKE:
    Screenshot_20230316-055207.png
    Screenshot_20230316-055216.png
    Screenshot_20230316-055153.png
    If you encounter any interesting Termux scripts in your travels, please do share!
    2
    UPDATE:
    Finally got Windows 10 arm to load in termux, using qemu and an insider image. So what was going wrong before was I was being dumb and adding too much ram to the machine and that would force close termux at a certain point in the boot. (so keep in mind you can change the ram values but if it is too much it will just crash termux)

    Now it will run like a potato unless you have kvm, but it works. This is using a modified efi driver and a premade win10 arm image from archive.org (an old windows 10 arm insider image)

    Code:
    qemu-system-aarch64 -m 2048M -smp 8 -device VGA -M virt -cpu max -monitor stdio -device nec-usb-xhci -device usb-kbd -device usb-mouse -usb -bios QEMU_EFI.img -vnc :3 -hda windows10arm64.qcow2 -accel tcg,thread=multi

    1.png
    2.png
    3.png
    1
    Looks great, will give it a try later. Thanks for the time & effort! 🤙🏽
    1
    How to backup your machine:
    Code:
    proot-distro backup --output ubuntu-backup.tar.gz ubuntu
    You can change the distro name "ubuntu" to whichever one you are trying to backup. This is just an example

    How to pull the backup from your phone:
    Code:
    termux-setup-storage
    cp ubuntu-backup.tar.gz storage/downloads
    adb pull sdcard/Download/ubuntu-backup.tar.gz

    1.png



    1680091382758.png


    The ubuntu premade is 800mb zipped.