In rural areas, everything is relative.
To put it short, I'm tired of making a small breakthrough in the countryside.
I should have relaxed and read a lot of things involving natural language processing. However, when I have been modifying LXC and chroot these days, I decided to upgrade my Android phone (also called my pocket server) to Ubuntu13.04.
(If you miss this position, I will use the Complete Linux Installer to run a server sandbox to turn off an old Xperia Arc S, although it is good enough for me to run an instance on this website-except for more .)
The steps from version 12.10 to version 12.04 are detailed, but the images provided by the complete Linux installation program are all created with armel, and 13. Version 04 has been transferred to the dedicated armhf-so I confirmed that my Xperia can run the armhf binary file viamultiarch (here, by the way, I did something fast ), I decided to create a new image again.
Unfortunately, there is very little information about how to execute it. Apart from some scattered Forum posts, I decided to record this process. All of this is quite simple. What you are using is that the complete Linux-installed application already has a handy box In Ubuntu (I dare say it can be done simply on the mobile phone itself ).
First, you can use Intel machines to obtain this more general situation. You need to set QEMU and ARM binary and asdebootstrap support:
Sudo apt-get install debootstrap qemu-user-static qemu-system git \
Gcc-arm-linux-gnueabihf binfmt-support
Now, create the file system itself (which is a 2 GB image) and mount it to the/mnt directory. Since we don't need all the bells and whistle ofext3/ext4 (after all, the final result will be run in the file), we will build everything inside anext2filesystem:
Dd if =/dev/zero of = ubuntu. img bs = 1024 count = 2097152
Mkfs. ext2 ubuntu-armhf.ext2.img
Sudo mount-o loop Co., ubuntu-armhf.ext2.img/mnt
Next, debootstrap is used to deploy the basic environment (the main settings are provided here ):
HOSTNAME = ubuntu-armhf sudo debootstrap -- variant = minbase -- foreign \
-- Arch armhf raring/mnt
Now deploy qemu-arm-static:
Sudo cp/usr/bin/qemu-arm-static/mnt/usr/bin/
Use it to complete the remaining deployment:
LANG = C sudo chroot mnt/usr/bin/qemu-arm-static-cpu cortex-a9/bin/bash
./Debootstrap -- second-stage
Once the above work is completed, we need to install the apt source. (You can also choose to install deb-src, but I do not need it now ):
Echo "deb http://ports.ubuntu.com raring main restricted universe">/etc/apt/sources. list
Apt-key adv -- keyserver keyserver.ubuntu.com -- recv-keys 428D7C01
Then you can install some necessary tools (I think these are necessary ):
(Note: wget and vim can be understood as required. How can golang and git-core be required ?)
Apt-get update
Apt-get install sudo apt-utils dialog less wget vim net-tools openssh-server \
Htop tmux build-essential libevent-dev python-setuptools \
Python-lxml sqlite3 nodejs npm golang git-core
If your mobile phone has enough power, you can also install the VNC service (and a mini X11 setting ):
Apt-get install -- no-install-recommends tightvncserver
You may need to run QEMU, so you should install several more terminals, although this is not required by Android chroot:
Cp/etc/init/tty1.conf/etc/init/ttyAMA0.conf
Sed-I "s/tty1/ttyAMA0/"/etc/init/ttyAMA0.conf
This is not complete yet. You also need a user with sudo permissions:
Adduser ubuntu
Usermod-aG sudo ubuntu
Restart your chroot device:
Exit
Now we have made the following adjustments to the installed Linux. Copy the init. sh script to/root/init. sh to make sure it is executable. Add the mount points on the upper and lower layers:
Sudo cp init. sh/mnt/root/init. sh
Sudo chmod + x/mnt/root/init. sh
Sudo rm/mnt/usr/bin/qemu-arm-static
Sudo mkdir/mnt/sdcard
Sudo mkdir/dev/shm
Sudo umount/mnt
Copy the image to the location of the Ubuntu image on your SD card and replace it with the original one. (If you want to save the Ubuntu image, it will be approximately 400 MB after compression ).
I have tried to run ipvs-disable TCP and UNIX sockets so that it will not be confused with network settings.
- In fact, this is much more common than you think-I used to run an Intel chroot simulation device in a Mac mini PowerPC and forgot to do this.
- Note that the Complete Linux Installer script emphasizes adding users to the admin user group, but this group does not exist on Ubuntu.
- I actually made some changes to the actual usage, because I need the/dev/shmto working directory. And I want them to put the document configuration files somewhere-I also want custom file loading to run without moving them into the script.