aeeon/up: rework and fix

Rework the entire Makefile.
The go install commands have changed.
For cpu, u-root now requires explicit Go workspace setups.
Elvish was dropped in favor of gosh.

The other Makefiles will also need fixing.
This one is the first running on CI, so start with it.

Signed-off-by: Daniel Maslowski <info@orangecms.org>
This commit is contained in:
Daniel Maslowski 2024-09-20 17:31:24 +02:00
parent 2a47c27339
commit 0aed224be0

View File

@ -1,11 +1,93 @@
INITRAMFS:=initramfs.linux_amd64.cpio
default: build
build:
echo fetch, uroot, flashkernel, or image.bin
echo Run 'make fetch' first, which prepares the mainline build environment.
echo Obtain the ROM image; download from the Internet or read from flash.
echo Then make other targets, starting with a u-root flavor, finally Linux.
echo When the new image is built, write it to flash.
# Prepare
fetch: getrom prepgows getfiano getkernel
getkernel:
rm -rf linux
git clone --depth=1 https://github.com/linuxboot/linux
getstablekernel:
wget -O kernel.xz https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.3.10.tar.xz
xzcat kernel.xz | tar x
mv linux-5.3.10 linux
upgetkernel:
rm -rf linux
git clone --depth=1 https://github.com/emutex/ubilinux-kernel.git -b upboard-4.9 linux
# Set up the Go workspace, including cpu.
# see https://github.com/u-root/u-root?tab=readme-ov-file#multi-module-workspace-builds
# NOTE: goanywhere is nice, but how would we combine cpud and u-root templates?
prepgows:
git clone --depth 1 https://github.com/u-root/u-root
git clone --depth 1 https://github.com/u-root/cpu
go work init ./u-root
go work use ./cpu
getfiano:
go install github.com/linuxboot/fiano/cmds/utk@latest
# initramfs
alluroot:
cd u-root && go run . -o $(INITRAMFS) \
-initcmd=cpud -files ~/.ssh/cpu_rsa.pub:key.pub ../cpu/cmds/cpud \
all
cpuuroot:
cd u-root && go run . -o $(INITRAMFS) \
-defaultsh="" \
-initcmd=cpud -files ~/.ssh/cpu_rsa.pub:key.pub ../cpu/cmds/cpud
# TODO: Should we use a template instead? Or define one in this repo?
# https://github.com/u-root/u-root/blob/main/.mkuimage.yaml
neturoot:
cd u-root && go run . -o $(INITRAMFS) \
./cmds/core/init \
./cmds/core/ls \
./cmds/core/ip \
./cmds/core/gosh \
./cmds/core/sshd \
./cmds/core/scp \
./cmds/boot/*
uroot.lzma:
lzma -f -k ./u-root/$(INITRAMFS)
ls -l u-root/initramfs*
cp u-root/*lzma linux
# Linux
# FIXME: The current config does not include the initramfs. Should it?
bzImage:
cp linuxboot-linux.config linux/.config
(cd linux && make oldconfig && make -j32)
stablebzImage:
echo "the config is from https://github.com/emutex/ubilinux-kernel/issues/2#issue-294853930"
cp ts.config.txt linux/.config
(cd linux && make oldconfig && make -j32)
flashkernel: cpuuroot uroot.lzma bzImage
cp linux/arch/x86/boot/bzImage flashkernel
netboot: neturoot uroot.lzma bzImage
cp linux/arch/x86/boot/bzImage kernel
# ROM operations
image.bin:
utk \
-xzPath /usr/bin/xz \
utk -xzPath /usr/bin/xz \
ROM.bin \
remove Nb.* \
remove IntelIsh.* \
@ -46,15 +128,14 @@ image.bin:
remove Setup \
save image.bin
utk image.bin table | guid2english | grep Free
echo \
remove AmiTc.* \
# FIXME: What is this?
echo remove AmiTc.*
echo need 0x16b4a0
flashkernel: uroot bzImage
cp linux/arch/x86/boot/bzImage flashkernel
netboot: netbooturoot bzImage
cp linux/arch/x86/boot/bzImage kernel
getrom:
echo you can put a wget here
echo and unxip it
echo and cp it to sr630.bin
readrom:
echo You need to get a ROM image from *somewhere*
@ -63,58 +144,3 @@ readrom:
writerom: image.bin
echo Here is where you would do the flashrom, e.g.
echo sudo flashrom -p dediprog -w image.bin
netbooturoot:
go run github.com/u-root/u-root -o linux/initramfs.linux_amd64.cpio -build=bb github.com/u-root/u-root/cmds/core/init github.com/u-root/u-root/cmds/core/ls github.com/u-root/u-root/cmds/core/ip github.com/u-root/u-root/cmds/core/elvish github.com/u-root/u-root/cmds/core/sshd github.com/u-root/u-root/cmds/core/scp github.com/u-root/u-root/cmds/boot/*
uroot.lzma: uroot
lzma -f -k initramfs.linux_amd64.cpio
uroot:
go run github.com/u-root/u-root -o initramfs.linux_amd64.cpio -build=bb -initcmd=cpud -files ~/.ssh/cpu_rsa.pub:key.pub \
-defaultsh="" \
github.com/u-root/cpu/cmds/cpud
alluroot:
go run github.com/u-root/u-root -o initramfs.linux_amd64.cpio -build=bb -initcmd=cpud -files ~/.ssh/cpu_rsa.pub:key.pub \
github.com/u-root/cpu/cmds/cpud \
all
lzma -k -f initramfs.linux_amd64.cpio
ls -l initramfs*
cp *lzma linux
bzImage:
cp linuxboot-linux.config linux/.config
(cd linux && make oldconfig && make -j32)
stablebzImage:
echo the config is from https://github.com/emutex/ubilinux-kernel/issues/2#issue-294853930
cp ts.config.txt linux/.config
(cd linux && make oldconfig && make -j32)
fetch: getkernel geturoot getfiano getrom
getkernel:
rm -rf linux
git clone --depth=1 https://github.com/linuxboot/linux
getstablekernel:
wget -O kernel.xz https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.3.10.tar.xz
xzcat kernel.xz | tar x
mv linux-5.3.10 linux
upgetkernel:
rm -rf linux
git clone --depth=1 https://github.com/emutex/ubilinux-kernel.git -b upboard-4.9 linux
getfiano:
go get -u github.com/linuxboot/fiano/cmds/utk
go install github.com/linuxboot/fiano/cmds/utk
getrom:
echo you can put a wget here
echo and unxip it
echo and cp it to sr630.bin
geturoot:
go get -u github.com/u-root/u-root
go get -u github.com/u-root/cpu/...