Fix config files permission issue

Also:
- move custom /etc/motd out of config dir
- add dropbear-scp package

Signed-off-by: Maurizio Porrato <maurizio.porrato@gmail.com>
This commit is contained in:
Maurizio Porrato 2024-07-13 08:31:48 +01:00
parent 3216669497
commit 14a689f1b8
No known key found for this signature in database
6 changed files with 34 additions and 24 deletions

5
.gitignore vendored
View File

@ -1,6 +1,3 @@
*.img *.img
!config/
config/* config/*
!config/etc/ !config/.gitkeep
config/etc/*
!config/etc/motd

View File

@ -1,6 +1,7 @@
.PHONY: sdcard images clean .PHONY: sdcard images clean
A=./artifacts A=./artifacts
C=./config
R=./resources R=./resources
S=./scripts S=./scripts
@ -24,6 +25,7 @@ INITRD=$(A)/initramfs
FIRMWARE_TAR=$(A)/firmware.tar FIRMWARE_TAR=$(A)/firmware.tar
MODULES_TAR=$(A)/modules.tar MODULES_TAR=$(A)/modules.tar
ROOTFS_TAR=$(A)/rootfs.tar ROOTFS_TAR=$(A)/rootfs.tar
CONFIG_TAR=$(A)/config.tar
ROOTFS=$(A)/rootfs.img ROOTFS=$(A)/rootfs.img
IMAGES=$(SPL) $(UBOOT) $(ENV) $(RESOURCES) $(BOOT) $(ROOTFS) IMAGES=$(SPL) $(UBOOT) $(ENV) $(RESOURCES) $(BOOT) $(ROOTFS)
SD=$(A)/alpine-h700.img SD=$(A)/alpine-h700.img
@ -63,10 +65,14 @@ $(ROOTFS_TAR):
$(FIRMWARE_TAR) $(MODULES_TAR): $(FACTORY_IMAGE) $(FIRMWARE_TAR) $(MODULES_TAR): $(FACTORY_IMAGE)
$(S)/extract-modules.sh $< $(A) $(S)/extract-modules.sh $< $(A)
$(ROOTFS): $(ROOTFS_TAR) $(FIRMWARE_TAR) $(MODULES_TAR) $(CONFIG_TAR): $(shell find $(C) -type f -print0 | xargs -0)
date --utc "+%Y-%m-%dT%H:%M:%SZ" >$(C)/.build
fakeroot -- tar cf $@ --exclude .gitkeep -C $(C) .
$(ROOTFS): $(ROOTFS_TAR) $(FIRMWARE_TAR) $(MODULES_TAR) $(CONFIG_TAR)
$(RM) $@ $(RM) $@
truncate -s $(ROOTFS_SIZE) $@ truncate -s $(ROOTFS_SIZE) $@
$(S)/mkfsimage.sh $@ 0 ext4 rootfs $(ROOTFS_TAR) $(FIRMWARE_TAR):/lib/firmware/ $(MODULES_TAR):/lib/modules/ config $(S)/mkfsimage.sh $@ 0 ext4 rootfs $(ROOTFS_TAR) $(FIRMWARE_TAR):/lib/firmware/ $(MODULES_TAR):/lib/modules/ config.tar
clean: clean:
$(RM) $(A)/* $(RM) $(A)/*

View File

@ -14,18 +14,21 @@ image has been tested on an Anbernic RG35XX Plus portable console.
The scripts require the following software: The scripts require the following software:
- `make` (specifically, GNU Make) to orchestrate the build and track dependencies - `make` (specifically, GNU Make) to orchestrate the build and track
- `python3` to run some of the provided scripts; only modules from the standard dependencies
library are used - `python3` to run some of the provided scripts; only modules from the
standard library are used
- `sgdisk` to manipulate GPT partition tables - `sgdisk` to manipulate GPT partition tables
- `guestfish` to manipulate filesystem images without root privileges - `guestfish` to manipulate filesystem images without root privileges
- `fakeroot` to inject custom configuration files into the rootfs image
without root privileges
- `podman` to provide an Alpine Linux environment - `podman` to provide an Alpine Linux environment
- `qemu-user-static-aarch64` to enable `podman` to run aarch64 container - `qemu-user-static-aarch64` to enable `podman` to run aarch64 container
images on a different architecture like x86_64 images on a different architecture like x86_64
An image of a stock SD card is required in order to extract components that are An image of a stock SD card is required in order to extract components that
specific to the H700 SoC that do not have open source alternatives yet; those are specific to the H700 SoC that do not have open source alternatives yet;
components are: those components are:
- the SPL - the SPL
- the U-Boot bootloader - the U-Boot bootloader
@ -48,9 +51,11 @@ A good staring point would be something like this (replace `$ssid` and
```shell ```shell
mkdir -p config/etc/wpa_supplicant mkdir -p config/etc/wpa_supplicant
wpa_passphrase '$ssid' '$password' >config/etc/wpa_supplicant/wpa_supplicant.conf wpa_passphrase '$ssid' '$password' >config/etc/wpa_supplicant/wpa_supplicant.conf
chmod 600 config/etc/wpa_supplicant/wpa_supplicant.conf
mkdir -p config/root/.ssh mkdir -p config/root/.ssh
cat ~/.ssh/id_*.pub >config/root/.ssh/authorized_keys cat ~/.ssh/id_*.pub >config/root/.ssh/authorized_keys
chmod 700 config/root config/root/.ssh
``` ```
### Stock SD card image ### Stock SD card image

0
config/.gitkeep Normal file
View File

View File

@ -1,11 +0,0 @@
Welcome to Alpine!
This is an unofficial port to the Allwinner H700 SoC: please report
issues to https://github.com/mporrato/alpine-h700 .
The Alpine Wiki contains a large amount of how-to guides and general
information about administrating Alpine systems.
See <https://wiki.alpinelinux.org/>.
You may change this message by editing /etc/motd.

View File

@ -9,8 +9,21 @@ trap 'rm -rf "$target"' 0
apk update apk update
apk -X "$(awk '/\/alpine\/[^\/]+\/main$/{print;exit}' /etc/apk/repositories)" \ apk -X "$(awk '/\/alpine\/[^\/]+\/main$/{print;exit}' /etc/apk/repositories)" \
--keys-dir /etc/apk/keys -U -p "$target/" --initdb \ --keys-dir /etc/apk/keys -U -p "$target/" --initdb \
add alpine-base alpine-release ca-certificates wpa_supplicant dropbear add alpine-base alpine-release ca-certificates wpa_supplicant dropbear dropbear-scp
cp /etc/apk/repositories "$target/etc/apk/" cp /etc/apk/repositories "$target/etc/apk/"
cat >"$target/etc/motd" <<__EOF__
Welcome to Alpine!
This is an unofficial port to the Allwinner H700 SoC: please report
issues to https://github.com/mporrato/alpine-h700 .
The Alpine Wiki contains a large amount of how-to guides and general
information about administrating Alpine systems.
See <https://wiki.alpinelinux.org/>.
You may change this message by editing /etc/motd.
__EOF__
echo "nameserver 8.8.8.8" >"$target/etc/resolv.conf" echo "nameserver 8.8.8.8" >"$target/etc/resolv.conf"
sed -Ei 's/^(tty[0-9]+:)/#\1/;s/^#ttyS0:/ttyS0:/' "$target/etc/inittab" sed -Ei 's/^(tty[0-9]+:)/#\1/;s/^#ttyS0:/ttyS0:/' "$target/etc/inittab"
echo h700 >"$target/etc/hostname" echo h700 >"$target/etc/hostname"