Skip to content

Commit

Permalink
Build linux-pine64-package.deb that contains all scripts and fix pine…
Browse files Browse the repository at this point in the history
…book support
  • Loading branch information
ayufan committed Apr 30, 2017
1 parent 82426fa commit 94aa068
Show file tree
Hide file tree
Showing 33 changed files with 137 additions and 179 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
/snappy/gadget/uboot.conf
/snappy/gadget/boot-assets
/boot-tools/
/*.deb

2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ node('docker && linux-build') {
--description "${CHANGES}\n\n${BUILD_URL}" \
--draft
for file in *.xz; do
for file in *.xz *.deb; do
github-release upload \
--tag "${VERSION}" \
--name "$(basename "$file")" \
Expand Down
22 changes: 21 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ linux-pine64-$(RELEASE_NAME).tar: linux/arch/arm64/boot/Image boot-tools kernel/
cd kernel && \
bash ./make_kernel_tarball.sh $(shell readlink -f "$@")

linux-pine64-package-$(RELEASE_NAME).deb: package
fpm -s dir -t deb -n linux-pine64-package -v $(RELEASE_NAME) \
-p $@ \
--deb-priority optional --category admin \
--force \
--deb-compression bzip2 \
--after-install package/scripts/postinst.deb \
--before-remove package/scripts/prerm.deb \
--url https://gitlab.com/ayufan-pine64/linux-build \
--description "GitLab Runner" \
-m "Kamil Trzciński <[email protected]>" \
--license "MIT" \
--vendor "Kamil Trzciński" \
-a arm64 \
package/root/=/

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

Expand All @@ -58,17 +74,21 @@ simple-image-pinebook-$(RELEASE_NAME).img: linux-pine64-$(RELEASE_NAME).tar.xz b
export uboot=../boot-tools/build/u-boot-sun50iw1p1-secure-with-pinebook-dtb.bin && \
bash ./make_simpleimage.sh $(shell readlink -f "$@") 100 $(shell readlink -f linux-pine64-$(RELEASE_NAME).tar.xz)

xenial-pinebook-bspkernel-$(RELEASE_NAME)-$(RELEASE).img: simple-image-pinebook-$(RELEASE_NAME).img.xz linux-pine64-$(RELEASE_NAME).tar.xz boot-tools
xenial-pinebook-bspkernel-$(RELEASE_NAME)-$(RELEASE).img: simple-image-pinebook-$(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 $@) \
$(shell readlink -f simple-image-pinebook-$(RELEASE_NAME).img.xz) \
$(shell readlink -f linux-pine64-$(RELEASE_NAME).tar.xz) \
$(shell readlink -f linux-pine64-package-$(RELEASE_NAME).deb) \
xenial \
pinebook

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

.PHONY: linux-package
linux-package: linux-pine64-package-$(RELEASE_NAME).deb

.PHONY: simple-image-pinebook-$(RELEASE_NAME).img
simple-image-pinebook: simple-image-pinebook-$(RELEASE_NAME).img

Expand Down
6 changes: 3 additions & 3 deletions build-environment/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ RUN apt-get install -y python git-core gnupg flex bison gperf build-essential \
htop iotop sysstat iftop pigz bc device-tree-compiler lunzip \
dosfstools gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
gcc-arm-linux-gnueabi g++-arm-linux-gnueabi ccache \
sudo
sudo cpio nano vim kmod kpartx wget bsdtar qemu-user-static \
pxz ruby-dev

RUN apt-get install -y cpio nano vim kmod kpartx wget bsdtar qemu-user-static
RUN apt-get install -y pxz
RUN gem install fpm

RUN curl -L https://github.com/aktau/github-release/releases/download/v0.6.2/linux-amd64-github-release.tar.bz2 | tar -C /tmp -jx && \
mv /tmp/bin/linux/amd64/github-release /usr/local/bin/
Expand Down
9 changes: 5 additions & 4 deletions build-pine64-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
OUT_IMAGE="$1"
SIMPLEIMAGE="$2"
KERNELTAR="$3"
DISTRO="$4"
MODEL="$5"
PACKAGEDEB="$4"
DISTRO="$5"
MODEL="$6"
if [[ -z "$MODEL" ]]; then
MODEL="pine64"
fi
export MODEL

if [ -z "$SIMPLEIMAGE" -o -z "$KERNELTAR" ]; then
echo "Usage: $0 <result.img> <simpleimage.img.xz> <kernel.tar.xz> [distro] [model]"
echo "Usage: $0 <result.img> <simpleimage.img.xz> <kernel.tar.xz> <package.deb> [distro] [model]"
exit 1
fi

Expand Down Expand Up @@ -83,7 +84,7 @@ mount /dev/mapper/${DEVICENAME}p1 "$TEMP/boot"
mount /dev/mapper/${DEVICENAME}p2 "$TEMP/rootfs"

sleep 2
(cd simpleimage && sh ./make_rootfs.sh "$TEMP/rootfs" "$KERNELTAR" "$DISTRO" "$TEMP/boot")
(cd simpleimage && sh ./make_rootfs.sh "$TEMP/rootfs" "$KERNELTAR" "$PACKAGEDEB" "$DISTRO" "$TEMP/boot" "$MODEL")

mv -v "$TEMP/$IMAGE" "$OUT_IMAGE"

Expand Down
1 change: 1 addition & 0 deletions package/root/etc/modprobe.d/blacklist-pine64.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blacklist 8723bs_vq0
2 changes: 2 additions & 0 deletions package/root/etc/modules-load.d/pine64-disp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
disp
hdmi
2 changes: 2 additions & 0 deletions package/root/etc/modules-load.d/pine64-wifi.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
8723bs
8723cs
1 change: 1 addition & 0 deletions package/root/etc/modules-load.d/pinebook-hall.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hall
2 changes: 2 additions & 0 deletions package/root/etc/network/interfaces.d/wlan1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Disable wlan1 by default (8723bs has two intefaces)
iface wlan1 inet manual
8 changes: 8 additions & 0 deletions package/root/etc/systemd/system/cpu-corekeeper.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Unit]
Description=CPU corekeeper

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

[Install]
WantedBy=multi-user.target
10 changes: 10 additions & 0 deletions package/root/etc/systemd/system/eth0-mackeeper.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Fix eth0 mac address to uEnv.txt
After=systemd-modules-load.service local-fs.target

[Service]
Type=oneshot
ExecStart=/usr/local/sbin/pine64_eth0-mackeeper.sh

[Install]
WantedBy=multi-user.target
10 changes: 10 additions & 0 deletions package/root/etc/systemd/system/pinebook-headphones.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Enable headpohones
After=systemd-modules-load.service local-fs.target

[Service]
Type=oneshot
ExecStart=/usr/local/sbin/pinebook_enable_headphones.sh

[Install]
WantedBy=multi-user.target
21 changes: 21 additions & 0 deletions package/root/etc/systemd/system/ssh-keygen.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[Unit]
Description=Generate SSH keys if not there
Before=ssh.service
ConditionPathExists=|!/etc/ssh/ssh_host_key
ConditionPathExists=|!/etc/ssh/ssh_host_key.pub
ConditionPathExists=|!/etc/ssh/ssh_host_rsa_key
ConditionPathExists=|!/etc/ssh/ssh_host_rsa_key.pub
ConditionPathExists=|!/etc/ssh/ssh_host_dsa_key
ConditionPathExists=|!/etc/ssh/ssh_host_dsa_key.pub
ConditionPathExists=|!/etc/ssh/ssh_host_ecdsa_key
ConditionPathExists=|!/etc/ssh/ssh_host_ecdsa_key.pub
ConditionPathExists=|!/etc/ssh/ssh_host_ed25519_key
ConditionPathExists=|!/etc/ssh/ssh_host_ed25519_key.pub

[Service]
ExecStart=/usr/bin/ssh-keygen -A
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=ssh.service
4 changes: 4 additions & 0 deletions package/root/etc/udev/rules.d/90-sunxi-disp-permission.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
KERNEL=="disp", MODE="0770", GROUP="video"
KERNEL=="cedar_dev", MODE="0770", GROUP="video"
KERNEL=="ion", MODE="0770", GROUP="video"
KERNEL=="mali", MODE="0770", GROUP="video"
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if [ -n "$VARIANT" ]; then
echo "Using Kernel variant: $VARIANT"
fi

URL="https://github.com/ayufan-pine64/linux-build/releases/download/$1/linux-pine64-$1.tar.xz"
URL="https://github.com/ayufan-pine64/linux-build/releases/download/$VERSION/linux-pine64-$VERSION.tar.xz"
# URL="https://www.stdin.xyz/downloads/people/longsleep/pine64-images/linux/linux-pine64$VARIANT-$VERSION.tar.xz"
# PUBKEY="https://www.stdin.xyz/downloads/people/longsleep/longsleep.asc"
CURRENTFILE="/var/lib/misc/pine64_update_kernel.status"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ if [ -z "$1" ]; then
fi

DEVICE="/dev/mmcblk0"
URL="https://github.com/ayufan-pine64/linux-build/releases/download/$1/linux-model-$(cat /etc/pine_model)-$1.deb"
CURRENTFILE="/var/lib/misc/pine64_update_model.status"
URL="https://github.com/ayufan-pine64/linux-build/releases/download/$VERSION/linux-pine64-package-$(cat /etc/pine64_model)-$VERSION.deb"
CURRENTFILE="/var/lib/misc/pine64_update_package.status"

if [ "$(id -u)" -ne "0" ]; then
echo "This script requires root."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if [ -z "$1" ]; then
fi

DEVICE="/dev/mmcblk0"
URL="https://github.com/ayufan-pine64/linux-build/releases/download/$1/simple-image-$(cat /etc/pine_model)-$1.tar.xz"
URL="https://github.com/ayufan-pine64/linux-build/releases/download/$VERSION/simple-image-$(cat /etc/pine64_model)-$VERSION.tar.xz"
# URL="https://www.stdin.xyz/downloads/people/longsleep/pine64-images/simpleimage-pine64-$VERSION.img.xz"
# PUBKEY="https://www.stdin.xyz/downloads/people/longsleep/longsleep.asc"
CURRENTFILE="/var/lib/misc/pine64_update_uboot.status"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ state.audiocodec {
control.16 {
iface MIXER
name 'headphone volume'
value 0
value 30
comment {
access 'read write'
type INTEGER
Expand Down Expand Up @@ -1296,7 +1296,7 @@ state.audiocodec {
control.112 {
iface MIXER
name 'Headphone Switch'
value false
value true
comment {
access 'read write'
type BOOLEAN
Expand Down
20 changes: 20 additions & 0 deletions package/scripts/postinst.deb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
set -e

case "$1" in
abort-upgrade|abort-remove|abort-deconfigure)
;;

configure)
if [ ! -e /var/lib/alsa/asound.state ] && [ -e /etc/pine64_model ]; then
cp /var/lib/alsa/asound.state.$(cat /etc/pine64_model) /var/lib/alsa/asound.state
fi
;;

*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac

exit 0
1 change: 1 addition & 0 deletions package/scripts/prerm.deb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/bin/sh
Loading

0 comments on commit 94aa068

Please sign in to comment.