Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for pinball-amd64-generic.img on debian 12 #43

Merged
merged 6 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions extra/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ architecture?=i386

mirror?=https://deb.debian.org/debian
scratchsize?=4G
suite?=bullseye
suite?=bookworm

flags?=-v
flags+=--scratchsize=${scratchsize}
flags+=-tsuite:${suite}
flags+=-tmirror:${mirror}

# Disable if needed (ubuntu-22.04)
# flags+=--disable-fakemachine

images_lists ?= ${project}-i386-generic.img
images_lists += ${project}-amd64-generic.img

Expand All @@ -37,12 +40,18 @@ help: Makefile
@echo "# ${<D}/${<F} help # This help"
@echo "# ${<D}/${<F} img architecture=${architecture} machine=${machine} # To build image"

setup:
${sudo} apt install -y debos
${sudo} usermod -a -G kvm ${USER}
${sudo} chmod -R a+r /boot/vmlinuz-$(shell uname -r)

all: img

rule/debos/%.yaml: debos/%.yaml \
profile \
profile/pinball/etc/pinball/setup.sh
ls $^
time debos ${flags} --dry-run --verbose $<
time debos ${flags} $< | tee ${@F}.log.tmp

rule/debos/all: debos/machine/
Expand Down Expand Up @@ -82,12 +91,27 @@ rpi_4:
gzip -f -9 $<
stat -c '%y: %n' $@

run: pinball-i386-generic.img
kvm -m 512 \
ram_size?=512
port?=55522
i386/run: pinball-i386-generic.img
kvm \
-m ${ram_size} \
-device e1000,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::55522-:22 \
-net nic,model=ne2k_pci -net user \
-netdev user,id=net0,hostfwd=tcp::${port}-:22 \
-machine pc $<

bootfile?=/usr/share/OVMF/OVMF_CODE_4M.fd
amd64/run: pinball-amd64-generic.img ${bootfile}
qemu-system-x86_64 \
-enable-kvm \
-m ${ram_size} \
-cpu host \
-drive file=${bootfile},if=pflash,format=raw,unit=0,readonly=on \
-drive file=$<,format=raw \
-device e1000,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::${port}-:22

run: ${architecture}/run

cleanall:
rm -rf *.img *.img.gz
38 changes: 18 additions & 20 deletions extra/debos/machine/generic/actions.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{{- $architecture := or .architecture "i386" -}}
{{- $bootloader := or .bootloader "grub-pc" -}}
{{- $machine := or .machine "generic" -}}
{{- $partitiontype := or .partitiontype "msdos" -}}
{{- $project := or .project "pinball" -}}
{{- $suite := or .suite "bullseye" -}}
{{- $suite := or .suite "bookworm" -}}
{{- $image := or .image (printf "%s-%s-%s.img" $project $architecture $machine) -}}

architecture: {{$architecture}}
Expand All @@ -11,33 +13,29 @@ actions:
- action: image-partition
imagename: {{$image}}
imagesize: 2GB
partitiontype: msdos
partitiontype: {{$partitiontype}}
mountpoints:
- mountpoint: /
partition: root
{{if eq $bootloader "grub-efi"}}
- mountpoint: /boot/efi
partition: efi
flags: [ boot ]
{{end}}
partitions:
{{if eq $bootloader "grub-efi"}}
- name: efi
fs: vfat
start: 0%
end: 128MB
{{end}}
- name: root
fs: ext4
start: 512
start: 128MB
end: 100%
flags: [boot]

- action: apt
packages:
{{if eq $architecture "i386" "amd64"}}
- grub-pc
{{end}}
{{if eq $suite "unstable" "sid" "testing" "bullseye"}}
- linux-image-generic
{{else}}
{{if eq $suite "buster" "stable"}}
{{if eq $architecture "i386"}}
- linux-image-686
{{else}}
- linux-image-{{$architecture}}
{{end}}
{{end}}
{{end}}
- {{$bootloader}}
- linux-image-{{$machine}}
- firmware-linux-free
- firmware-linux-nonfree

14 changes: 11 additions & 3 deletions extra/debos/machine/generic/image.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- $architecture := or .architecture "i386" -}}
{{- $bootloader := or .bootloader "grub-pc" -}}

architecture: {{$architecture}}

Expand All @@ -7,7 +8,14 @@ actions:
description: Install bootloader
chroot: true
command: >
{{if eq $architecture "i386" "amd64"}}
update-grub
&& grub-install /dev/disk/by-id/virtio-fakedisk-0
{{if eq $architecture "i386"}}
update-grub
&& grub-install /dev/disk/by-id/virtio-fakedisk-0
{{else}}
{{if eq $architecture "amd64"}}
update-grub
&& grub-install --target=x86_64-efi --no-nvram
&& mkdir -p /boot/efi/EFI/BOOT
&& cp /boot/efi/EFI/debian/grubx64.efi /boot/efi/EFI/BOOT/BOOTX64.EFI
{{end}}
{{end}}
6 changes: 5 additions & 1 deletion extra/debos/machine/generic/pinball-amd64.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{{- $architecture := or .architecture "amd64" -}}
{{- $bootloader := or .bootloader "grub-efi" -}}
{{- $machine := or .machine "generic" -}}
{{- $mirror := or .mirror "https://deb.debian.org/debian" -}}
{{- $suite := or .suite "bullseye" -}}
{{- $partitiontype := or .partitiontype "gpt" -}}
{{- $suite := or .suite "bookworm" -}}

architecture: {{$architecture}}

Expand All @@ -11,6 +13,8 @@ actions:
recipe: ../../pinball.yaml
variables:
architecture: {{$architecture}}
bootloader: {{$bootloader}}
machine: {{$machine}}
mirror: {{$mirror}}
partitiontype: {{$partitiontype}}
suite: {{$suite}}
6 changes: 5 additions & 1 deletion extra/debos/machine/generic/pinball-i386.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{{- $architecture := or .architecture "i386" -}}
{{- $bootloader := or .bootloader "grub-pc" -}}
{{- $machine := or .machine "generic" -}}
{{- $mirror := or .mirror "https://deb.debian.org/debian" -}}
{{- $suite := or .suite "bullseye" -}}
{{- $partitiontype := or .partitiontype "msdos" -}}
{{- $suite := or .suite "bookworm" -}}

architecture: {{$architecture}}

Expand All @@ -11,6 +13,8 @@ actions:
recipe: ../../pinball.yaml
variables:
architecture: {{$architecture}}
bootloader: {{$bootloader}}
machine: {{$machine}}
mirror: {{$mirror}}
partitiontype: {{$partitiontype}}
suite: {{$suite}}
22 changes: 12 additions & 10 deletions extra/debos/machine/rpi_2/actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{- $kernel := or .kernel "linux-image-armmp" -}}
{{- $machine := or .machine "rpi_2" -}}
{{- $project := or .project "pinball" -}}
{{- $suite := or .suite "bullseye" -}}
{{- $suite := or .suite "bookworm" -}}
{{- $uboot_machine := or .uboot_machine (printf "%s" $machine) -}}
{{- $image := or .image (printf "%s-%s-%s.img" $project $architecture $machine) -}}

Expand Down Expand Up @@ -64,24 +64,26 @@ actions:
- action: run
chroot: true
command: >
echo "# /boot/firmware/config.txt"
| tee /boot/firmware/config.txt \
echo "# /etc/default/raspi-firmware-custom"
| tee /etc/default/raspi-firmware-custom \
{{if eq $architecture "arm64"}}
&& echo 'arm_64bit=1'
| tee -a /boot/firmware/config.txt \
| tee -a /etc/default/raspi-firmware-custom \
{{else}}
&& echo 'arm_64bit=0'
| tee -a /boot/firmware/config.txt \
| tee -a /etc/default/raspi-firmware-custom \
{{end}}
&& echo 'enable_uart=1'
| tee -a /boot/firmware/config.txt
| tee -a /etc/default/raspi-firmware-custom
&& echo 'uart_2ndstage'
| tee -a /boot/firmware/config.txt
| tee -a /etc/default/raspi-firmware-custom
&& echo 'kernel=u-boot.bin'
| tee -a /boot/firmware/config.txt
| tee -a /etc/default/raspi-firmware-custom
&& echo 'upstream_kernel=1'
| tee -a /boot/firmware/config.txt
&& cat /boot/firmware/config.txt
| tee -a /etc/default/raspi-firmware-custom
&& echo 'disable_overscan=1'
| tee -a /etc/default/raspi-firmware-custom
&& cat /etc/default/raspi-firmware-custom

- action: run
chroot: true
Expand Down
2 changes: 1 addition & 1 deletion extra/debos/machine/rpi_2/pinball-rpi_2.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- $architecture := or .architecture "armhf" -}}
{{- $machine := or .machine "rpi_2" -}}
{{- $suite := or .suite "bullseye" -}}
{{- $suite := or .suite "bookworm" -}}
{{- $uboot_machine := or .uboot_machine "rpi_2" -}}

architecture: {{$architecture}}
Expand Down
2 changes: 1 addition & 1 deletion extra/debos/machine/rpi_3_32b/actions.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- $architecture := or .architecture "armhf" -}}
{{- $kernel := or .kernel "linux-image-armmp" -}}
{{- $machine := or .machine "rpi_3_32b" -}}
{{- $suite := or .suite "bullseye" -}}
{{- $suite := or .suite "bookworm" -}}
{{- $uboot_machine := or .uboot_machine "rpi_3_32b" -}}

architecture: {{$architecture}}
Expand Down
2 changes: 1 addition & 1 deletion extra/debos/machine/rpi_3_32b/image.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- $architecture := or .architecture "armhf" -}}
{{- $kernel := or .kernel "linux-image-armmp" -}}
{{- $machine := or .machine "rpi_3_32b" -}}
{{- $suite := or .suite "bullseye" -}}
{{- $suite := or .suite "bookworm" -}}

architecture: {{$architecture}}

Expand Down
2 changes: 1 addition & 1 deletion extra/debos/machine/rpi_3_32b/pinball-rpi_3_32b.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- $architecture := or .architecture "armhf" -}}
{{- $image := or .image "pinball-rpi_3_32b.img" -}}
{{- $machine := or .machine "rpi_3_32b" -}}
{{- $suite := or .suite "bullseye" -}}
{{- $suite := or .suite "bookworm" -}}
{{- $uboot_machine := or .uboot_machine "rpi_3_32b" -}}

architecture: {{$architecture}}
Expand Down
2 changes: 1 addition & 1 deletion extra/debos/machine/rpi_3_64b/actions.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- $architecture := or .architecture "arm64" -}}
{{- $kernel := or .kernel "linux-image-generic" -}}
{{- $machine := or .machine "rpi_3_64b" -}}
{{- $suite := or .suite "bullseye" -}}
{{- $suite := or .suite "bookworm" -}}
{{- $uboot_machine := or .uboot_machine "rpi_3" -}}

architecture: {{$architecture}}
Expand Down
2 changes: 1 addition & 1 deletion extra/debos/machine/rpi_3_64b/image.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- $architecture := or .architecture "arm64" -}}
{{- $kernel := or .kernel "linux-image-generic" -}}
{{- $machine := or .machine "rpi_3_64b" -}}
{{- $suite := or .suite "bullseye" -}}
{{- $suite := or .suite "bookworm" -}}

architecture: {{$architecture}}

Expand Down
2 changes: 1 addition & 1 deletion extra/debos/machine/rpi_3_64b/pinball-rpi_3_64b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{- $image := or .image "pinball-rpi_3_64b.img" -}}
{{- $kernel := or .kernel "linux-image-generic" -}}
{{- $machine := or .machine "rpi_3_64b" -}}
{{- $suite := or .suite "bullseye" -}}
{{- $suite := or .suite "bookworm" -}}
{{- $uboot_machine := or .uboot_machine "rpi_3" -}}

architecture: {{$architecture}}
Expand Down
2 changes: 1 addition & 1 deletion extra/debos/machine/rpi_4/actions.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- $architecture := or .architecture "arm64" -}}
{{- $kernel := or .kernel "linux-image-generic" -}}
{{- $machine := or .machine "rpi_4" -}}
{{- $suite := or .suite "bullseye" -}}
{{- $suite := or .suite "bookworm" -}}
{{- $uboot_machine := or .uboot_machine "rpi4" -}}

architecture: {{$architecture}}
Expand Down
2 changes: 1 addition & 1 deletion extra/debos/machine/rpi_4/image.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- $architecture := or .architecture "arm64" -}}
{{- $kernel := or .kernel "linux-image-generic" -}}
{{- $machine := or .machine "rpi_4" -}}
{{- $suite := or .suite "bullseye" -}}
{{- $suite := or .suite "bookworm" -}}

architecture: {{$architecture}}

Expand Down
2 changes: 1 addition & 1 deletion extra/debos/machine/rpi_4/pinball-rpi_4.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- $architecture := or .architecture "arm64" -}}
{{- $machine := or .machine "rpi_4" -}}
{{- $mirror := or .mirror "https://deb.debian.org/debian" -}}
{{- $suite := or .suite "bullseye" -}}
{{- $suite := or .suite "bookworm" -}}
{{- $uboot_machine := or .uboot_machine "rpi_4" -}}

architecture: {{$architecture}}
Expand Down
10 changes: 8 additions & 2 deletions extra/debos/pinball.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
{{- $machine := or .machine "generic" -}}
{{- $mirror := or .mirror "https://deb.debian.org/debian" -}}
{{- $project := or .project "pinball" -}}
{{- $suite := or .suite "bullseye" -}}
{{- $suite := or .suite "bookworm" -}}
{{- $bootloader := or .bootloader "grub-pc" -}}
{{- $partitiontype := or .partitiontype "msdos" -}}
{{- $uboot_machine := or .uboot_machine "generic" -}}
{{- $image := or .image (printf "%s-%s-%s.img" $project $architecture $machine) -}}

Expand All @@ -15,6 +17,7 @@ actions:
components:
- main
- non-free
- non-free-firmware
mirror: {{$mirror}}
variant: minbase

Expand All @@ -24,7 +27,7 @@ actions:
cat /etc/os-release
cat<<EOF
URL: https://purl.org/rzr/pinball#

architecture: {{$architecture}}
image: {{$image}}
machine: {{$machine}}
Expand All @@ -49,6 +52,8 @@ actions:
image: {{$image}}
machine: {{$machine}}
uboot_machine: {{$uboot_machine}}
bootloader: {{$bootloader}}
partitiontype: {{$partitiontype}}

- action: run
chroot: true
Expand Down Expand Up @@ -82,6 +87,7 @@ actions:
recipe: machine/{{$machine}}/image.yaml
variables:
architecture: {{$architecture}}
bootloader: {{$bootloader}}
image: {{$image}}
machine: {{$machine}}
uboot_machine: {{$uboot_machine}}
Loading
Loading