A simple RootFS builder for many distros
- install instruction set's dependant packages :
aria2(1.25.0>=)
fastboot
adb
- you can find manjaro arm downloads at this link. choose the edition you prefer. in this quide , I will be using
kde-plasma
with version20.02
found at this link.
[WARN] do not choose emmc installer , choose the other image. e.g.
Manjaro-ARM-kde-plasma-pbpro-20.02.img.xz
the following snippet uses aria2
to quickly download it and save it as manjaro.img.xz
under /tmp
directory
export manjaro_out_name="manjaro"; \
export manjaro_dir="/tmp"; \
export manjaro_url="https://osdn.net/projects/manjaro-arm/storage/pbpro/kde-plasma/20.02/Manjaro-ARM-kde-plasma-pbpro-20.02.img.xz"; \
aria2c -c \
-j16 \
-x16 \
-k 1M \
--out="${manjaro_out_name}.img.xz" \
--dir="$manjaro_dir" \
"$manjaro_url"; \
unset manjaro_url;
- extract the downloaded image
unxz "${manjaro_dir}/${manjaro_out_name}.img.xz"
-
we need to calculate offeset to mount the image. use
fdisk -l
to probe images information. you would needsector size
andboot start
values. starting offset for mount is equal to(boot start) x (sector size)
-
you can use the following snippet to get sector size
fdisk -l "${manjaro_dir}/${manjaro_out_name}.img" | grep -Po '(?<= \= )[^ bytes]+'
- you can use the following snippet to get boot start
fdisk -l "${manjaro_dir}/${manjaro_out_name}.img" | grep -v 'sectors' | grep "${manjaro_dir}/${manjaro_out_name}" | tr -s ' ' | cut -d ' ' -f2
- mount the image based on calculated offset
export offset="32000000"; \
sudo mkdir -p "/mnt/${manjaro_out_name}"; \
sudo mount -o loop,offset="${offset}" "${manjaro_dir}/${manjaro_out_name}.img" "/mnt/${manjaro_out_name}";
unset offset;
- change directory and archive whatever was inside the mounted directory
[WARN] make sure symlinks are preserved after archiving
pushd "/mnt/${manjaro_out_name}"; \
sudo tar -zcvf "/tmp/${manjaro_out_name}.tar.gz" . ; \
popd; \
sudo umount /mnt/${manjaro_out_name}; \
sudo rm -rf /mnt/${manjaro_out_name}; \
rm "/tmp/${manjaro_out_name}.img"; \
sudo chown "$UID" "/tmp/${manjaro_out_name}.tar.gz";
Enable USB debugging
andOEM Unlock
on your pixel c device.- exit
pixel-c
container if your shell is still in it. you can use the following snippet - download
twrp recovery
from this link. - boot twrp recovery by running the following snippet
fastboot boot twrp.img
- wipe you
/data/
partition. in twrp recovery, there is awipe
option. go there andfactory reset
device - mount
/data/
and/cache/
in twrp - download
busybox
static build for armv8 just in case busybox in twrp has any issue. as an example , the following snippet downloadsbusybox 1.31.0
export busybox_version=1.31.0; \
export busybox_url="https://busybox.net/downloads/binaries/${busybox_version}-defconfig-multiarch-musl/busybox-armv8l"; \
aria2c -c \
-j16 \
-x16 \
-k 1M \
--out="busybox" \
--dir="$manjaro_dir" \
"$busybox_url"; \
unset busybox_url;unset busybox_version
- move
busybox
to/cache/
and generated rootfs to/data/
your device and then useadb shell
to get a shell into your pixel c . you can use the following snippet
export rootfs="arch_rootfs.tar.gz"; \
adb push "/tmp/${manjaro_out_name}.tar.gz" /data/ && \
adb push /tmp/busybox /cache/ && \
adb shell
- run the follwing in adb shell ( on your device ) to extract rootfs
rootfs="arch_rootfs.tar.gz"; \
chmod +x /cache/busybox && \
cd /data && \
/cache/busybox tar xvf "$rootfs" && \
rm "$rootfs" && \
exit; \
unset rootfs;
- reboot to bootloader to flash boot image
adb reboot bootloader
- flash a signed boot image with fastboot. you can use the following snippet
export boot_image=boot.img; \
fastboot flash boot "$boot_image" ; \
unset boot_image;
- clean up env vars
unset manjaro_out_name;unset manjaro_dir;