Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore archlinux support #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 76 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export RELEASE_NAME ?= 0.1~dev
export RELEASE_NAME ?= $(shell date +%Y%m%d)
export RELEASE ?= 1
export LINUX_BRANCH ?= my-hacks-1.2
export BOOT_TOOLS_BRANCH ?= master
Expand Down Expand Up @@ -68,8 +68,26 @@ linux-pine64-package-$(RELEASE_NAME).deb: package package/rtk_bt/rtk_hciattach/r
-a arm64 \
--config-files /var/lib/alsa/asound.state \
package/root/=/ \
package/root.firmware/=/ \
package/root.deb/=/ \
package/rtk_bt/rtk_hciattach/rtk_hciattach=/usr/local/sbin/rtk_hciattach

linux-pine64-package-$(RELEASE_NAME).tar.xz: package
fpm -s dir -t pacman -n linux-pine64-package -v $(RELEASE_NAME) \
-p $@ \
--force \
--after-install package/scripts/postinst.pacman \
--url https://gitlab.com/ayufan-pine64/linux-build \
--description "Pine A64 Linux support package" \
-m "Kamil Trzciński <[email protected]>" \
--license "MIT" \
--vendor "Kamil Trzciński" \
-a aarch64 \
--config-files /var/lib/alsa/asound.state \
package/root/=/ \
package/root.pacman/=/ \
package/root.firmware/=/usr/ \

%.tar.xz: %.tar
pxz -f -3 $<

Expand All @@ -94,6 +112,24 @@ simple-image-pinebook-$(RELEASE_NAME).img: linux-pine64-$(RELEASE_NAME).tar.xz b
export uboot=../boot-tools/boot/pine64/u-boot-pine64-pinebook.bin && \
bash ./make_simpleimage.sh $(shell readlink -f "$@") 100 $(shell readlink -f linux-pine64-$(RELEASE_NAME).tar.xz)

simple-image-pine64-nokernel-$(RELEASE_NAME).img: boot-tools
cd simpleimage && \
export boot0=../boot-tools/boot/pine64/boot0-pine64-plus.bin && \
export uboot=../boot-tools/boot/pine64/u-boot-pine64-plus.bin && \
bash ./make_simpleimage.sh $(shell readlink -f "$@") 100 -

simple-image-sopine-nokernel-$(RELEASE_NAME).img: boot-tools
cd simpleimage && \
export boot0=../boot-tools/boot/pine64/boot0-pine64-sopine.bin && \
export uboot=../boot-tools/boot/pine64/u-boot-pine64-sopine.bin && \
bash ./make_simpleimage.sh $(shell readlink -f "$@") 100 -

simple-image-pinebook-nokernel-$(RELEASE_NAME).img: boot-tools
cd simpleimage && \
export boot0=../boot-tools/boot/pine64/boot0-pine64-pinebook.bin && \
export uboot=../boot-tools/boot/pine64/u-boot-pine64-pinebook.bin && \
bash ./make_simpleimage.sh $(shell readlink -f "$@") 100 -

xenial-minimal-pine64-bspkernel-$(RELEASE_NAME)-$(RELEASE).img: simple-image-pine64-$(RELEASE_NAME).img.xz linux-pine64-$(RELEASE_NAME).tar.xz linux-pine64-package-$(RELEASE_NAME).deb boot-tools
sudo bash ./build-pine64-image.sh \
$(shell readlink -f $@) \
Expand Down Expand Up @@ -155,6 +191,36 @@ stretch-i3-pinebook-bspkernel-$(RELEASE_NAME)-$(RELEASE).img: simple-image-pineb
pinebook \
i3

archlinux-minimal-pine64-$(RELEASE_NAME)-$(RELEASE).img: simple-image-pine64-nokernel-$(RELEASE_NAME).img.xz linux-pine64-package-$(RELEASE_NAME).tar.xz boot-tools
sudo bash ./build-pine64-image.sh \
$(shell readlink -f $@) \
$(shell readlink -f $<) \
- \
$(shell readlink -f linux-pine64-package-$(RELEASE_NAME).tar.xz) \
arch \
pine64 \
minimal

archlinux-minimal-sopine-$(RELEASE_NAME)-$(RELEASE).img: simple-image-sopine-nokernel-$(RELEASE_NAME).img.xz linux-pine64-package-$(RELEASE_NAME).tar.xz boot-tools
sudo bash ./build-pine64-image.sh \
$(shell readlink -f $@) \
$(shell readlink -f $<) \
- \
$(shell readlink -f linux-pine64-package-$(RELEASE_NAME).tar.xz) \
arch \
sopine \
minimal

archlinux-minimal-pinebook-$(RELEASE_NAME)-$(RELEASE).img: simple-image-pinebook-nokernel-$(RELEASE_NAME).img.xz linux-pine64-package-$(RELEASE_NAME).tar.xz boot-tools
sudo bash ./build-pine64-image.sh \
$(shell readlink -f $@) \
$(shell readlink -f $<) \
- \
$(shell readlink -f linux-pine64-package-$(RELEASE_NAME).tar.xz) \
arch \
pinebook \
minimal

.PHONY: kernel-tarball
kernel-tarball: linux-pine64-$(RELEASE_NAME).tar.xz

Expand Down Expand Up @@ -193,3 +259,12 @@ linux-pine64: xenial-minimal-pine64

.PHONY: linux-sopine
linux-sopine: xenial-minimal-sopine

.PHONY: archlinux-minimal-pine64
archlinux-minimal-pine64: archlinux-minimal-pine64-$(RELEASE_NAME)-$(RELEASE).img.xz

.PHONY: archlinux-minimal-sopine
archlinux-minimal-sopine: archlinux-minimal-sopine-$(RELEASE_NAME)-$(RELEASE).img.xz

.PHONY: archlinux-minimal-pinebook
archlinux-minimal-pinebook: archlinux-minimal-pinebook-$(RELEASE_NAME)-$(RELEASE).img.xz
4 changes: 3 additions & 1 deletion build-pine64-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ if [ -z "$DISTRO" ]; then
fi

SIMPLEIMAGE=$(readlink -f "$SIMPLEIMAGE")
KERNELTAR=$(readlink -f "$KERNELTAR")
if [ "$KERNELTAR" != "-" ]; then
KERNELTAR=$(readlink -f "$KERNELTAR")
fi

PWD=$(readlink -f .)
TEMP=$(mktemp -p $PWD -d -t "$MODEL-build-XXXXXXXXXX")
Expand Down
8 changes: 8 additions & 0 deletions package/root.pacman/etc/systemd/system/rtk-hciattach.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Unit]
Description=Realtek H5 bluetooth support

[Service]
ExecStart=/usr/local/sbin/pinebook_start_bt.sh

[Install]
WantedBy=multi-user.target
4 changes: 4 additions & 0 deletions package/root.pacman/usr/local/sbin/pinebook_start_bt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
sleep 10
rfkill unblock 0
/usr/sbin/rtk_hciattach -n -s 115200 /dev/ttyS1 rtk_h5
6 changes: 6 additions & 0 deletions package/scripts/postinst.pacman
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

systemctl enable rtk-hciattach
systemctl enable restore-sound-after-resume
systemctl enable store-sound-on-suspend
systemctl enable pine64-first-boot
77 changes: 72 additions & 5 deletions simpleimage/make_rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ cleanup() {
if [ -d "$DEST/sys/kernel" ]; then
umount "$DEST/sys"
fi
umount "$DEST/dev" || true
umount "$DEST/tmp" || true
if [ -d "$TEMP" ]; then
rm -rf "$TEMP"
Expand All @@ -76,12 +77,15 @@ cleanup() {
trap cleanup EXIT

ROOTFS=""
TAR=tar
TAR_OPTIONS=""

case $DISTRO in
arch)
version=$(date +%Y%m%d)
TAR=bsdtar
ROOTFS="http://archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz"
TAR_OPTIONS="-z"
TAR_OPTIONS="-p"
;;
xenial|zesty)
version=$(curl -s https://api.github.com/repos/$RELEASE_REPO/releases/latest | jq -r ".tag_name")
Expand Down Expand Up @@ -111,9 +115,9 @@ fi
# Extract with BSD tar
echo -n "Extracting ... "
set -x
tar -xf "$TARBALL" -C "$DEST" $TAR_OPTIONS
$TAR -xf "$TARBALL" -C "$DEST" $TAR_OPTIONS
echo "OK"
rm -f "$TARBALL"
#rm -f "$TARBALL"

# Add qemu emulation.
cp /usr/bin/qemu-aarch64-static "$DEST/usr/bin"
Expand All @@ -131,17 +135,80 @@ do_chroot() {
mount -o bind /tmp "$DEST/tmp"
chroot "$DEST" mount -t proc proc /proc
chroot "$DEST" mount -t sysfs sys /sys
chroot "$DEST" mount -t devtmpfs devtmpfs /dev
chroot "$DEST" $cmd
chroot "$DEST" umount /sys
chroot "$DEST" umount /proc
chroot "$DEST" umount /dev
umount "$DEST/tmp"
}

# Run stuff in new system.
case $DISTRO in
arch)
echo "No longer supported"
exit 1
mv "$DEST/etc/resolv.conf" "$DEST/etc/resolv.conf.dist"
cp /etc/resolv.conf "$DEST/etc/resolv.conf"
sed -i 's|CheckSpace|#CheckSpace|' "$DEST/etc/pacman.conf"
cat >> "$DEST/etc/pacman.conf" <<EOF
[archlinux-pine]
SigLevel = Never
Server = https://github.com/anarsoul/PKGBUILDs/releases/download/current/
EOF
do_chroot pacman -Sy --noconfirm || true
# Cleanup preinstalled Kernel
do_chroot pacman -Rsn --noconfirm linux-aarch64 || true
# Remove files installed by make_simpleimage.sh
do_chroot rm -rf /boot/* || true
do_chroot pacman -Sy --noconfirm || true
do_chroot pacman -S --noconfirm --needed dosfstools curl xz iw rfkill netctl dialog wpa_supplicant \
alsa-utils pv linux-pine64-bsp rtl8723ds_bt networkmanager || true
cat >> "$DEST/etc/NetworkManager/NetworkManager.conf" <<EOF
[main]
plugins=keyfile

[keyfile]
unmanaged-devices=interface-name:p2p0
EOF
do_chroot pacman -S --noconfirm uboot-$MODEL-bin
cp $PACKAGEDEB $DEST/$(basename $PACKAGEDEB)
do_chroot pacman -U --noconfirm $(basename $PACKAGEDEB)
do_chroot rm $(basename $PACKAGEDEB)
if [ "$MODEL" = "pinebook" ]; then
do_chroot systemctl enable pinebook-headphones
fi
do_chroot systemctl enable getty@tty1
do_chroot systemctl enable NetworkManager
do_chroot systemd-machine-id-setup
case "$VARIANT" in
xfce)
do_chroot pacman -S --noconfirm xfce4 xf86-video-fbturbo-git lightdm lightdm-gtk-greeter \
firefox network-manager-applet xorg-server \
xf86-input-libinput firefox libvdpau-sunxi-git mpv blueman \
pulseaudio pulseaudio-alsa pavucontrol
do_chroot systemctl enable lightdm
do_chroot systemctl enable NetworkManager
do_chroot systemctl enable bluetooth
esac
cat > "$DEST/second-phase" <<EOF
#!/bin/sh
sed -i 's|^#en_US.UTF-8|en_US.UTF-8|' /etc/locale.gen
cd /usr/share/i18n/charmaps
# locale-gen can't spawn gzip when running under qemu-user, so ungzip charmap before running it
# and then gzip it back
gzip -d UTF-8.gz
locale-gen
gzip UTF-8
localectl set-locale LANG=en_US.utf8
localectl set-keymap us
yes | pacman -Scc
EOF
chmod +x "$DEST/second-phase"
do_chroot /second-phase
do_chroot rm /second-phase
sed -i 's|#CheckSpace|CheckSpace|' "$DEST/etc/pacman.conf"
rm -f "$DEST/etc/resolv.conf"
mv "$DEST/etc/resolv.conf.dist" "$DEST/etc/resolv.conf"
mv "$DEST"/boot/* "$BOOT"/
;;
xenial|sid|jessie|stretch)
rm "$DEST/etc/resolv.conf"
Expand Down
4 changes: 3 additions & 1 deletion simpleimage/make_simpleimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ dd if=/dev/zero bs=1M count=${boot_size} of=${out}1
mkfs.vfat -n BOOT ${out}1

# Add boot support if there
if [ -n "$kernel_tarball" ]; then
if [ "$kernel_tarball" == "-" ]; then
echo "Skipping kernel tarball installation"
elif [ -n "$kernel_tarball" ]; then
echo "Using Kernel from $kernel_tarball ..."
tar -C $temp -xJf "$kernel_tarball"
mv $temp/boot/uEnv.txt.in $temp/boot/uEnv.txt
Expand Down