Initial commit
This commit is contained in:
commit
97b219cb13
65
LICENSE
Normal file
65
LICENSE
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
Copyright (c) 2024 timoxa0
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
Package linux-nabu contains linux kernel redistributed under GPL-2.0 WITH Linux-syscall-note
|
||||||
|
|
||||||
|
Package qcom-services contains software redistributed under BSD-3-Clause license:
|
||||||
|
qrtr-ns:
|
||||||
|
Copyright (c) 2015, Sony Mobile Communications Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
pd-mapper:
|
||||||
|
Copyright (c) 2018, Linaro Ltd.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Copyright (c) 2016, Bjorn Andersson <bjorn@kryo.se>
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
rmtfs:
|
||||||
|
Copyright (c) 2016, Linaro Ltd
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
tqftpserv:
|
||||||
|
Copyright (c) 2018, Linaro Ltd.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of the organization nor the
|
||||||
|
names of its contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
178
common.d/build_functions.sh
Normal file
178
common.d/build_functions.sh
Normal file
|
@ -0,0 +1,178 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
get_image_path()
|
||||||
|
{
|
||||||
|
printf "%s" "$(realpath "./raw/${1}.img")"
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_inet()
|
||||||
|
{
|
||||||
|
local rootdir="$1"
|
||||||
|
[ ! -d "$rootdir" ] && {
|
||||||
|
log "Rootdir [$rootdir] does not exists" ierror
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "nameserver 1.1.1.1" > "$rootdir/etc/resolv.conf"
|
||||||
|
echo "xiaomi-nabu" > "$rootdir/etc/hostname"
|
||||||
|
echo "127.0.0.1 localhost
|
||||||
|
127.0.1.1 xiaomi-nabu" > "$rootdir/etc/hosts"
|
||||||
|
}
|
||||||
|
|
||||||
|
create_image()
|
||||||
|
{
|
||||||
|
name="$(get_image_path "$1")"
|
||||||
|
if [ -z "$2" ]; then
|
||||||
|
size="$DEFAULT_IMAGE_SIZE"
|
||||||
|
else
|
||||||
|
size="${2}GB"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$name" ]; then
|
||||||
|
rm "$name"
|
||||||
|
fi
|
||||||
|
|
||||||
|
truncate --size "$size" "$name" || {
|
||||||
|
log "Failed to cretae image [$name]" ierror
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
mkfs.ext4 "$name"
|
||||||
|
}
|
||||||
|
|
||||||
|
trim_image()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
name="$(get_image_path "$1")"
|
||||||
|
e2fsck -f "$name"
|
||||||
|
resize2fs -M "$name"
|
||||||
|
} || {
|
||||||
|
log "Failed to trim image" ierror
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2155
|
||||||
|
mount_image()
|
||||||
|
{
|
||||||
|
local rootdir="$1"
|
||||||
|
[ ! -d "$rootdir" ] && {
|
||||||
|
log "Rootdir [$rootdir] does not exists" ierror
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
local mountdir="$(mktemp --tmpdir=./tmp/ -d)"
|
||||||
|
local mountdir="$(realpath "$mountdir")"
|
||||||
|
|
||||||
|
mount -o loop "$(get_image_path "$1")" "$mountdir" || {
|
||||||
|
log "Failed to mount image" ierror
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
mkdir -p "$mountdir/boot/efi"
|
||||||
|
mkdir -p "$mountdir/boot/simpleinit"
|
||||||
|
|
||||||
|
mount -o size=512M,mode=0755 -t tmpfs nabu_esp "$mountdir/boot/efi"
|
||||||
|
mount -o size=512M,mode=0755 -t tmpfs nabu_simpleinit "$mountdir/boot/simpleinit"
|
||||||
|
|
||||||
|
sed "s|{cmdline}|$SIMPLEINIT_CMDLINE|g" < ./drop/simpleinit.uefi.cfg > "$mountdir/boot/simpleinit/simpleinit.uefi.cfg"
|
||||||
|
printf "%s" "$mountdir"
|
||||||
|
}
|
||||||
|
|
||||||
|
gen_fstab()
|
||||||
|
{
|
||||||
|
local rootdir="$1"
|
||||||
|
[ ! -d "$rootdir" ] && {
|
||||||
|
log "Rootdir [$rootdir] does not exists" ierror
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -d "$rootdir/etc/" ]; then
|
||||||
|
[ -f "$rootdir/etc/fstab" ] && rm "$rootdir/etc/fstab"
|
||||||
|
cp ./drop/fstab "$rootdir/etc/fstab"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
umount_image()
|
||||||
|
{
|
||||||
|
local rootdir="$1"
|
||||||
|
[ ! -d "$rootdir" ] && {
|
||||||
|
log "Rootdir [$rootdir] does not exists" ierror
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
rootdir="$(realpath "${1}")"
|
||||||
|
mkdir "$rootdir/opt/nabu/" -p
|
||||||
|
tar -cf "$rootdir/opt/nabu/efi.tar" -C "$rootdir/" boot/
|
||||||
|
cp ./drop/postinstall "$rootdir/opt/nabu/postinstall"
|
||||||
|
chmod +x "$rootdir/opt/nabu/postinstall"
|
||||||
|
|
||||||
|
umount "$rootdir/boot/efi" > /dev/null 2>&1
|
||||||
|
umount "$rootdir/boot/simpleinit" > /dev/null 2>&1
|
||||||
|
umount "$rootdir" > /dev/null 2>&1
|
||||||
|
rm -d "$rootdir" > /dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
prepare_chroot()
|
||||||
|
{
|
||||||
|
local rootdir="$1"
|
||||||
|
[ ! -d "$rootdir" ] && {
|
||||||
|
log "Rootdir [$rootdir] does not exists" ierror
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:\$PATH
|
||||||
|
rootdir="$(realpath "$1")"
|
||||||
|
|
||||||
|
mount --bind /proc "$rootdir/proc" > /dev/null 2>&1
|
||||||
|
mount --bind /sys "$rootdir/sys" > /dev/null 2>&1
|
||||||
|
mount --bind /dev "$rootdir/dev" > /dev/null 2>&1
|
||||||
|
mount --bind /dev/pts "$rootdir/dev/pts" > /dev/null 2>&1
|
||||||
|
|
||||||
|
if uname -m | grep -q aarch64 || [ -f "/proc/sys/fs/binfmt_misc/qemu-aarch64" ]; then
|
||||||
|
log "Cancel qemu install for arm64" internal
|
||||||
|
else
|
||||||
|
wget -N https://github.com/multiarch/qemu-user-static/releases/download/v7.2.0-1/qemu-aarch64-static -O ./cache/qemu-aarch64-static
|
||||||
|
install -m755 ./cache/qemu-aarch64-static "$rootdir/"
|
||||||
|
|
||||||
|
# shellcheck disable=SC2028
|
||||||
|
echo ':aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/qemu-aarch64-static:' > /proc/sys/fs/binfmt_misc/register
|
||||||
|
|
||||||
|
# shellcheck disable=SC2028
|
||||||
|
echo ':aarch64ld:M::\x7fELF\x02\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/qemu-aarch64-static:' > /proc/sys/fs/binfmt_misc/register
|
||||||
|
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
detach_chroot()
|
||||||
|
{
|
||||||
|
local rootdir="$1"
|
||||||
|
[ ! -d "$rootdir" ] && {
|
||||||
|
log "Rootdir [$rootdir] does not exists" ierror
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
rootdir=$(realpath "$1")
|
||||||
|
blocking=$(lsof -t "$rootdir")
|
||||||
|
if [ -n "$blocking" ]; then
|
||||||
|
kill -9 "$blocking"
|
||||||
|
fi
|
||||||
|
killall gpg-agent > /dev/null 2>&1
|
||||||
|
umount "$rootdir/proc" > /dev/null 2>&1
|
||||||
|
umount "$rootdir/sys" > /dev/null 2>&1
|
||||||
|
umount "$rootdir/dev/pts" > /dev/null 2>&1
|
||||||
|
umount "$rootdir/dev" > /dev/null 2>&1
|
||||||
|
|
||||||
|
if uname -m | grep -q aarch64; then
|
||||||
|
log "Cancel qemu uninstall for arm64" internal
|
||||||
|
else
|
||||||
|
if [ -f "/proc/sys/fs/binfmt_misc/aarch64" ]; then
|
||||||
|
echo -1 > /proc/sys/fs/binfmt_misc/aarch64
|
||||||
|
fi
|
||||||
|
if [ -f "/proc/sys/fs/binfmt_misc/aarch64ld" ]; then
|
||||||
|
echo -1 > /proc/sys/fs/binfmt_misc/aarch64ld
|
||||||
|
fi
|
||||||
|
if [ -f "$rootdir/qemu-aarch64-static" ]; then
|
||||||
|
rm "$rootdir/qemu-aarch64-static"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
120
common.d/functions.sh
Normal file
120
common.d/functions.sh
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source ./common.d/variables.sh
|
||||||
|
|
||||||
|
log()
|
||||||
|
{
|
||||||
|
case "$2" in
|
||||||
|
error)
|
||||||
|
printf "\e[1m\e[31mERROR:\e[0m \e[1m%s\e[0m\n" "$1";;
|
||||||
|
internal)
|
||||||
|
printf "\e[1m\e[96m >>\e[0m \e[1m%s\e[0m\n" "$1";;
|
||||||
|
ierror)
|
||||||
|
printf "\e[1m\e[31m >>\e[0m \e[1m%s\e[0m\n" "$1";;
|
||||||
|
*)
|
||||||
|
printf "\e[1m\e[92m>>>\e[0m \e[1m%s\e[0m\n" "$1";;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
mkdir_if_not_exists ()
|
||||||
|
{
|
||||||
|
[ -d "$1" ] && return 0
|
||||||
|
[ -f "$1" ] && rm -f "$1"
|
||||||
|
mkdir "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
prepare_env()
|
||||||
|
{
|
||||||
|
mkdir_if_not_exists "./cache"
|
||||||
|
mkdir_if_not_exists "./out"
|
||||||
|
mkdir_if_not_exists "./raw"
|
||||||
|
mkdir_if_not_exists "./tmp"
|
||||||
|
}
|
||||||
|
|
||||||
|
require ()
|
||||||
|
{
|
||||||
|
which "$1" > /dev/null 2>&1 ||
|
||||||
|
{
|
||||||
|
log "$1 not found" error
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2161
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
arguments() {
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
opt="$1"
|
||||||
|
|
||||||
|
shift
|
||||||
|
|
||||||
|
case "$(echo ${opt} | tr '[:upper:]' '[:lower:]')" in
|
||||||
|
-c | --cleanup)
|
||||||
|
cleanup ;;
|
||||||
|
|
||||||
|
-h | -help | --help)
|
||||||
|
usage ;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
export LNIBUILD="$1"
|
||||||
|
break 2 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
log "Usage commands:"
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
# Help screen (this)
|
||||||
|
$0 --help or $0 -h
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
$0 --cleanup or $0 -c
|
||||||
|
|
||||||
|
# Build LNIBUILD
|
||||||
|
$0 <path/to/LNIBUILD>
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2162
|
||||||
|
cleanup()
|
||||||
|
{
|
||||||
|
source ./common.d/build_functions.sh
|
||||||
|
find ./tmp/ -mindepth 1 -maxdepth 1 | read || {
|
||||||
|
[ -z ${quiet+x} ] && log "Nothing to clean" error
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
for d in ./tmp/*/; do
|
||||||
|
log "Unmounting $d"
|
||||||
|
detach_chroot "$d"
|
||||||
|
umount "$d/boot/simpleinit" 2> /dev/null
|
||||||
|
umount "$d/boot/efi" 2> /dev/null
|
||||||
|
umount ./tmp/tmp.* 2> /dev/null
|
||||||
|
rm -d "$d"
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2317
|
||||||
|
_shutdown()
|
||||||
|
{
|
||||||
|
quiet='' cleanup
|
||||||
|
if [ -z ${1+x} ]; then
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
exit "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
sigterm_handler()
|
||||||
|
{
|
||||||
|
sig=$?
|
||||||
|
printf "\e[1m\e[31m>>\e[0m \e[1m%s\e[0m\n" "Shutdown signal received."
|
||||||
|
_shutdown $sig
|
||||||
|
}
|
||||||
|
|
||||||
|
trap 'trap " " SIGINT SIGTERM SIGHUP; kill 0; wait; sigterm_handler' SIGINT SIGTERM SIGHUP
|
4
common.d/variables.sh
Normal file
4
common.d/variables.sh
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
export SIMPLEINIT_CMDLINE="root=PARTLABEL=linux loglevel=3 fbcon=rotate:1"
|
||||||
|
export DEFAULT_IMAGE_SIZE="10GB"
|
||||||
|
|
32
compress.sh
Executable file
32
compress.sh
Executable file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
source common.sh
|
||||||
|
|
||||||
|
# Ensure that lon-tool installed
|
||||||
|
which lon-tool > /dev/null 2>&1 || {
|
||||||
|
log_err "lon-tool not found"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2162
|
||||||
|
find ./raw/ -mindepth 1 -maxdepth 1 | read || {
|
||||||
|
log_err "Nothing to compress"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Settings
|
||||||
|
DATE=$(date +"%d-%m-%y")
|
||||||
|
|
||||||
|
# Begin script
|
||||||
|
log "Start compressing images"
|
||||||
|
log "Current date: ${DATE}"
|
||||||
|
|
||||||
|
for image in raw/*; do
|
||||||
|
full_image_path=$(realpath "$image")
|
||||||
|
image_name=$(basename "$full_image_path")
|
||||||
|
lni_name="${image_name/.img/""}"
|
||||||
|
full_lni_path=$(realpath "./out/${image_name/.img/".lni"}")
|
||||||
|
log "Compressing $lni_name"
|
||||||
|
lon-tool image create -n "$lni_name" -v "$DATE" "$full_image_path" "$full_lni_path"
|
||||||
|
done
|
||||||
|
|
||||||
|
log "Stop compressing images"
|
2
drop/00_image_builder
Normal file
2
drop/00_image_builder
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# /etc/sudoers.d/00_image_builder
|
||||||
|
%wheel ALL=(ALL:ALL) ALL
|
7
drop/fstab
Normal file
7
drop/fstab
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# /etc/fstab: static file system information.
|
||||||
|
#
|
||||||
|
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||||
|
PARTLABEL=linux / ext4 errors=remount-ro,x-systemd.growfs 0 1
|
||||||
|
PARTLABEL=esp /boot/efi/ vfat defaults,umask=0022 0 1
|
||||||
|
PARTLABEL=logfs /boot/simpleinit/ vfat defaults,umask=0022 0 1
|
||||||
|
/dev/zram0 none swap defaults,pri=100,nofail 0 0
|
59
drop/mirrorlist
Normal file
59
drop/mirrorlist
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
# /etc/pacman.d/mirrorlist
|
||||||
|
# ALArm only
|
||||||
|
#
|
||||||
|
# Arch Linux ARM repository mirrorlist
|
||||||
|
# Generated on 2023-02-06
|
||||||
|
#
|
||||||
|
|
||||||
|
### Mirrors by country
|
||||||
|
|
||||||
|
### Denmark
|
||||||
|
## Aalborg
|
||||||
|
# Server = http://dk.mirror.archlinuxarm.org/$arch/$repo
|
||||||
|
|
||||||
|
### Germany
|
||||||
|
## Aachen
|
||||||
|
# Server = http://de3.mirror.archlinuxarm.org/$arch/$repo
|
||||||
|
## Berlin
|
||||||
|
# Server = http://de.mirror.archlinuxarm.org/$arch/$repo
|
||||||
|
## Coburg
|
||||||
|
# Server = http://de4.mirror.archlinuxarm.org/$arch/$repo
|
||||||
|
## Falkenstein
|
||||||
|
Server = http://eu.mirror.archlinuxarm.org/$arch/$repo
|
||||||
|
# Server = http://de5.mirror.archlinuxarm.org/$arch/$repo
|
||||||
|
|
||||||
|
### Greece
|
||||||
|
## Athens
|
||||||
|
# Server = http://gr.mirror.archlinuxarm.org/$arch/$repo
|
||||||
|
|
||||||
|
### Hungary
|
||||||
|
## Budapest
|
||||||
|
# Server = http://hu.mirror.archlinuxarm.org/$arch/$repo
|
||||||
|
|
||||||
|
### Japan
|
||||||
|
## Tokyo
|
||||||
|
# Server = http://jp.mirror.archlinuxarm.org/$arch/$repo
|
||||||
|
|
||||||
|
### Singapore
|
||||||
|
# Server = http://sg.mirror.archlinuxarm.org/$arch/$repo
|
||||||
|
|
||||||
|
### Taiwan
|
||||||
|
## Hsinchu
|
||||||
|
# Server = http://tw2.mirror.archlinuxarm.org/$arch/$repo
|
||||||
|
## New Taipei City
|
||||||
|
# Server = http://tw.mirror.archlinuxarm.org/$arch/$repo
|
||||||
|
|
||||||
|
### United Kingdom
|
||||||
|
## London
|
||||||
|
# Server = http://uk.mirror.archlinuxarm.org/$arch/$repo
|
||||||
|
|
||||||
|
### United States
|
||||||
|
## California
|
||||||
|
# Server = http://ca.us.mirror.archlinuxarm.org/$arch/$repo
|
||||||
|
## Florida
|
||||||
|
# Server = http://fl.us.mirror.archlinuxarm.org/$arch/$repo
|
||||||
|
## New Jersey
|
||||||
|
# Server = http://nj.us.mirror.archlinuxarm.org/$arch/$repo
|
||||||
|
|
||||||
|
## Geo-IP based mirror selection and load balancing
|
||||||
|
Server = http://mirror.archlinuxarm.org/$arch/$repo
|
28
drop/monitors.xml
Normal file
28
drop/monitors.xml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<!-- /etc/skel/.config/monitors.xml -->
|
||||||
|
<monitors version="2">
|
||||||
|
<configuration>
|
||||||
|
<logicalmonitor>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<scale>2</scale>
|
||||||
|
<primary>yes</primary>
|
||||||
|
<transform>
|
||||||
|
<rotation>right</rotation>
|
||||||
|
<flipped>no</flipped>
|
||||||
|
</transform>
|
||||||
|
<monitor>
|
||||||
|
<monitorspec>
|
||||||
|
<connector>DSI-1</connector>
|
||||||
|
<vendor>unknown</vendor>
|
||||||
|
<product>unknown</product>
|
||||||
|
<serial>unknown</serial>
|
||||||
|
</monitorspec>
|
||||||
|
<mode>
|
||||||
|
<width>1600</width>
|
||||||
|
<height>2560</height>
|
||||||
|
<rate>104.000</rate>
|
||||||
|
</mode>
|
||||||
|
</monitor>
|
||||||
|
</logicalmonitor>
|
||||||
|
</configuration>
|
||||||
|
</monitors>
|
3
drop/postinstall
Normal file
3
drop/postinstall
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# /opt/nabu/postinstall
|
||||||
|
tar -xf /opt/nabu/efi.tar -C / || true
|
4
drop/sddm.nabu.Xsetup
Normal file
4
drop/sddm.nabu.Xsetup
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Xsetup - run as root before the login dialog appears
|
||||||
|
xrandr --output DSI-1 --rotate right
|
||||||
|
xinput set-prop "NVTCapacitiveTouchScreen" "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
|
9
drop/sddm.nabu.conf
Normal file
9
drop/sddm.nabu.conf
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[General]
|
||||||
|
DisplayServer=x11
|
||||||
|
InputMethod=qtvirtualkeyboard
|
||||||
|
|
||||||
|
[Theme]
|
||||||
|
Current=breeze
|
||||||
|
|
||||||
|
[X11]
|
||||||
|
DisplayCommand=/usr/share/sddm/scripts/Xsetup
|
36
drop/simpleinit.uefi.cfg
Normal file
36
drop/simpleinit.uefi.cfg
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## Simple Init Configuration Store For UEFI
|
||||||
|
##
|
||||||
|
|
||||||
|
boot.configs.continue.mode = 10
|
||||||
|
boot.configs.continue.show = false
|
||||||
|
boot.configs.uefi_boot_menu.mode = 12
|
||||||
|
boot.configs.uefi_boot_menu.show = false
|
||||||
|
boot.configs.linux.mode = 8
|
||||||
|
boot.configs.linux.desc = "Linux"
|
||||||
|
boot.configs.linux.show = true
|
||||||
|
boot.configs.linux.enabled = true
|
||||||
|
boot.configs.linux.icon = "linux.svg"
|
||||||
|
boot.configs.linux.extra.use_uefi = true
|
||||||
|
boot.configs.linux.extra.kernel = "@part_esp:\\vmlinuz-6.1.10-nabu"
|
||||||
|
boot.configs.linux.extra.dtb = "@part_esp:\\dtb-6.1.10-nabu"
|
||||||
|
boot.configs.linux.extra.skip_kernel_fdt_cmdline = true
|
||||||
|
boot.configs.linux.extra.update_splash = false
|
||||||
|
boot.configs.linux.extra.cmdline = "{cmdline}"
|
||||||
|
boot.default = "reboot-payload"
|
||||||
|
boot.second = "simple-init"
|
||||||
|
boot.uefi_probe = false
|
||||||
|
boot.title = "Select OS"
|
||||||
|
boot.timeout_text = "Timeout: %d"
|
||||||
|
sw = 8
|
||||||
|
gui.show_background = true
|
||||||
|
gui.background = ""
|
||||||
|
locates.part_logfs.by_disk_label = "gpt"
|
||||||
|
locates.part_logfs.by_gpt_name = "logfs"
|
||||||
|
locates.part_esp.by_disk_label = "gpt"
|
||||||
|
locates.part_esp.by_gpt_name = "esp"
|
||||||
|
locates.part_boot.by_disk_label = "gpt"
|
||||||
|
locates.part_boot.by_gpt_name = "boot"
|
||||||
|
|
||||||
|
# vim: ts=8 sw=8
|
3
drop/zram-generator.conf
Normal file
3
drop/zram-generator.conf
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# /etc/systemd/zram-generator.conf
|
||||||
|
[zram0]
|
||||||
|
zram-size = ram
|
114
makelni
Executable file
114
makelni
Executable file
|
@ -0,0 +1,114 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
source ./common.d/functions.sh
|
||||||
|
source ./common.d/variables.sh
|
||||||
|
|
||||||
|
if [ "$(id -u)" != "0" ]; then
|
||||||
|
log "$0 must be run as root"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
arguments "$@"
|
||||||
|
|
||||||
|
[[ -z $LNIBUILD ]] && {
|
||||||
|
log "No LNIBUILD specified" error
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
prepare_env
|
||||||
|
|
||||||
|
lni_path=$(realpath "$LNIBUILD")
|
||||||
|
|
||||||
|
source "$lni_path"
|
||||||
|
|
||||||
|
lnib_has_errors="n"
|
||||||
|
[ -z ${name+x} ] && {
|
||||||
|
log "LNIBUILD: missing name" ierror
|
||||||
|
lnib_has_errors="y"
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -z ${image_type+x} ] && {
|
||||||
|
log "LNIBUILD: missing image_type" ierror
|
||||||
|
lnib_has_errors="y"
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -z ${zram+x} ] && {
|
||||||
|
log "LNIBUILD: missing zram" ierror
|
||||||
|
lnib_has_errors="y"
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -z ${packages+x} ] && {
|
||||||
|
log "LNIBUILD: missing packages" ierror
|
||||||
|
lnib_has_errors="y"
|
||||||
|
}
|
||||||
|
|
||||||
|
[ ! -f "./common.d/common.${image_type}.sh" ] && {
|
||||||
|
log "LNIBUILD: unsupported image type" ierror
|
||||||
|
lnib_has_errors="y"
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "$lnib_has_errors" == "y" ] && {
|
||||||
|
log "Incorrect LNIBUILD" error
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
source "./common.d/common.${image_type}.sh"
|
||||||
|
log "Making image: $name"
|
||||||
|
log "Image type: $image_type"
|
||||||
|
|
||||||
|
log "Creating image: $(get_image_path "$name")"
|
||||||
|
create_image "$name" || _shutdown 1
|
||||||
|
imageroot="$(mount_image "$name")"
|
||||||
|
|
||||||
|
log "Fetching base system"
|
||||||
|
base_system || _shutdown 1
|
||||||
|
|
||||||
|
log "Preparing chroot"
|
||||||
|
prepare_chroot "$imageroot" || _shutdown 1
|
||||||
|
|
||||||
|
[[ $(type -t pre_install) == function ]] && {
|
||||||
|
log "Running pre install hook"
|
||||||
|
pre_install || _shutdown 1
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Setting up inet"
|
||||||
|
setup_inet "$imageroot" || _shutdown 1
|
||||||
|
|
||||||
|
log "Prepare system"
|
||||||
|
prepare_system "$imageroot" || _shutdown 1
|
||||||
|
|
||||||
|
if (( ${#packages[@]} )); then
|
||||||
|
log "Installing packages: ${packages[*]}"
|
||||||
|
install_packages "$imageroot" "${packages[@]}" || _shutdown 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Installing kernel and firmwares"
|
||||||
|
log "Configuring dynamic linker run-time bindings"
|
||||||
|
log "Enabling userspace daemons"
|
||||||
|
install_nabu_packages "$imageroot" || _shutdown 1
|
||||||
|
|
||||||
|
if [ "$zram" == "y" ]; then
|
||||||
|
log "Setting up zram"
|
||||||
|
setup_zram_generator "$imageroot" || _shutdown 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Finishing system image"
|
||||||
|
finish_system "$imageroot" || _shutdown 1
|
||||||
|
|
||||||
|
log "Generating fstab"
|
||||||
|
gen_fstab "$imageroot" || _shutdown 1
|
||||||
|
|
||||||
|
[[ $(type -t post_install) == function ]] && {
|
||||||
|
log "Running post install hook"
|
||||||
|
post_install || _shutdown 1
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Detaching chroot"
|
||||||
|
detach_chroot "$imageroot" || _shutdown 1
|
||||||
|
|
||||||
|
log "Unmounting image"
|
||||||
|
umount_image "$imageroot" || _shutdown 1
|
||||||
|
|
||||||
|
log "Trimming image"
|
||||||
|
trim_image "$name" || _shutdown 1
|
||||||
|
|
||||||
|
log "Image build finished"
|
Loading…
Reference in a new issue