[ ] ArchLinux ARM Android chroot |
wget http://mirror.yandex.ru/archlinux-arm/os/ArchLinuxARM-armv7-latest.tar.gz
mv ArchLinuxARM-armv7-latest.tar.gz ArchLinuxARM.tar.gz
adb push ArchLinuxARM.tar.gz /sdcard/
cd sdcard
make_ext4fs -l 3221225472 arch.img
mount -o rw,remount /
mkdir /arch
busybox mount /sdcard/arch.img /arch
tar -xvf ArchLinuxARM.tar.gz -C /arch/
busybox mount -t proc none /arch/proc
busybox mount -o rbind /dev /arch/dev
busybox mount -t tmpfs none /arch/tmp
busybox mount -o size=10%,mode=0755 -t tmpfs none /arch/run
chroot /arch /bin/bash
ping 8.8.8.8
socket: Permission denied
uid=2000(shell) gid=2000(shell) groups=1003(graphics),1004(input),1007(log),1009(mount),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats)
groupadd -g 3003 inet
usermod -a -G inet root
su root
ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=59 time=89.6 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=59 time=88.6 ms
rm /etc/resolv.conf
echo "nameserver 8.8.8.8" > /etc/resolv.conf
pacman -S gcc htop iotop sudo openssh
cd /root
nano main.cpp
#include
int main() {
std::cout << "Hello World!\n";
return 0;
}
g++ main.cpp
./a.out
ls /etc/ > /sdcard/ls.txt
ls /arch/etc/ > /sdcard/ls2.txt
busybox grep -F -f /sdcard/ls.txt /sdcard/ls2.txt
dhcpcd.conf
hosts
security
cp -Ra /etc/* /arch/etc/
cp -a /sbin/adbd /arch/usr/bin/
passwd
mv /usr/bin/su /usr/bin/su.r
mkdir /lib
mkdir /bin
mkdir /xbin
mkdir /opt
mkdir /usr
mkdir /home
mkdir /run
mkdir /srv
mkdir /tmp
mkdir /var
busybox mount --bind /arch/etc /etc
busybox mount --bind /arch/opt /opt
busybox mount --bind /arch/home /home
busybox mount -o size=10%,mode=0755 -t tmpfs none /run
busybox mount --bind /arch/srv /srv
busybox mount -t tmpfs none /tmp
busybox mount --bind /arch/sbin /sbin
busybox mount --bind /arch/usr/ /usr
busybox mount --bind /arch/var/ /var
busybox mount --bind /arch/lib/ /lib
busybox mount --bind /arch/usr/bin/ /bin
/bin/bash