Commit b81994a8 authored by Marius Gripsgard's avatar Marius Gripsgard

Inital system-image device rootfs push

parent 7657bb9d
#!/bin/bash
set -xe
OUT=$(realpath $1)
TMP=$(mktemp -d)
HERE=$(pwd)
SCRIPT=$(dirname $(realpath $0))/build
mkdir ${TMP}/system
mkdir ${TMP}/partitions
TMPDOWN=$(mktemp -d)
cd $TMPDOWN
wget -O u.zip https://gitlab.com/pine64-org/u-boot/-/jobs/artifacts/universalsuperbox/testing-new-partitions/download?job=build
wget -O k.zip https://gitlab.com/pine64-org/linux/-/jobs/artifacts/pine64-kernel-ubports/download?job=build
unzip k.zip
unzip u.zip
ls .
cd $HERE
$SCRIPT/deb-to-bootimg.sh ${TMPDOWN}/linux-image-*-pine64_*.deb ${HERE}/initrd.img ${TMP}/partitions/boot.img
$SCRIPT/wget-extract-deb.sh http://repo.ubports.com/pool/xenial/main/l/linux-firmware-rtlwifi/linux-firmware-rtlwifi_20200316+0ubports0+0~xenial20200412191958.2~1.gbpdcaffd_all.deb ${TMP}/system
$SCRIPT/wget-extract-deb.sh http://repo.ubports.com/pool/xenial/main/l/linux-firmware-pine64-rtl8723-bt/linux-firmware-pine64-rtl8723-bt_20190223+0ubports0+0~xenial20200412190853.3~1.gbp327449_all.deb ${TMP}/system
$SCRIPT/mk-scr.sh uboot ${TMP}/partitions/
cp ${TMPDOWN}/u-boot-sunxi-with-spl-pinephone.bin ${TMP}/partitions/loader.img
cp recovery-pinephone.img ${TMP}/partitions/recovery.img
cp -av overlay/* ${TMP}/
$SCRIPT/build-tarball-mainline.sh pinephone ${OUT} ${TMP}
cd ${HERE}
rm -r ${TMP}
rm -r ${TMPDOWN}
echo "done"
set -e
device=$1
output=$(realpath $2)
dir=$(realpath $3)
echo "Working on device: $device"
if [ ! -f "$dir/partitions/boot.img" ]; then
echo "boot.img does not exist!"
exit 1; fi
if [ ! -f "$dir/partitions/recovery.img" ]; then
echo "recovery.img does not exist!"
exit 1; fi
tar cfJ "$output/mainline_"$device".tar.xz" -C $dir partitions/ system/
echo "$(date +%Y%m%d)-$RANDOM" > "$output/mainline_"$device".tar.build"
#!/bin/bash
set -xe
DEB=$(realpath $1)
INT=$(realpath $2)
OUT=$(realpath $3)
TMP=$(mktemp -d)
TMPMNT=$(mktemp -d)
HERE=$(pwd)
cd ${TMP}
ar x ${DEB}
tar xf data.tar.*
cd ${HERE}
truncate --size 50M ${OUT}
mkfs.ext4 ${OUT}
sudo mount ${OUT} ${TMPMNT}
sudo mv ${TMP}/boot/* ${TMPMNT}
sudo mv ${TMPMNT}/vmlinuz-* ${TMPMNT}/vmlinuz
sudo mv ${TMP}/usr/lib/linux-image-*/allwinner/sun50i-a64-pinephone-1.1.dtb ${TMPMNT}/dtb
sudo mv ${TMP}/lib/modules ${TMPMNT}/modules
sudo cp ${INT} ${TMPMNT}/
sudo umount ${TMPMNT}
rm -r ${TMPMNT}
rm -r ${TMP}
echo "done"
#!/bin/bash
set -xe
DEB=$(realpath $1)
OUT=$(realpath $2)
TMP=$(mktemp -d)
HERE=$(pwd)
mkdir ${OUT} || true
cd ${TMP}
ar x ${DEB}
cd ${OUT}
tar xf ${TMP}/data.tar.*
cd ${HERE}
rm -r ${TMP}
#!/bin/bash
set -xe
SRC=$1
OUT=$2
truncate --size 500K scr.img
mkfs.ext4 scr.img
mkdir mnt
sudo mount scr.img mnt
sudo mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d $SRC/boot.txt mnt/boot.scr
ls mnt
sudo umount mnt
rm -r mnt
mv scr.img $OUT
echo "done"
#!/bin/bash
set -xe
DEB=$1
OUT=$(realpath $2)
TMP=$(mktemp -d)
HERE=$(pwd)
SCRIPT=$(dirname $(realpath $0))
cd ${TMP}
wget ${DEB}
$SCRIPT/deb-to-bootimg.sh ${TMP}/*.deb ${OUT}
cd ${HERE}
rm -r ${TMP}
echo "done"
#!/bin/bash
set -xe
DEB=$1
OUT=$(realpath $2)
TMP=$(mktemp -d)
HERE=$(pwd)
SCRIPT=$(dirname $(realpath $0))
cd ${TMP}
wget ${DEB}
$SCRIPT/extract-deb.sh ${TMP}/*.deb ${OUT}
cd ${HERE}
rm -r ${TMP}
echo "done"
description "oFono Mobile telephony stack"
start on started dbus
stop on stopping dbus
pre-start script
echo "Enabling EG25 WWAN module"
# GPIO35 is PWRKEY
# GPIO68 is RESET_N
# GPIO232 is W_DISABLE#
for i in 35 68 232
do
[ -e /sys/class/gpio/gpio$i ] && continue
echo $i > /sys/class/gpio/export || return 1
echo out > /sys/class/gpio/gpio$i/direction || return 1
done
echo 0 > /sys/class/gpio/gpio68/value || return 1
echo 0 > /sys/class/gpio/gpio232/value || return 1
( echo 1 > /sys/class/gpio/gpio35/value && sleep 2 && echo 0 > /sys/class/gpio/gpio35/value ) || return 1
end script
post-start script
/usr/bin/enable-modem
end script
post-stop script
echo "Disabling EG25 WWAN module"
echo 1 > /sys/class/gpio/gpio68/value
echo 1 > /sys/class/gpio/gpio232/value
echo 1 > /sys/class/gpio/gpio35/value && sleep 2 && echo 0 > /sys/class/gpio/gpio35/value
end script
expect fork
respawn
exec ofonod
description "Pine64 hacks"
task
start on startup
script
# unmute sound
amixer -c 1 set 'AIF1 Slot 0 Digital DAC' unmute
end script
description "Update machine info"
task
start on started dbus
script
hostnamectl --pretty set-chassis handset
end script
# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.
start on stopped rc RUNLEVEL=[12345]
stop on runlevel [!12345]
respawn
exec /sbin/getty -L 115200 ttyS0 vt102
snd_soc_simple_amplifier
snd_soc_simple_card_utils
SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="$attr{bInterfaceNumber}"
SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="01", SYMLINK+="EG25.NMEA", MODE="0660"
SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="02", SYMLINK+="EG25.AT", MODE="0660"
SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="03", SYMLINK+="EG25.MODEM", MODE="0660"
KERNEL=="mali*" OWNER="root" GROUP="mali" MODE="0666"
#!/bin/bash
# Wait until the modem is found
/usr/share/ofono/scripts/list-modems | grep -q "quectelqmi"
while [ $? -ne 0 ]; do
sleep 1
/usr/share/ofono/scripts/list-modems | grep -q "quectelqmi"
done
sleep 2
# Set modem audio configs
if echo "AT+QDAI=1,0,0,2,0,1,1,1" | atinout - /dev/EG25.AT - | grep -q OK; then
echo "Successfully configured modem audio"
else
echo "Failed to set modem audio up: $?"
fi
# Wait until the modem is enabled
/usr/share/ofono/scripts/enable-modem | grep -q "quectelqmi"
while [ $? -ne 0 ]; do
sleep 1
/usr/share/ofono/scripts/enable-modem
done
sleep 2
/usr/share/ofono/scripts/online-modem
SectionVerb {
EnableSequence [
cdev "hw:sun50ia64audio"
cset "name='Headphone Playback Switch' off"
cset "name='Headphone Source Playback Route' DAC"
cset "name='Line In Playback Switch' off"
cset "name='Line Out Playback Switch' off"
cset "name='Line Out Source Playback Route' Mono Differential"
cset "name='Mic1 Playback Switch' off"
cset "name='Mic2 Playback Switch' off"
cset "name='AIF1 DA0 Playback Volume' 160"
cset "name='AIF1 Loopback Switch' off"
cset "name='AIF2 Loopback Switch' off"
cset "name='AIF3 Loopback Switch' off"
cset "name='AIF3 ADC Capture Route' None"
cset "name='AIF3 DAC Playback Route' None"
cset "name='DAC Playback Switch' on"
cset "name='DAC Playback Volume' 160"
cset "name='DAC Mixer ADC Playback Switch' off"
cset "name='DAC Mixer AIF1 DA0 Playback Switch' on"
cset "name='DAC Mixer AIF2 DAC Playback Switch' off"
cset "name='DAC Reversed Playback Switch' off"
cset "name='Earpiece Playback Switch' off"
cset "name='Earpiece Source Playback Route' DACL"
cset "name='Line In Capture Switch' off"
cset "name='Mic1 Capture Switch' off"
cset "name='Mic2 Capture Switch' off"
cset "name='Mixer Capture Switch' off"
cset "name='Mixer Reversed Capture Switch' off"
cset "name='ADC Capture Volume' 160"
cset "name='AIF2 ADC Mixer ADC Capture Switch' off"
cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
cset "name='AIF2 ADC Mixer AIF2 DAC Rev Capture Switch' off"
cset "name='AIF1 AD0 Capture Volume' 160"
cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
]
DisableSequence [
]
Value {
PlaybackPCM "hw:sun50ia64audio"
CapturePCM "hw:sun50ia64audio"
}
}
SectionDevice."Speaker" {
Comment "Internal speaker"
EnableSequence [
cdev "hw:sun50ia64audio"
cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
cset "name='Line Out Playback Switch' on"
cset "name='Line Out Playback Volume' 70%"
]
DisableSequence [
cset "name='Line Out Playback Switch' off"
]
Value {
PlaybackVolume "Line Out Playback Volume"
PlaybackSwitch "Line Out Playback Switch"
PlaybackChannels "2"
PlaybackPriority 300
PlaybackPCM "hw:sun50ia64audio"
}
}
SectionDevice."Earpiece" {
Comment "Internal Earpiece"
EnableSequence [
cdev "hw:sun50ia64audio"
cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
cset "name='Earpiece Playback Switch' on"
cset "name='Earpiece Playback Volume' 70%"
]
DisableSequence [
cset "name='Earpiece Playback Switch' off"
]
Value {
PlaybackVolume "Earpiece Playback Volume"
PlaybackSwitch "Earpiece Playback Switch"
PlaybackChannels "2"
PlaybackPriority 200
PlaybackPCM "hw:sun50ia64audio"
}
}
SectionDevice."DigitalMic" {
Comment "Internal Microphone"
ConflictingDevice [
"HeadsetMic"
]
EnableSequence [
cdev "hw:sun50ia64audio"
cset "name='Mic1 Capture Switch' on"
]
DisableSequence [
cset "name='Mic1 Capture Switch' off"
]
Value {
CapturePriority 500
CapturePCM "hw:sun50ia64audio"
CaptureChannels "2"
}
}
SectionDevice."HeadsetMic" {
Comment "Headset Microphone"
ConflictingDevice [
"DigitalMic"
]
EnableSequence [
cdev "hw:sun50ia64audio"
cset "name='Mic2 Capture Switch' on"
]
DisableSequence [
cset "name='Mic2 Capture Switch' off"
]
Value {
CapturePriority 100
CapturePCM "hw:sun50ia64audio"
CaptureChannels "2"
}
}
SectionDevice."Headphone" {
Comment "Headset"
EnableSequence [
cdev "hw:sun50ia64audio"
cset "name='AIF1 DA0 Stereo Playback Route' Stereo"
cset "name='Headphone Playback Switch' on"
cset "name='Headphone Playback Volume' 40%"
]
DisableSequence [
cset "name='Headphone Playback Switch' off"
]
Value {
PlaybackVolume "Headphone Playback Volume"
PlaybackSwitch "Headphone Playback Switch"
PlaybackChannels "2"
PlaybackPriority 100
PlaybackPCM "hw:sun50ia64audio"
}
}
SectionVerb {
EnableSequence [
cdev "hw:sun50ia64audio"
cset "name='Headphone Playback Switch' off"
cset "name='Headphone Source Playback Route' DAC"
cset "name='Line In Playback Switch' off"
cset "name='Line Out Playback Switch' off"
cset "name='Line Out Source Playback Route' Mono Differential"
cset "name='Mic1 Playback Switch' off"
cset "name='Mic2 Playback Switch' off"
cset "name='AIF1 DA0 Playback Volume' 160"
cset "name='AIF1 Loopback Switch' off"
cset "name='AIF2 Loopback Switch' off"
cset "name='AIF2 DAC Playback Volume' 160"
cset "name='AIF3 Loopback Switch' off"
cset "name='AIF3 ADC Capture Route' None"
cset "name='AIF3 DAC Playback Route' None"
cset "name='DAC Playback Switch' on"
cset "name='DAC Playback Volume' 160"
cset "name='DAC Mixer ADC Playback Switch' off"
cset "name='DAC Mixer AIF1 DA0 Playback Switch' on"
cset "name='DAC Mixer AIF2 DAC Playback Switch' on"
cset "name='DAC Reversed Playback Switch' off"
cset "name='Earpiece Playback Switch' off"
cset "name='Earpiece Source Playback Route' DACL"
cset "name='Line In Capture Switch' off"
cset "name='Mic1 Capture Switch' off"
cset "name='Mic2 Capture Switch' off"
cset "name='Mixer Capture Switch' off"
cset "name='Mixer Reversed Capture Switch' off"
cset "name='ADC Capture Volume' 160"
cset "name='AIF2 ADC Capture Volume' 160"
cset "name='AIF2 ADC Mixer ADC Capture Switch' on"
cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
cset "name='AIF2 ADC Mixer AIF2 DAC Rev Capture Switch' off"
cset "name='AIF1 AD0 Capture Volume' 160"
cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
]
DisableSequence [
]
Value {
PlaybackPCM "hw:sun50ia64audio"
CapturePCM "hw:sun50ia64audio"
}
}
SectionDevice."Speaker" {
Comment "Internal speaker"
EnableSequence [
cdev "hw:sun50ia64audio"
cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
cset "name='Line Out Playback Switch' on"
cset "name='Line Out Playback Volume' 70%"
]
DisableSequence [
cset "name='Line Out Playback Switch' off"
]
Value {
PlaybackVolume "Line Out Playback Volume"
PlaybackSwitch "Line Out Playback Switch"
PlaybackChannels "2"
PlaybackPriority 300
PlaybackPCM "hw:sun50ia64audio"
}
}
SectionDevice."Earpiece" {
Comment "Internal Earpiece"
EnableSequence [
cdev "hw:sun50ia64audio"
cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
cset "name='Earpiece Playback Switch' on"
cset "name='Earpiece Playback Volume' 70%"
]
DisableSequence [
cset "name='Earpiece Playback Switch' off"
]
Value {
PlaybackVolume "Earpiece Playback Volume"
PlaybackSwitch "Earpiece Playback Switch"
PlaybackChannels "2"
PlaybackPriority 500
PlaybackPCM "hw:sun50ia64audio"
}
}
SectionDevice."DigitalMic" {
Comment "Internal Microphone"
ConflictingDevice [
"HeadsetMic"
]
EnableSequence [
cdev "hw:sun50ia64audio"
cset "name='Mic1 Capture Switch' on"
]
DisableSequence [
cset "name='Mic1 Capture Switch' off"
]
Value {
CapturePriority 200
CapturePCM "hw:sun50ia64audio"
CaptureChannels "2"
}
}
SectionDevice."HeadsetMic" {
Comment "Headset Microphone"
ConflictingDevice [
"DigitalMic"
]
EnableSequence [
cdev "hw:sun50ia64audio"
cset "name='Mic2 Capture Switch' on"
]
DisableSequence [
cset "name='Mic2 Capture Switch' off"
]
Value {
CapturePriority 100
CapturePCM "hw:sun50ia64audio"
CaptureChannels "2"
}
}
SectionDevice."Headphone" {
Comment "Headset"
EnableSequence [
cdev "hw:sun50ia64audio"
cset "name='AIF1 DA0 Stereo Playback Route' Stereo"
cset "name='Headphone Playback Switch' on"
cset "name='Headphone Playback Volume' 40%"
]
DisableSequence [
cset "name='Headphone Playback Switch' off"
]
Value {
PlaybackVolume "Headphone Playback Volume"
PlaybackSwitch "Headphone Playback Switch"
PlaybackChannels "2"
PlaybackPriority 100
PlaybackPCM "hw:sun50ia64audio"
}
}
Syntax 2
SectionUseCase."HiFi" {
File "HiFi"
Comment "Play HiFi quality music"
}
SectionUseCase."Voice Call" {
File "VoiceCall"
Comment "Make a phone call"
}
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Flag indicating whether the we should enable the automatic brightness in Settings.
Software implementation will be used if config_hardware_auto_brightness_available is not set -->
<bool name="config_automatic_brightness_available">true</bool>
<!-- Array of light sensor LUX values to define our levels for auto backlight brightness support.
The N entries of this array define N 1 zones as follows:
Zone 0: 0 <= LUX < array[0]
Zone 1: array[0] <= LUX < array[1]
...
Zone N: array[N - 1] <= LUX < array[N]
Zone N + 1 array[N] <= LUX < infinity
Must be overridden in platform specific overlays -->
<integer-array name="config_autoBrightnessLevels">
<item>1</item>
<item>5</item>
<item>40</item>
<item>350</item>
<item>600</item>
<item>1000</item>
<item>1600</item>
<item>3000</item>
<item>10000</item>
</integer-array>
<!-- Array of output values for LCD backlight corresponding to the LUX values
in the config_autoBrightnessLevels array. This array should have size one greater
than the size of the config_autoBrightnessLevels array.
This must be overridden in platform specific overlays -->
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>77</item> <!-- 0-1 -->
<item>77</item> <!-- 1-4 -->
<item>102</item> <!-- 4-40 -->
<item>130</item> <!-- 40-350 -->
<item>153</item> <!-- 350-600 -->
<item>179</item> <!-- 600-1000 -->
<item>204</item> <!-- 1000-1600 -->
<item>230</item> <!-- 1600-3000 -->
<item>255</item> <!-- 3000-10000 -->
<item>255</item> <!-- 10000+ -->
</integer-array>
<!-- Minimum screen brightness allowed by the power manager. -->
<integer name="config_screenBrightnessDim">77</integer>
<!-- Default screen brightness setting.
Must be in the range specified by minimum and maximum. -->
<integer name="config_screenBrightnessSettingDefault">153</integer>
<!-- Minimum screen brightness setting allowed by the power manager.
The user is forbidden from setting the brightness below this level. -->
<integer name="config_screenBrightnessSettingMinimum">77</integer>
<!-- Shutdown if the battery temperature exceeds (this value * 0.1) Celsius. -->
<integer name="config_shutdownBatteryTemperature">600</integer>
</resources>