├── otherfiles ├── systemd │ ├── user │ │ └── default.target.wants │ │ │ └── wys.service │ └── system │ │ ├── basic.target.wants │ │ └── first_time_setup.service │ │ └── first_time_setup.service ├── change-alarm ├── 81-blueman.rules ├── motd ├── mkinitcpio-hooks │ ├── resizerootfs-install │ └── resizerootfs-hooks ├── first_time_setup.sh ├── mkinitcpio.conf └── pacman.conf ├── presets ├── pinetab-sxmo.sh ├── pinephone-sxmo.sh ├── pinephone-pro-sxmo.sh ├── pinetab-barebone.sh ├── pinephone-barebone.sh ├── pinephone-pro-barebone.sh ├── pinetab-plasma.sh ├── pinetab-phosh.sh ├── pinephone-plasma.sh ├── pinephone-pro-plasma.sh ├── pinephone-phosh.sh └── pinephone-pro-phosh.sh ├── make_empty_image.sh ├── do_chroot.sh ├── make_image.sh ├── Makefile └── make_rootfs.sh /otherfiles/systemd/user/default.target.wants/wys.service: -------------------------------------------------------------------------------- 1 | ../wys.service -------------------------------------------------------------------------------- /otherfiles/systemd/system/basic.target.wants/first_time_setup.service: -------------------------------------------------------------------------------- 1 | ../first_time_setup.service -------------------------------------------------------------------------------- /otherfiles/change-alarm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Phosh doesn't accept letter passwords, yet. 4 | cat << EOF | passwd alarm 5 | 123456 6 | 123456 7 | 8 | EOF 9 | -------------------------------------------------------------------------------- /presets/pinetab-sxmo.sh: -------------------------------------------------------------------------------- 1 | PACKAGES_BASE="dosfstools curl xz iw rfkill netctl dialog wpa_supplicant pv networkmanager device-pine64-pinetab bootsplash-theme-danctnix v4l-utils sudo f2fs-tools zramswap danctnix-keyring" 2 | PACKAGES_UI="glibc-locales danctnix-sxmo-ui-meta sxmo-ui-sway-meta feh xorg-xcalc megapixels-lts" 3 | -------------------------------------------------------------------------------- /presets/pinephone-sxmo.sh: -------------------------------------------------------------------------------- 1 | PACKAGES_BASE="dosfstools curl xz iw rfkill netctl dialog wpa_supplicant pv networkmanager device-pine64-pinephone bootsplash-theme-danctnix v4l-utils sudo f2fs-tools zramswap danctnix-keyring" 2 | PACKAGES_UI="glibc-locales danctnix-sxmo-ui-meta sxmo-ui-sway-meta feh xorg-xcalc megapixels-lts" 3 | -------------------------------------------------------------------------------- /presets/pinephone-pro-sxmo.sh: -------------------------------------------------------------------------------- 1 | PACKAGES_BASE="dosfstools curl xz iw rfkill netctl dialog wpa_supplicant pv networkmanager device-pine64-pinephonepro bootsplash-theme-danctnix v4l-utils sudo f2fs-tools zramswap danctnix-keyring" 2 | PACKAGES_UI="glibc-locales danctnix-sxmo-ui-meta sxmo-ui-sway-meta feh xorg-xcalc megapixels-lts" 3 | -------------------------------------------------------------------------------- /presets/pinetab-barebone.sh: -------------------------------------------------------------------------------- 1 | PACKAGES_BASE="dosfstools curl xz iw rfkill netctl dialog wpa_supplicant pv networkmanager device-pine64-pinetab danctnix-usb-tethering dhcp sudo f2fs-tools zramswap danctnix-keyring" 2 | POST_INSTALL=" 3 | systemctl enable usb-tethering 4 | systemctl enable dhcpd4 5 | systemctl enable sshd 6 | " 7 | -------------------------------------------------------------------------------- /presets/pinephone-barebone.sh: -------------------------------------------------------------------------------- 1 | PACKAGES_BASE="dosfstools curl xz iw rfkill netctl dialog wpa_supplicant pv networkmanager device-pine64-pinephone danctnix-usb-tethering dhcp sudo f2fs-tools zramswap danctnix-keyring" 2 | POST_INSTALL=" 3 | systemctl enable usb-tethering 4 | systemctl enable dhcpd4 5 | systemctl enable sshd 6 | " 7 | -------------------------------------------------------------------------------- /presets/pinephone-pro-barebone.sh: -------------------------------------------------------------------------------- 1 | PACKAGES_BASE="dosfstools curl xz iw rfkill netctl dialog wpa_supplicant pv networkmanager device-pine64-pinephonepro danctnix-usb-tethering dhcp sudo f2fs-tools zramswap danctnix-keyring" 2 | POST_INSTALL=" 3 | systemctl enable usb-tethering 4 | systemctl enable dhcpd4 5 | systemctl enable sshd 6 | " 7 | -------------------------------------------------------------------------------- /otherfiles/systemd/system/first_time_setup.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=First Time Setup 3 | Before=basic.target getty.target shutdown.target 4 | Conflicts=shutdown.target 5 | DefaultDependencies=no 6 | 7 | [Service] 8 | Type=oneshot 9 | ExecStart=/usr/local/sbin/first_time_setup.sh 10 | StandardOutput=tty 11 | 12 | [Install] 13 | WantedBy=basic.target 14 | -------------------------------------------------------------------------------- /otherfiles/81-blueman.rules: -------------------------------------------------------------------------------- 1 | polkit.addRule(function(action, subject) { 2 | if (action.id == "org.blueman.rfkill.setstate" && subject.local && subject.active && subject.isInGroup("wheel")) { 3 | return polkit.Result.YES; 4 | } 5 | if (action.id == "org.blueman.network.setup" && subject.local && subject.active && subject.isInGroup("wheel")) { 6 | return polkit.Result.YES; 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /otherfiles/motd: -------------------------------------------------------------------------------- 1 | Welcome to Arch Linux ARM! 2 | 3 | This is unofficial ARM build maintained by Dreemurrs Embedded Labs. 4 | 5 | To make a issue/pull request to our repo: 6 | * Issues: https://github.com/dreemurrs-embedded/Pine64-Arch/issues 7 | * Pull Requests: https://github.com/dreemurrs-embedded/Pine64-Arch/pulls 8 | 9 | Support can be provided from our chat rooms: 10 | * Matrix: #archmobile:kde.org 11 | * Telegram: @archmobile 12 | 13 | -------------------------------------------------------------------------------- /otherfiles/mkinitcpio-hooks/resizerootfs-install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | build() { 4 | add_binary fdisk 5 | add_binary partx 6 | add_binary resize2fs 7 | 8 | add_binary fsck.f2fs 9 | add_symlink "/usr/bin/resize.f2fs" "fsck.f2fs" 10 | 11 | add_runscript 12 | } 13 | 14 | help() { 15 | cat <" 12 | exit 1 13 | fi 14 | 15 | if [ "$(id -u)" -ne "0" ]; then 16 | echo "This script requires root (not really - but make_image.sh will fail later without root)" 17 | exit 1 18 | fi 19 | 20 | fallocate -l $IMAGE_SIZE $IMAGE_NAME 21 | 22 | if [ "$IMAGE_PARTS" == "rockchip" ]; then 23 | 24 | cat << EOF | fdisk $IMAGE_NAME 25 | o 26 | n 27 | p 28 | 1 29 | 65535 30 | +128M 31 | t 32 | c 33 | n 34 | p 35 | 2 36 | 327680 37 | 38 | t 39 | 2 40 | 83 41 | a 42 | 1 43 | w 44 | EOF 45 | 46 | else 47 | 48 | cat << EOF | fdisk $IMAGE_NAME 49 | o 50 | n 51 | p 52 | 1 53 | 2048 54 | +128M 55 | t 56 | c 57 | n 58 | p 59 | 2 60 | 61 | 62 | t 63 | 2 64 | 83 65 | a 66 | 1 67 | w 68 | EOF 69 | 70 | fi 71 | -------------------------------------------------------------------------------- /do_chroot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | set -x 5 | 6 | if [ "$(id -u)" -ne "0" ]; then 7 | echo "This script requires root." 8 | exit 1 9 | fi 10 | 11 | cleanup() { 12 | if [ -e "$DEST/proc/cmdline" ]; then 13 | umount "$DEST/proc" 14 | fi 15 | if [ -d "$DEST/sys/kernel" ]; then 16 | umount "$DEST/sys" 17 | fi 18 | umount "$DEST/dev" || true 19 | umount "$DEST/tmp" || true 20 | } 21 | trap cleanup EXIT 22 | 23 | DEST=rootfs-20180912 24 | 25 | mount -o bind /tmp "$DEST/tmp" 26 | mount -o bind /dev "$DEST/dev" 27 | chroot "$DEST" mount -t proc proc /proc 28 | chroot "$DEST" mount -t sysfs sys /sys 29 | #chroot "$DEST" mv /etc/resolv.conf /etc/resolv.conf.dist 30 | cp /etc/resolv.conf $DEST/etc/resolv.conf 31 | chroot "$DEST" $@ 32 | #chroot "$DEST" mv /etc/resolv.conf.dist /etc/resolv.conf 33 | chroot "$DEST" umount /sys 34 | chroot "$DEST" umount /proc 35 | umount "$DEST/dev" 36 | umount "$DEST/tmp" 37 | -------------------------------------------------------------------------------- /otherfiles/mkinitcpio-hooks/resizerootfs-hooks: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ash 2 | 3 | run_hook() { 4 | if [ -e /sys/devices/platform/bootsplash.0/enabled ]; then 5 | echo 0 > /sys/devices/platform/bootsplash.0/enabled 6 | fi 7 | 8 | DEVICE=$(echo $root | sed 's/..$//') 9 | echo "The current storage device is $DEVICE" 10 | 11 | start=$(fdisk -l ${DEVICE} | grep ${DEVICE}p2 | sed 's/*//' | awk '{print $2}') 12 | echo "Rootfs start sector is $start" 13 | 14 | ROOTFS_FILESYSTYPE=$(fsck -N $root) 15 | 16 | case ${ROOTFS_FILESYSTYPE} in 17 | *fsck.f2fs*) FSRESIZER="/usr/sbin/resize.f2fs";; 18 | *fsck.ext*) FSRESIZER="/usr/sbin/resize2fs -f";; 19 | esac 20 | 21 | fdisk ${DEVICE} < /sys/devices/platform/bootsplash.0/enabled 38 | fi 39 | } 40 | 41 | # vim: set ft=sh ts=4 sw=4 et: 42 | -------------------------------------------------------------------------------- /make_image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -x 4 | set -e 5 | 6 | IMAGE_NAME="$1" 7 | TARBALL="$2" 8 | BOOTLOADER="$3" 9 | 10 | if [ -z "$IMAGE_NAME" ] || [ -z "$TARBALL" ] || [ -z "$BOOTLOADER" ]; then 11 | echo "Usage: $0 " 12 | exit 1 13 | fi 14 | 15 | if [ "$(id -u)" -ne "0" ]; then 16 | echo "This script requires root." 17 | exit 1 18 | fi 19 | 20 | echo "Attaching loop device" 21 | LOOP_DEVICE=$(losetup -f) 22 | losetup -P $LOOP_DEVICE $IMAGE_NAME 23 | 24 | echo "Creating filesystems" 25 | mkfs.vfat ${LOOP_DEVICE}p1 26 | mkfs.ext4 ${LOOP_DEVICE}p2 27 | 28 | TEMP_ROOT=$(mktemp -d) 29 | mkdir -p $TEMP_ROOT 30 | echo "Mounting rootfs" 31 | mount ${LOOP_DEVICE}p2 $TEMP_ROOT 32 | mkdir -p ${TEMP_ROOT}/boot 33 | mount ${LOOP_DEVICE}p1 ${TEMP_ROOT}/boot 34 | 35 | echo "Unpacking rootfs archive" 36 | bsdtar -xpf "$TARBALL" -C "$TEMP_ROOT" || true 37 | 38 | echo "Installing bootloader" 39 | if [ "${BOOTLOADER}" == "rockchip" ]; then 40 | dd if=$TEMP_ROOT/boot/idbloader.img of=${LOOP_DEVICE} seek=64 conv=notrunc,fsync 41 | dd if=$TEMP_ROOT/boot/u-boot.itb of=${LOOP_DEVICE} seek=16384 conv=notrunc,fsync 42 | else 43 | dd if=$TEMP_ROOT/boot/$BOOTLOADER of=${LOOP_DEVICE} bs=8k seek=1 44 | fi 45 | 46 | echo "Generating fstab" 47 | genfstab -U $TEMP_ROOT >> ${TEMP_ROOT}/etc/fstab 48 | cat ${TEMP_ROOT}/etc/fstab 49 | 50 | echo "Unmounting rootfs" 51 | umount -R $TEMP_ROOT 52 | rm -rf $TEMP_ROOT 53 | 54 | # Detach loop device 55 | losetup -d $LOOP_DEVICE 56 | -------------------------------------------------------------------------------- /otherfiles/first_time_setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2021 - Dreemurrs Embedded Labs 4 | 5 | # This is a first time boot script, it is supposed to self destruct after the script has finished. 6 | 7 | 8 | # IF YOU'RE MEGI THEN.. hey! I doubt you'll see this but if you do please keep in mind 9 | # that I have switched to offline resizing because of F2FS. 10 | 11 | # Please read the script carefully before removing it. 12 | 13 | # If you need anything else, please @ me on pinedev IRC/Matrix. 14 | 15 | if [ -e /sys/devices/platform/bootsplash.0/enabled ]; then 16 | echo 0 > /sys/devices/platform/bootsplash.0/enabled 17 | fi 18 | 19 | echo "THE FIRST BOOT SCRIPT IS NOW RUNNING, PLEASE WAIT." 20 | echo "ONCE IT'S DONE, YOU'LL BE BOOTED TO THE OPERATING SYSTEM." 21 | 22 | date +%Y%m%d -s "REPLACEDATE" # this is changed by the make_rootfs script 23 | 24 | # Initialize the pacman keyring 25 | pacman-key --init 26 | pacman-key --populate archlinuxarm danctnix 27 | 28 | # Remove the resize hook 29 | sed -i 's/resizerootfs//g' /etc/mkinitcpio.conf 30 | mkinitcpio -p linux-megi 31 | 32 | # Cleanup 33 | rm /usr/local/sbin/first_time_setup.sh 34 | rm /usr/lib/systemd/system/first_time_setup.service 35 | rm /usr/lib/systemd/system/basic.target.wants/first_time_setup.service 36 | rm /usr/lib/initcpio/hooks/resizerootfs 37 | rm /usr/lib/initcpio/install/resizerootfs 38 | 39 | 40 | if [ -e /sys/devices/platform/bootsplash.0/enabled ]; then 41 | echo 1 > /sys/devices/platform/bootsplash.0/enabled 42 | fi 43 | -------------------------------------------------------------------------------- /otherfiles/mkinitcpio.conf: -------------------------------------------------------------------------------- 1 | # vim:set ft=sh 2 | # MODULES 3 | # The following modules are loaded before any boot hooks are 4 | # run. Advanced users may wish to specify all system modules 5 | # in this array. For instance: 6 | # MODULES=(piix ide_disk reiserfs) 7 | MODULES=() 8 | 9 | # BINARIES 10 | # This setting includes any additional binaries a given user may 11 | # wish into the CPIO image. This is run last, so it may be used to 12 | # override the actual binaries included by a given hook 13 | # BINARIES are dependency parsed, so you may safely ignore libraries 14 | BINARIES=() 15 | 16 | # FILES 17 | # This setting is similar to BINARIES above, however, files are added 18 | # as-is and are not parsed in any way. This is useful for config files. 19 | FILES=() 20 | 21 | # HOOKS 22 | # This is the most important setting in this file. The HOOKS control the 23 | # modules and scripts added to the image, and what happens at boot time. 24 | # Order is important, and it is recommended that you do not change the 25 | # order in which HOOKS are added. Run 'mkinitcpio -H ' for 26 | # help on a given hook. 27 | # 'base' is _required_ unless you know precisely what you are doing. 28 | # 'udev' is _required_ in order to automatically load modules 29 | # 'filesystems' is _required_ unless you specify your fs modules in MODULES 30 | # Examples: 31 | ## This setup specifies all modules in the MODULES setting above. 32 | ## No raid, lvm2, or encrypted root is needed. 33 | # HOOKS=(base) 34 | # 35 | ## This setup will autodetect all modules for your system and should 36 | ## work as a sane default 37 | # HOOKS=(base udev autodetect block filesystems) 38 | # 39 | ## This setup will generate a 'full' image which supports most systems. 40 | ## No autodetection is done. 41 | # HOOKS=(base udev block filesystems) 42 | # 43 | ## This setup assembles a pata mdadm array with an encrypted root FS. 44 | ## Note: See 'mkinitcpio -H mdadm' for more information on raid devices. 45 | # HOOKS=(base udev block mdadm encrypt filesystems) 46 | # 47 | ## This setup loads an lvm2 volume group on a usb device. 48 | # HOOKS=(base udev block lvm2 filesystems) 49 | # 50 | ## NOTE: If you have /usr on a separate partition, you MUST include the 51 | # usr, fsck and shutdown hooks. 52 | HOOKS=(base udev autodetect modconf block filesystems keyboard resizerootfs fsck bootsplash-danctnix) 53 | 54 | # COMPRESSION 55 | # Use this to compress the initramfs image. By default, gzip compression 56 | # is used. Use 'cat' to create an uncompressed image. 57 | #COMPRESSION="gzip" 58 | #COMPRESSION="bzip2" 59 | #COMPRESSION="lzma" 60 | #COMPRESSION="xz" 61 | #COMPRESSION="lzop" 62 | #COMPRESSION="lz4" 63 | 64 | # COMPRESSION_OPTIONS 65 | # Additional options for the compressor 66 | #COMPRESSION_OPTIONS=() 67 | -------------------------------------------------------------------------------- /otherfiles/pacman.conf: -------------------------------------------------------------------------------- 1 | # 2 | # /etc/pacman.conf 3 | # 4 | # See the pacman.conf(5) manpage for option and repository directives 5 | 6 | # 7 | # GENERAL OPTIONS 8 | # 9 | [options] 10 | # The following paths are commented out with their default values listed. 11 | # If you wish to use different paths, uncomment and update the paths. 12 | #RootDir = / 13 | #DBPath = /var/lib/pacman/ 14 | #CacheDir = /var/cache/pacman/pkg/ 15 | #LogFile = /var/log/pacman.log 16 | #GPGDir = /etc/pacman.d/gnupg/ 17 | #HookDir = /etc/pacman.d/hooks/ 18 | HoldPkg = pacman glibc 19 | #XferCommand = /usr/bin/curl -L -C - -f -o %o %u 20 | #XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u 21 | #CleanMethod = KeepInstalled 22 | Architecture = aarch64 23 | 24 | # Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup 25 | #IgnorePkg = 26 | #IgnoreGroup = 27 | 28 | #NoUpgrade = 29 | #NoExtract = 30 | 31 | # Misc options 32 | #UseSyslog 33 | Color 34 | #TotalDownload 35 | #CheckSpace 36 | #VerbosePkgLists 37 | ParallelDownloads = 10 38 | 39 | # By default, pacman accepts packages signed by keys that its local keyring 40 | # trusts (see pacman-key and its man page), as well as unsigned packages. 41 | SigLevel = Required DatabaseOptional 42 | LocalFileSigLevel = Optional 43 | #RemoteFileSigLevel = Required 44 | 45 | # NOTE: You must run `pacman-key --init` before first using pacman; the local 46 | # keyring can then be populated with the keys of all official Arch Linux ARM 47 | # packagers with `pacman-key --populate archlinuxarm`. 48 | 49 | # 50 | # REPOSITORIES 51 | # - can be defined here or included from another file 52 | # - pacman will search repositories in the order defined here 53 | # - local/custom mirrors can be added here or in separate files 54 | # - repositories listed first will take precedence when packages 55 | # have identical names, regardless of version number 56 | # - URLs will have $repo replaced by the name of the current repo 57 | # - URLs will have $arch replaced by the name of the architecture 58 | # 59 | # Repository entries are of the format: 60 | # [repo-name] 61 | # Server = ServerName 62 | # Include = IncludePath 63 | # 64 | # The header [repo-name] is crucial - it must be present and 65 | # uncommented to enable the repo. 66 | # 67 | 68 | # The testing repositories are disabled by default. To enable, uncomment the 69 | # repo name header and Include lines. You can add preferred servers immediately 70 | # after the header, and they will be used before the default mirrors. 71 | 72 | [pine64] 73 | Server = https://p64.arikawa-hi.me/pine64/aarch64/ 74 | 75 | [sxmo] 76 | Server = https://p64.arikawa-hi.me/sxmo/aarch64/ 77 | 78 | [plasma] 79 | Server = https://p64.arikawa-hi.me/plasma/aarch64/ 80 | 81 | [phosh] 82 | Server = https://p64.arikawa-hi.me/phosh/aarch64/ 83 | 84 | [danctnix] 85 | Server = https://p64.arikawa-hi.me/danctnix/aarch64/ 86 | 87 | [core] 88 | Include = /etc/pacman.d/mirrorlist 89 | 90 | [extra] 91 | Include = /etc/pacman.d/mirrorlist 92 | 93 | [community] 94 | Include = /etc/pacman.d/mirrorlist 95 | 96 | [alarm] 97 | Include = /etc/pacman.d/mirrorlist 98 | 99 | [aur] 100 | Include = /etc/pacman.d/mirrorlist 101 | 102 | # An example of a custom package repository. See the pacman manpage for 103 | # tips on creating your own repositories. 104 | #[custom] 105 | #SigLevel = Optional TrustAll 106 | #Server = file:///home/custompkgs 107 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | export RELEASE_NAME ?= $(shell date +%Y%m%d) 2 | 3 | ###################################################### 4 | #### ALLWINNER PLATFORM, PINE64 PINEPHONE/PINETAB #### 5 | ###################################################### 6 | 7 | rootfs-pinetab-barebone-$(RELEASE_NAME).tar.gz: 8 | ./make_rootfs.sh rootfs-pinetab-barebone-$(RELEASE_NAME) $@ pinetab-barebone 9 | 10 | rootfs-pinephone-barebone-$(RELEASE_NAME).tar.gz: 11 | ./make_rootfs.sh rootfs-pinephone-barebone-$(RELEASE_NAME) $@ pinephone-barebone 12 | 13 | rootfs-pinetab-phosh-$(RELEASE_NAME).tar.gz: 14 | ./make_rootfs.sh rootfs-pinetab-phosh-$(RELEASE_NAME) $@ pinetab-phosh 15 | 16 | rootfs-pinephone-phosh-$(RELEASE_NAME).tar.gz: 17 | ./make_rootfs.sh rootfs-pinephone-phosh-$(RELEASE_NAME) $@ pinephone-phosh 18 | 19 | rootfs-pinetab-plasma-$(RELEASE_NAME).tar.gz: 20 | ./make_rootfs.sh rootfs-pinetab-plasma-$(RELEASE_NAME) $@ pinetab-plasma 21 | 22 | rootfs-pinephone-plasma-$(RELEASE_NAME).tar.gz: 23 | ./make_rootfs.sh rootfs-pinephone-plasma-$(RELEASE_NAME) $@ pinephone-plasma 24 | 25 | rootfs-pinetab-sxmo-$(RELEASE_NAME).tar.gz: 26 | ./make_rootfs.sh rootfs-pinetab-sxmo-$(RELEASE_NAME) $@ pinetab-sxmo 27 | 28 | rootfs-pinephone-sxmo-$(RELEASE_NAME).tar.gz: 29 | ./make_rootfs.sh rootfs-pinephone-sxmo-$(RELEASE_NAME) $@ pinephone-sxmo 30 | 31 | archlinux-pinetab-barebone-$(RELEASE_NAME).img: rootfs-pinetab-barebone-$(RELEASE_NAME).tar.gz 32 | ./make_empty_image.sh $@ 2048M 33 | ./make_image.sh $@ $< u-boot-sunxi-with-spl-pinetab-528.bin 34 | 35 | archlinux-pinephone-barebone-$(RELEASE_NAME).img: rootfs-pinephone-barebone-$(RELEASE_NAME).tar.gz 36 | ./make_empty_image.sh $@ 2048M 37 | ./make_image.sh $@ $< u-boot-sunxi-with-spl-pinephone-528.bin 38 | 39 | archlinux-pinetab-phosh-$(RELEASE_NAME).img: rootfs-pinetab-phosh-$(RELEASE_NAME).tar.gz 40 | ./make_empty_image.sh $@ 4096M 41 | ./make_image.sh $@ $< u-boot-sunxi-with-spl-pinetab-528.bin 42 | 43 | archlinux-pinephone-phosh-$(RELEASE_NAME).img: rootfs-pinephone-phosh-$(RELEASE_NAME).tar.gz 44 | ./make_empty_image.sh $@ 4096M 45 | ./make_image.sh $@ $< u-boot-sunxi-with-spl-pinephone-528.bin 46 | 47 | archlinux-pinetab-plasma-$(RELEASE_NAME).img: rootfs-pinetab-plasma-$(RELEASE_NAME).tar.gz 48 | ./make_empty_image.sh $@ 5300M 49 | ./make_image.sh $@ $< u-boot-sunxi-with-spl-pinetab-528.bin 50 | 51 | archlinux-pinephone-plasma-$(RELEASE_NAME).img: rootfs-pinephone-plasma-$(RELEASE_NAME).tar.gz 52 | ./make_empty_image.sh $@ 5300M 53 | ./make_image.sh $@ $< u-boot-sunxi-with-spl-pinephone-528.bin 54 | 55 | archlinux-pinetab-sxmo-$(RELEASE_NAME).img: rootfs-pinetab-sxmo-$(RELEASE_NAME).tar.gz 56 | ./make_empty_image.sh $@ 3072M 57 | ./make_image.sh $@ $< u-boot-sunxi-with-spl-pinetab-528.bin 58 | 59 | archlinux-pinephone-sxmo-$(RELEASE_NAME).img: rootfs-pinephone-sxmo-$(RELEASE_NAME).tar.gz 60 | ./make_empty_image.sh $@ 3072M 61 | ./make_image.sh $@ $< u-boot-sunxi-with-spl-pinephone-528.bin 62 | 63 | ###################################################### 64 | #### ROCKCHIP PLATFORM, PINE64 PINEPHONE PRO #### 65 | ###################################################### 66 | 67 | rootfs-pinephone-pro-barebone-$(RELEASE_NAME).tar.gz: 68 | ./make_rootfs.sh rootfs-pinephone-pro-barebone-$(RELEASE_NAME) $@ pinephone-pro-barebone 69 | 70 | rootfs-pinephone-pro-phosh-$(RELEASE_NAME).tar.gz: 71 | ./make_rootfs.sh rootfs-pinephone-pro-phosh-$(RELEASE_NAME) $@ pinephone-pro-phosh 72 | 73 | rootfs-pinephone-pro-plasma-$(RELEASE_NAME).tar.gz: 74 | ./make_rootfs.sh rootfs-pinephone-pro-plasma-$(RELEASE_NAME) $@ pinephone-pro-plasma 75 | 76 | rootfs-pinephone-pro-sxmo-$(RELEASE_NAME).tar.gz: 77 | ./make_rootfs.sh rootfs-pinephone-pro-sxmo-$(RELEASE_NAME) $@ pinephone-pro-sxmo 78 | 79 | archlinux-pinephone-pro-barebone-$(RELEASE_NAME).img: rootfs-pinephone-pro-barebone-$(RELEASE_NAME).tar.gz 80 | ./make_empty_image.sh $@ 2048M rockchip 81 | ./make_image.sh $@ $< rockchip 82 | 83 | archlinux-pinephone-pro-phosh-$(RELEASE_NAME).img: rootfs-pinephone-pro-phosh-$(RELEASE_NAME).tar.gz 84 | ./make_empty_image.sh $@ 5120M rockchip 85 | ./make_image.sh $@ $< rockchip 86 | 87 | archlinux-pinephone-pro-plasma-$(RELEASE_NAME).img: rootfs-pinephone-pro-plasma-$(RELEASE_NAME).tar.gz 88 | ./make_empty_image.sh $@ 6144M rockchip 89 | ./make_image.sh $@ $< rockchip 90 | 91 | archlinux-pinephone-pro-sxmo-$(RELEASE_NAME).img: rootfs-pinephone-pro-sxmo-$(RELEASE_NAME).tar.gz 92 | ./make_empty_image.sh $@ 3584M rockchip 93 | ./make_image.sh $@ $< rockchip 94 | 95 | 96 | .PHONY: archlinux-pinetab-barebone archlinux-pinephone-barebone archlinux-pinetab-phosh archlinux-pinephone-phosh archlinux-pinetab-plasma archlinux-pinephone-plasma archlinux-pinetab-sxmo archlinux-pinephone-sxmo archlinux-pinephone-pro-barebone archlinux-pinephone-pro-phosh archlinux-pinephone-pro-plasma archlinux-pinephone-pro-sxmo 97 | archlinux-pinetab-barebone: archlinux-pinetab-barebone-$(RELEASE_NAME).img 98 | archlinux-pinephone-barebone: archlinux-pinephone-barebone-$(RELEASE_NAME).img 99 | archlinux-pinetab-phosh: archlinux-pinetab-phosh-$(RELEASE_NAME).img 100 | archlinux-pinephone-phosh: archlinux-pinephone-phosh-$(RELEASE_NAME).img 101 | archlinux-pinetab-plasma: archlinux-pinetab-plasma-$(RELEASE_NAME).img 102 | archlinux-pinephone-plasma: archlinux-pinephone-plasma-$(RELEASE_NAME).img 103 | archlinux-pinetab-sxmo: archlinux-pinetab-sxmo-$(RELEASE_NAME).img 104 | archlinux-pinephone-sxmo: archlinux-pinephone-sxmo-$(RELEASE_NAME).img 105 | 106 | archlinux-pinephone-pro-barebone: archlinux-pinephone-pro-barebone-$(RELEASE_NAME).img 107 | archlinux-pinephone-pro-phosh: archlinux-pinephone-pro-phosh-$(RELEASE_NAME).img 108 | archlinux-pinephone-pro-plasma: archlinux-pinephone-pro-plasma-$(RELEASE_NAME).img 109 | archlinux-pinephone-pro-sxmo: archlinux-pinephone-pro-sxmo-$(RELEASE_NAME).img 110 | 111 | all: archlinux-pinetab-barebone archlinux-pinephone-barebone archlinux-pinetab-phosh archlinux-pinephone-phosh archlinux-pinetab-plasma archlinux-pinephone-plasma archlinux-pinetab-sxmo archlinux-pinephone-sxmo archlinux-pinephone-pro-barebone archlinux-pinephone-pro-phosh archlinux-pinephone-pro-plasma archlinux-pinephone-pro-sxmo 112 | -------------------------------------------------------------------------------- /make_rootfs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | BUILD="build" 6 | OTHERDIR="otherfiles" 7 | DEST="$1" 8 | OUT_TARBALL="$2" 9 | ROOTFS_PRESET="$3" 10 | BUILD_ARCH=arm64 11 | 12 | for i in wget qemu-arm-static qemu-aarch64-static bsdtar chroot; do 13 | hash $i >/dev/null 2>&1 || { 14 | echo >&2 "$i not found. Please install it."; exit 1; 15 | } 16 | done 17 | 18 | if [ -f "presets/$ROOTFS_PRESET.sh" ]; then 19 | source "presets/$ROOTFS_PRESET.sh" 20 | else 21 | echo "Preset $ROOTFS_PRESET does not exist! Exiting." 22 | exit 1 23 | fi 24 | 25 | export LC_ALL=C 26 | 27 | if [ -z "$DEST" ] || [ -z "$OUT_TARBALL" ] || [ -z "$ROOTFS_PRESET" ]; then 28 | echo "Usage: $0 " 29 | exit 1 30 | fi 31 | 32 | if [ "$(id -u)" -ne "0" ]; then 33 | echo "This script requires root." 34 | exit 1 35 | fi 36 | 37 | DEST=$(readlink -f "$DEST") 38 | 39 | if [ ! -d "$DEST" ]; then 40 | mkdir -p $DEST 41 | fi 42 | 43 | if [ "$(ls -A -Ilost+found $DEST)" ]; then 44 | echo "Destination $DEST is not empty. Aborting." 45 | exit 1 46 | fi 47 | 48 | TEMP=$(mktemp -d) 49 | cleanup() { 50 | if [ -e "$DEST/proc/cmdline" ]; then 51 | umount "$DEST/proc" 52 | fi 53 | if [ -d "$DEST/sys/kernel" ]; then 54 | umount "$DEST/sys" 55 | fi 56 | umount "$DEST/dev" || true 57 | umount "$DEST/tmp" || true 58 | if [ -d "$TEMP" ]; then 59 | rm -rf "$TEMP" 60 | fi 61 | } 62 | trap cleanup EXIT 63 | 64 | ROOTFS="http://archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz" 65 | TAR_OPTIONS="" 66 | 67 | mkdir -p $BUILD 68 | TARBALL="$BUILD/$(basename $ROOTFS)" 69 | 70 | mkdir -p "$BUILD" 71 | if [ ! -e "$TARBALL" ]; then 72 | echo "Downloading $DISTRO rootfs tarball ..." 73 | wget -O "$TARBALL" "$ROOTFS" 74 | fi 75 | 76 | # Extract with BSD tar 77 | echo -n "Extracting ... " 78 | set -x 79 | bsdtar -xpf $TAR_OPTIONS "$TARBALL" -C "$DEST" 80 | echo "OK" 81 | 82 | # Add qemu emulation. 83 | cp /usr/bin/qemu-aarch64-static "$DEST/usr/bin" 84 | cp /usr/bin/qemu-arm-static "$DEST/usr/bin" 85 | 86 | do_chroot() { 87 | cmd="$@" 88 | mount -o bind /tmp "$DEST/tmp" 89 | mount -o bind /dev "$DEST/dev" 90 | chroot "$DEST" mount -t proc proc /proc 91 | chroot "$DEST" mount -t sysfs sys /sys 92 | chroot "$DEST" $cmd 93 | chroot "$DEST" umount /sys 94 | chroot "$DEST" umount /proc 95 | umount "$DEST/dev" 96 | umount "$DEST/tmp" 97 | } 98 | 99 | mv "$DEST/etc/resolv.conf" "$DEST/etc/resolv.conf.dist" 100 | cp /etc/resolv.conf "$DEST/etc/resolv.conf" 101 | 102 | cat $OTHERDIR/pacman.conf > "$DEST/etc/pacman.conf" 103 | 104 | if [[ "$ROOTFS_PRESET" = *"barebone"* ]]; then 105 | # Barebone doesn't need more than en_US. 106 | echo "en_US.UTF-8 UTF-8" > "$DEST/etc/locale.gen-all" 107 | else 108 | cp "$DEST/etc/locale.gen" "$DEST/etc/locale.gen-all" 109 | fi 110 | 111 | mv "$DEST/etc/pacman.d/mirrorlist" "$DEST/etc/pacman.d/mirrorlist.default" 112 | 113 | echo "Server = http://sg.mirror.archlinuxarm.org/\$arch/\$repo" > "$DEST/etc/pacman.d/mirrorlist" 114 | 115 | echo "danctnix" > "$DEST/etc/hostname" 116 | 117 | # Download our gpg key and install it first, this however will be overwritten with our package later. 118 | wget https://raw.githubusercontent.com/dreemurrs-embedded/Pine64-Arch/master/PKGBUILDS/danctnix/danctnix-keyring/danctnix.gpg \ 119 | -O "$DEST/usr/share/pacman/keyrings/danctnix.gpg" 120 | wget https://raw.githubusercontent.com/dreemurrs-embedded/Pine64-Arch/master/PKGBUILDS/danctnix/danctnix-keyring/danctnix-trusted \ 121 | -O "$DEST/usr/share/pacman/keyrings/danctnix-trusted" 122 | 123 | cat > "$DEST/second-phase" < /etc/locale.conf 156 | yes | pacman -Scc 157 | EOF 158 | chmod +x "$DEST/second-phase" 159 | cp $OTHERDIR/change-alarm $DEST/ 160 | do_chroot /second-phase 161 | do_chroot /change-alarm 162 | rm $DEST/second-phase 163 | rm $DEST/change-alarm 164 | 165 | # Final touches 166 | rm "$DEST/usr/bin/qemu-aarch64-static" 167 | rm "$DEST/usr/bin/qemu-arm-static" 168 | rm "$DEST/etc/locale.gen-all" 169 | rm -f "$DEST"/*.core 170 | rm "$DEST/etc/resolv.conf.dist" "$DEST/etc/resolv.conf" 171 | touch "$DEST/etc/resolv.conf" 172 | 173 | rm "$DEST/etc/pacman.d/mirrorlist" 174 | mv "$DEST/etc/pacman.d/mirrorlist.default" "$DEST/etc/pacman.d/mirrorlist" 175 | 176 | rm -rf "$DEST/etc/pacman.d/gnupg" 177 | 178 | cp $OTHERDIR/first_time_setup.sh $DEST/usr/local/sbin/ 179 | sed -i "s/REPLACEDATE/$(date +%Y%m%d)/g" $DEST/usr/local/sbin/first_time_setup.sh 180 | 181 | cp $OTHERDIR/81-blueman.rules $DEST/etc/polkit-1/rules.d/ 182 | 183 | cp -r $OTHERDIR/systemd/* $DEST/usr/lib/systemd/ 184 | 185 | do_chroot /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas 186 | 187 | # Replace Arch's with our own mkinitcpio 188 | rm $DEST/etc/mkinitcpio.conf 189 | cp $OTHERDIR/mkinitcpio.conf $DEST/etc/mkinitcpio.conf 190 | cp $OTHERDIR/mkinitcpio-hooks/resizerootfs-hooks $DEST/usr/lib/initcpio/hooks/resizerootfs 191 | cp $OTHERDIR/mkinitcpio-hooks/resizerootfs-install $DEST/usr/lib/initcpio/install/resizerootfs 192 | 193 | if [[ "$ROOTFS_PRESET" = *"barebone"* ]]; then 194 | # Barebone does not come with splash. 195 | sed -i 's/bootsplash-danctnix//g' $DEST/etc/mkinitcpio.conf 196 | fi 197 | 198 | do_chroot mkinitcpio -p linux-megi 199 | 200 | # Shiny MOTD 201 | cp $OTHERDIR/motd $DEST/etc/motd 202 | 203 | echo "Installed rootfs to $DEST" 204 | 205 | # Create tarball with BSD tar 206 | echo -n "Creating tarball ... " 207 | pushd . 208 | cd $DEST && bsdtar -czpf ../$OUT_TARBALL . 209 | popd 210 | rm -rf $DEST 211 | 212 | set -x 213 | echo "Done" 214 | --------------------------------------------------------------------------------