-
Notifications
You must be signed in to change notification settings - Fork 14
2) Tutorials
This tutorial is for those who don't want to do any manual configuration, just a simple isolated chroot container. Take a look at the options for ChArch with mkarch -h
if you'd like to try more advanced configurations.
Let's start!
-
First, find the rootfs tarball of your choice for your desired distro. For this example, we will be using the ARM Arch Linux rootfs tarball from the official mirrors.
-
With root permissions, type
mkarch -u <url>
. For an aarch64 device, the command would look likemkarch -u "http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz"
. This will fetch the latest rootfs tarball from Arch Linux directly and automatically configure it. If you have a custom rootfs tarball that you want to use, but don't want to specify a URL tomkarch
, you can specify a tarball path. Typemkarch -t <path> <name>
to create a rootfs instance calledname
that will use your custom tarball path. If all goes well, you should be logged in as root in your Arch Linux instance. Note that on your next login, you will not need the-n
or-u
options, as your rootfs instance has already been created. If you get an error, head over to issues and provide a log to find help on fixing the bug.
NOTE: For distributions that use pacman (Arch Linux), additional configuration is required. Edit /etc/pacman.conf, and comment out the line that says CheckSpace
. Also, make sure to run pacman-key --init && pacman-key --populate
.
- The first thing you may want to do is update your packages. Type
pacman -Syu
and confirm your upgrades. If you are using the bootstrap rootfs tarball, this may not work as your pacman repositories are not setup. You will need to configure this manually. - Once you are finished in your Arch Linux instance, type
exit
to return to your host terminal.
To remove a rootfs instance, simply type rmarch
. If you want to specify a rootfs name, use rmarch <name>
. To remove just the rootfs tarball, use rmarch -t
. To remove your entire chroot container folder, type rmarch -a
.
Once you create your rootfs instance, enter it using the charch
command. Type charch -h
to view additional arguments that can be supplied.
If your image is already extracted, or you'd like to sideload a premade rootfs, you can follow these steps.
- Navigate to your chroot container of choice. The default is
~/charch
for Linux (root home) and/data/unencrypted/charch/
for Android. - Copy your extracted rootfs here (the final folder could look like
~/charch/custom/
). - You can directly enter the rootfs using
charch <foldername>
(the command could look likecharch custom
).
Some power users may prefer to keep their ChArch folder on a MicroSD card or a USB OTG flash drive. There are a few steps we need to take.
- First we need to figure out which device our external drive is on. With your drive unplugged, type
blkid
as root. Then plug in your drive, and type it again. You should see a new entry show up at the very bottom. It might look something like/dev/block/sda
, or maybe/dev/block/sdg
. Keep this path in your memory for later. - For chroot to work, your drive must be formatted as a UNIX compatible filesystem. The most popular choices are
ext4
andf2fs
. If your device kernel supportsf2fs
, I'd suggest using it since it is optimized for flash storage. However, if you are in need of compatibility (i.e. using this ChArch external drive on older devices), I'd suggestext4
, as all Android devices support it. Typemkfs.ext4 -f /dev/block/***
, where***
is specific to your device. Replacemkfs.ext4
withmkfs.f2fs
if you chose to usef2fs
instead ofext4
. - Now, we need to mount the drive. Type
mount /dev/block/*** /mnt
, replacing***
with the device specific hardware ID (obviously). - Time to create your ChArch directory! Type
mkarch -d /mnt -u <url>
, similar to the steps in the tutorial. Note the-d /mnt
, where/mnt
is the path to your mounted external drive. ChArch commands will need a-d
option if you want it to execute them with respect to an external drive. - To unmount your external drive completely, we need to unmount it from the
/mnt
folder. Typeumount /mnt
.