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

update things for 0.6.x work #82

Merged
merged 13 commits into from
Aug 10, 2022
17 changes: 12 additions & 5 deletions .github/workflows/build-cirros.yaml
Expand Up @@ -12,14 +12,12 @@ jobs:
cirros-build-matrix:
strategy:
matrix:
# i386, powerpc, and ppc64 will be dropped in CirrOS 0.6.x
arch: [aarch64, arm, i386, x86_64, powerpc, ppc64, ppc64le]
arch: [aarch64, arm, x86_64, ppc64le]

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

env:
ARCHES: ${{ matrix.arch }}
BOOTTEST: "true"
QUIET: 1
CI_BUILD: "true"
CI_BUILD_OUT: "build-ci/"
Expand All @@ -46,9 +44,18 @@ jobs:
- name: Install job dependencies
run: sudo apt-get install cloud-utils qemu-system openbios-ppc

- name: Build cirros image
- name: disable invisible-mirror.net use
run: echo "127.0.0.1 invisible-mirror.net" | sudo tee -a /etc/hosts

- name: Build CirrOS image
run: bin/build-release daily

- name: Boot CirrOS image
run: bin/test-boot
env:
GUESTARCH: ${{ matrix.arch }}
POWEROFF: "true"

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
@@ -1,7 +1,7 @@
build*
buildroot*
ccache
download
ccache/*
download/*
grubd
output
src/etc/cirros/version
24 changes: 24 additions & 0 deletions ChangeLog
@@ -1,3 +1,27 @@
0.6.0
- move to buildroot 2022.02.5
- use Ubuntu 22.04 (5.15) kernels for aarch64, arm, ppc64le, x86_64
- grub 2.06-2ubuntu7 for same archs as above
- dropped support for i386, powerpc, ppc64 architectures as they are not
supported by Ubuntu 22.04 so we do not have kernel
- arm image is ARMv7 now to follow armhf distributions
- CirrOS instance memory requirements:
- 128MB
- arm (virt with direct kernel boot)
- x86_64 (bios boot)
- 192MB
- aarch64 (virt with direct kernel boot)
- 256MB
- ppc64le
- x86_64 (uefi)
- 272MB
- aarch64 (virt with uefi)
- updated SSL certificates
- switched to dhcpcd for network setup
- setup all available interfaces automatically
- handle IPv6 variants properly (SLAAC vs DHCPv6)
- added e1000e module for PCI Express based Intel network cards

0.5.2
- added ahci module to the image

Expand Down
31 changes: 14 additions & 17 deletions README.md
Expand Up @@ -9,22 +9,19 @@ CirrOS images have useful tools and function for debugging or developing cloud i

* aarch64 (64-bit Armv8 often called arm64)
* arm (32-bit Armv7)
* i386 (32-bit x86)
* ppc (32-bit PowerPC)
* ppc64 (64-bit Power big endian)
* ppc64le (64-bit Power little endian)
* x86_64 (64-bit x86 often called amd64)

Resulting images can be booted using QEMU. Several ways of booting are provided:

* UEFI (aarch64, arm, i386, x86_64)
* BIOS (i386, x86_64)
* OpenFirmware (ppc, ppc64, ppc64le)
* UEFI (aarch64, arm, x86_64)
* BIOS (x86_64)
* OpenFirmware (ppc64le)
* direct kernel + initrd (all architectures)

# Build instructions

The following works on Ubuntu 18.04 LTS, running on x86_64. Native building for other architectures is not recommended. Support for building under other distributions is limited and not tested.
The following works on Ubuntu 22.04 LTS, running on x86_64. Native building for other architectures is not recommended. Support for building under other distributions is limited and not tested.

## Clone sources

Expand All @@ -34,7 +31,7 @@ The following works on Ubuntu 18.04 LTS, running on x86_64. Native building for

## Install required software

To get build going we need some packages installed. If you use Ubuntu 18.04 LTS then all you need to do is:
To get build going we need some packages installed. If you use Ubuntu 22.04 LTS then all you need to do is:

* cd cirros

Expand All @@ -53,7 +50,8 @@ Once you fetched source code all you have to do something like:
* cd cirros
* bin/build-release daily

If you want to build for only subset of supported architectures when use ARCHES variable like:
If you want to build for only a subset of supported architectures, use
the ARCHES variable like:

* ARCHES=aarch64,x86_64,arm bin/build-release daily

Expand All @@ -66,7 +64,7 @@ To use it, you would do something like:

* download buildroot and setup environment
```bash
$ br_ver="2019.02.1"
$ br_ver="2022.02.4"
$ mkdir -p ../download
$ ln -snf ../download download
$ ( cd download && wget http://buildroot.uclibc.org/downloads/buildroot-${br_ver}.tar.gz )
Expand All @@ -88,11 +86,11 @@ To use it, you would do something like:

* download the buildroot sources
```bash
$ ARCH=i386
$ ARCH=x86_64
$ make ARCH=$ARCH br-source
```

* Build buildroot for a given arch (ARCH should be set to 'i386', 'x86_64', 'arm' or 'aarch64')
* Build buildroot for a given arch (ARCH should be set to 'x86_64', 'arm', 'aarch64' or 'ppc64le')
```bash
$ make ARCH=$ARCH OUT_D=$PWD/output/$ARCH
```
Expand All @@ -102,23 +100,22 @@ This will do a full buildroot build, which will take a while. The output that Ci
* Download a kernel to use. The kernel input to bundle must be in deb format. The ubuntu '-virtual' kernel is used as a starting point. Version can be taken from https://launchpad.net/ubuntu/+source/linux page.

```bash
$ kver="4.4.0-148.174"
$ kver="5.15.0-33.34"
$ ./bin/grab-kernels "$kver" $ARCH
```

* Download EFI grub to use (aarch64, arm, i386, x86_64 only). The grub-efi input to bundle will be in tar.gz format. Version can be taken from https://launchpad.net/ubuntu/+source/grub2 page.
* Download EFI grub to use (aarch64, arm, x86_64 only). The grub-efi input to bundle will be in tar.gz format. Version can be taken from https://launchpad.net/ubuntu/+source/grub2 page.
```bash
$ gver="2.02~beta2-36ubuntu3.22"
$ gver="2.06-2ubuntu7"
$ ./bin/grab-grub-efi "$gver" $ARCH
```

* build disk images using bin/bundle
```bash
$ sudo ./bin/bundle -v --arch=$ARCH output/$ARCH/rootfs.tar \
download/kernel-$ARCH.deb download/grub-efi-$ARCH.tar.gz output/$ARCH/images
download/kernel-$ARCH.tar.gz download/grub-efi-$ARCH.tar.gz output/$ARCH/images
```


## testing images

We provide simple script to test resulting image. You run it this way:
Expand Down
30 changes: 5 additions & 25 deletions bin/build-release
Expand Up @@ -28,12 +28,10 @@ if [ "$1" = "daily" ]; then
fi
shift
pre=cirros-$VER
BR_VER="${BR_VER:-2019.02.1}" # WARNING: this may be non-trivial to change
ARCHES="${ARCHES:-i386 x86_64 arm powerpc aarch64 ppc64 ppc64le}"
KVER="${KVER:-5.3.0-26.28~18.04.1}" # Ubuntu 18.04 hwe
GVER="${GVER:-2.02-2ubuntu8.14}" # Ubuntu 18.04
KVER_PPC="4.4.0-148.174" # Ubuntu 16.04 (for powerpc)
GVER_PPC="2.02~beta2-36ubuntu3.22" # Ubuntu 16.04 (for powerpc)
BR_VER="${BR_VER:-2022.02.4}" # WARNING: this may be non-trivial to change
ARCHES="${ARCHES:-x86_64 arm aarch64 ppc64le}"
KVER="${KVER:-5.15.0-33.34}" # Ubuntu 22.04
GVER="${GVER:-2.06-2ubuntu7}" # Ubuntu 22.04
ME=$(readlink -f "$0")
MY_D=${ME%/*}
PATH=${MY_D}:$PATH
Expand Down Expand Up @@ -118,7 +116,7 @@ build_arch() {
get_grub_format() {
local arch=$1
case "$arch" in
powerpc|ppc*) format=ieee;;
ppc*) format=ieee;;
*) format=efi;;
esac
echo $format
Expand Down Expand Up @@ -154,13 +152,6 @@ tstart=${_RET}

# Stage 1: DOWNLOAD
logevent "start download" -
if [ "$CI_BUILD" = "true" ]; then
mkdir -p download
else
rm -f download
mkdir -p ../download
ln -snf ../download download
fi
brtgz="buildroot-${BR_VER}.tar.gz"
dl "http://buildroot.uclibc.org/downloads/$brtgz" "download/$brtgz"
logevent "end download"
Expand Down Expand Up @@ -194,11 +185,6 @@ for arch in ${ARCHES}; do
kver=$KVER
gver=$GVER

if [ $arch == 'powerpc' -o $arch == 'ppc64' ];then
kver=$KVER_PPC
gver=$GVER_PPC
fi

# grab kernel
logevent "start kernel ($arch) download" -
grab-kernels "$kver" $arch
Expand All @@ -214,12 +200,6 @@ logevent "end kernel and grub downloads" "$kstart"
# STAGE 2: BUILD
jobs_flag=""
parallel=true
if [ "$CI_BUILD" = "true" ]; then
mkdir -p ccache
else
mkdir -p ../ccache
ln -snf ../ccache ccache
fi
case "${CIRROS_PARALLEL:-none}" in
none) parallel=false;;
0|true) :;;
Expand Down
4 changes: 2 additions & 2 deletions bin/bundle
Expand Up @@ -345,9 +345,9 @@ umount "$mp" && UMOUNT="" ||
fail "failed to unmount partimg"

case $arch in
i386|x86_64) grub_options="--grub1 --grub-efi";;
x86_64) grub_options="--grub1 --grub-efi";;
arm|aarch64) grub_options="--grub-efi";;
powerpc|ppc*) grub_options="--grub-ieee";;
ppc*) grub_options="--grub-ieee";;
*) grub_options=;;
esac

Expand Down
43 changes: 19 additions & 24 deletions bin/grab-grub-efi
Expand Up @@ -22,7 +22,7 @@ source "${0%/*}/common-functions.sh"

burl="https://launchpad.net/ubuntu/+archive/primary/+files/"
outdir="./download"
def_arches="x86_64 aarch64 i386 arm"
def_arches="x86_64 aarch64 arm"

case "$1" in
--outdir=*) outdir="${1#*=}"; shift;;
Expand Down Expand Up @@ -59,7 +59,8 @@ deb2tar() {
debug 1 "creating $out in tempdir at $tdir"

mkdir -p "$tdir/deb"
dpkg -x "$deb" "$tdir/deb" || fail "failed to unpack $deb"
ar x "$deb" --output "$tdir/deb" || fail "failed to unpack $deb"
( cd "$tdir/deb" && tar -xf data.tar.* ) || fail "failed to extract data from $deb"

efibin=boot${efiarch}.efi

Expand All @@ -84,29 +85,23 @@ for arch in "$@"; do
efiarch=""
case "$arch" in
aarch64)
efiarch='aa64'
debarch='arm64'
pkgarch='arm64'
format='arm64-efi'
;;
efiarch='aa64'
debarch='arm64'
pkgarch='arm64'
format='arm64-efi'
;;
x86_64)
efiarch='x64'
debarch='amd64'
pkgarch='amd64'
format='x86_64-efi'
;;
i386)
efiarch='ia32'
debarch='i386'
pkgarch='ia32'
format='i386-efi'
;;
hrw marked this conversation as resolved.
Show resolved Hide resolved
efiarch='x64'
debarch='amd64'
pkgarch='amd64'
format='x86_64-efi'
;;
arm)
efiarch='arm'
debarch='armhf'
pkgarch='arm'
format='arm-efi'
;;
efiarch='arm'
debarch='armhf'
pkgarch='arm'
format='arm-efi'
;;
*) debug 1 "no EFI grub for $arch";;
esac

Expand All @@ -118,7 +113,7 @@ for arch in "$@"; do
deb="grub-efi-${pkgarch}-bin_${gver}_${debarch}.deb"
if [ ! -f "${outdir}/${deb}" ]; then
dl $burl/$deb "$outdir/$deb" || fail "failed dl $burl/$deb"
fi
fi
tar="grub-efi-${gver}-${arch}.tar.gz"
deb2tar "$outdir/$deb" "$outdir/$tar" $efiarch $format ||
fail "failed deb2efi from $deb to $tar"
Expand Down
8 changes: 3 additions & 5 deletions bin/grab-grub-ieee
Expand Up @@ -22,7 +22,7 @@ source "${0%/*}/common-functions.sh"

burl="https://launchpad.net/ubuntu/+archive/primary/+files/"
outdir="./download"
def_arches="ppc64le powerpc ppc64"
def_arches="ppc64le"

case "$1" in
--outdir=*) outdir="${1#*=}"; shift;;
Expand Down Expand Up @@ -59,7 +59,8 @@ deb2tar() {
debug 1 "creating $out in tempdir at $tdir"

mkdir -p "$tdir/deb"
dpkg -x "$deb" "$tdir/deb" || fail "failed to unpack $deb"
ar x "$deb" --output "$tdir/deb" || fail "failed to unpack $deb"
( cd "$tdir/deb" && tar -xf data.tar.* ) || fail "failed to extract data from $deb"

gbin="grub"
gmod="boot cat configfile echo ext2 halt loadenv minicmd normal part_gpt
Expand Down Expand Up @@ -91,9 +92,6 @@ for arch in "$@"; do
ppc64le)
debarch='ppc64el'
;;
powerpc|ppc64)
debarch='powerpc'
;;
*)
debug 1 "no grub-ieee1275 for $arch"
exit 1
Expand Down