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
!config/
config/*
!config/etc/
config/etc/*
!config/etc/motd
!config/.gitkeep

View File

@ -1,6 +1,7 @@
.PHONY: sdcard images clean
A=./artifacts
C=./config
R=./resources
S=./scripts
@ -24,6 +25,7 @@ INITRD=$(A)/initramfs
FIRMWARE_TAR=$(A)/firmware.tar
MODULES_TAR=$(A)/modules.tar
ROOTFS_TAR=$(A)/rootfs.tar
CONFIG_TAR=$(A)/config.tar
ROOTFS=$(A)/rootfs.img
IMAGES=$(SPL) $(UBOOT) $(ENV) $(RESOURCES) $(BOOT) $(ROOTFS)
SD=$(A)/alpine-h700.img
@ -63,10 +65,14 @@ $(ROOTFS_TAR):
$(FIRMWARE_TAR) $(MODULES_TAR): $(FACTORY_IMAGE)
$(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) $@
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:
$(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:
- `make` (specifically, GNU Make) to orchestrate the build and track dependencies
- `python3` to run some of the provided scripts; only modules from the standard
library are used
- `make` (specifically, GNU Make) to orchestrate the build and track
dependencies
- `python3` to run some of the provided scripts; only modules from the
standard library are used
- `sgdisk` to manipulate GPT partition tables
- `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
- `qemu-user-static-aarch64` to enable `podman` to run aarch64 container
images on a different architecture like x86_64
An image of a stock SD card is required in order to extract components that are
specific to the H700 SoC that do not have open source alternatives yet; those
components are:
An image of a stock SD card is required in order to extract components that
are specific to the H700 SoC that do not have open source alternatives yet;
those components are:
- the SPL
- the U-Boot bootloader
@ -48,9 +51,11 @@ A good staring point would be something like this (replace `$ssid` and
```shell
mkdir -p config/etc/wpa_supplicant
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
cat ~/.ssh/id_*.pub >config/root/.ssh/authorized_keys
chmod 700 config/root config/root/.ssh
```
### 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 -X "$(awk '/\/alpine\/[^\/]+\/main$/{print;exit}' /etc/apk/repositories)" \
--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/"
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"
sed -Ei 's/^(tty[0-9]+:)/#\1/;s/^#ttyS0:/ttyS0:/' "$target/etc/inittab"
echo h700 >"$target/etc/hostname"