Introduction to PXE Booting Android-x86 with iPXE
Preboot Execution Environment (PXE) allows a client device to boot an operating system over a network, without needing local storage. When combined with iPXE, a powerful open-source boot firmware, you gain immense flexibility, enabling advanced boot scenarios like HTTP booting and scripting. This guide will walk you through setting up a comprehensive PXE server to boot Android-x86, transforming your client machines into diskless Android workstations or thin clients.
PXE booting Android-x86 is particularly useful for:
- Centralized management and rapid deployment of Android-x86 instances.
- Creating diskless Android terminals for kiosk mode or specific applications.
- Testing Android-x86 versions without modifying local storage.
- Utilizing older hardware as dedicated Android devices.
Prerequisites
Before we begin, ensure you have the following:
- A Linux server (Ubuntu/Debian recommended) to host DHCP, TFTP, and HTTP services.
- Root/sudo access on the server.
- An Android-x86 ISO image (e.g., android-x86_64-9.0-r2.iso).
- A client machine with a network card capable of PXE booting, and PXE enabled in its BIOS/UEFI settings.
- Basic understanding of networking and Linux command line.
Step 1: Prepare Your Android-x86 Image Files
First, download your desired Android-x86 ISO image. We need to extract the core boot files and the system image.
mkdir -p /srv/android-x86mount -o loop android-x86_64-9.0-r2.iso /mntcp -r /mnt/* /srv/android-x86/umount /mnt
Navigate to /srv/android-x86. You should find directories like boot, efi, isolinux, and crucial files like kernel, initrd.img, and system.sfs. The system.sfs is the compressed system image. For persistent data, you might also want to create a data.img.
dd if=/dev/zero of=/srv/android-x86/data.img bs=1M count=2048 # 2GB data image for persistencemkfs.ext4 /srv/android-x86/data.img
Step 2: Configure DHCP Server for iPXE Chainloading
The DHCP server will assign IP addresses and tell clients to fetch the iPXE bootloader.
sudo apt update sudo apt install isc-dhcp-server
Edit the DHCP configuration file, typically located at /etc/dhcp/dhcpd.conf. Adjust the subnet, range, and gateway to match your network. The key is to specify the iPXE bootloader (undionly.kpxe) as the `filename` for PXE clients.
# /etc/dhcp/dhcpd.confoption domain-name-servers 8.8.8.8, 8.8.4.4;default-lease-time 600;max-lease-time 7200;ddns-update-style none;log-facility local7;subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.100 192.168.1.200; option routers 192.168.1.1; # TFTP server IP next-server 192.168.1.10; # Replace with your server's IP # Chainload iPXE filename "undionly.kpxe";}
Restart the DHCP service:
sudo systemctl restart isc-dhcp-server
Step 3: Set Up TFTP Server and iPXE Bootloader
The TFTP server is responsible for serving the initial iPXE bootloader to the client.
sudo apt install tftpd-hpa
Edit the TFTP server configuration at /etc/default/tftpd-hpa:
# /etc/default/tftpd-hpARUN_DAEMON="yes"OPTIONS="-l -s /srv/tftp"
Create the TFTP root directory and download the iPXE bootloader:
sudo mkdir -p /srv/tftpwget -O /srv/tftp/undionly.kpxe https://boot.ipxe.org/undionly.kpxe
Restart the TFTP service:
sudo systemctl restart tftpd-hpa
Step 4: Set Up HTTP Server to Serve Android-x86 Files
iPXE can load files via HTTP, which is generally faster and more reliable than TFTP. We’ll use Nginx.
sudo apt install nginx
Create a dedicated directory for your Android-x86 files within your web server’s root and copy the prepared Android-x86 files there.
sudo mkdir -p /var/www/html/android-x86sudo cp -r /srv/android-x86/* /var/www/html/android-x86/sudo chown -R www-data:www-data /var/www/html/android-x86/
Ensure Nginx is running and serving this directory. The default Nginx configuration usually serves /var/www/html, so simply placing the files there is often sufficient. Verify by accessing http://YOUR_SERVER_IP/android-x86/kernel in a web browser.
sudo systemctl restart nginx
Step 5: Create the iPXE Boot Script
This script tells iPXE how to load and boot Android-x86. Create a file named android.ipxe in your TFTP root directory (/srv/tftp).
# /srv/tftp/android.ipxe#!ipxeecho "Booting Android-x86 via HTTP..."set android_path http://192.168.1.10/android-x86/ # Replace with your HTTP server's IP and pathkernel ${android_path}kernel quiet root=/dev/ram0 androidboot.selinux=permissive buildvariant=userdebug DATA=${android_path}data.img SRC=${android_path}initrd ${android_path}initrd.imgboot
Let’s break down the crucial kernel parameters:
androidboot.selinux=permissive: Often necessary for PXE boots to avoid SELinux policy issues.buildvariant=userdebug: Can help with some boot environments.DATA=${android_path}data.img: Specifies the path to your data image for persistence. If you don’t usedata.img, omit this or point it to a non-existent path for a fresh start.SRC=${android_path}: Crucially tells Android-x86 where to find its system files (likesystem.sfs). This points to the base directory on the HTTP server.
Now, we need to instruct iPXE to load this script. We do this by embedding a small iPXE script into undionly.kpxe or, more simply, by changing the `filename` in DHCP to point directly to `android.ipxe` if `undionly.kpxe` supports it (it usually does if built with HTTP support). However, a more robust way is to serve a second iPXE script. For simplicity, we’ll tell `undionly.kpxe` to load our script.
We can compile a custom iPXE image, but a quicker method is to create a second iPXE script and chainload it. Change your DHCP filename from undionly.kpxe to `boot.ipxe` and create `boot.ipxe`:
# /srv/tftp/boot.ipxe#!ipxechain --autofree http://192.168.1.10/android.ipxe
Then ensure your Nginx serves `android.ipxe` from `/var/www/html`. Place `android.ipxe` there as well:
sudo cp /srv/tftp/android.ipxe /var/www/html/
And update your DHCP `filename` to point to `undionly.kpxe` again, but `undionly.kpxe` needs to know to load `boot.ipxe`. The easiest is to use `undionly.kpxe` as `filename` and directly embed the chainload command into `undionly.kpxe` or use an iPXE build that automatically looks for `default.ipxe`. For this guide, we’ll keep `filename
Android Mobile Specs & Compare Directory
Are you researching mobile hardware properties, processor SoCs, GPU chipsets, or RAM configurations? Access our complete specs catalog to compare up to 5 devices side-by-side!
Compare Devices Specs →