chore: output SBC images as compressed raw images

By publishing SBC images as compressed raw images, tools like etcher can flash SD cards
by using URLs to the release asset. It is also common in this community to publish compressed
images instead of tarballs.

Signed-off-by: Andrew Rynhard <andrew@rynhard.io>
This commit is contained in:
Andrew Rynhard 2020-12-01 18:30:02 -08:00 committed by talos-bot
parent db905c6f74
commit 03094861c2
5 changed files with 41 additions and 18 deletions

View File

@ -499,9 +499,9 @@ local release = {
'_out/initramfs-arm64.xz',
'_out/metal-amd64.tar.gz',
'_out/metal-arm64.tar.gz',
'_out/metal-rpi_4-arm64.tar.gz',
'_out/metal-bananapi_m64-arm64.tar.gz',
'_out/metal-libretech_all_h3_cc_h5-arm64.tar.gz',
'_out/metal-rpi_4-arm64.img.xz',
'_out/metal-bananapi_m64-arm64.img.xz',
'_out/metal-libretech_all_h3_cc_h5-arm64.img.xz',
'_out/openstack-amd64.tar.gz',
'_out/openstack-arm64.tar.gz',
'_out/talos-amd64.iso',

View File

@ -149,12 +149,27 @@ func finalize(platform runtime.Platform, img string) (err error) {
return err
}
case "metal":
name := fmt.Sprintf("metal-%s.tar.gz", stdruntime.GOARCH)
if options.Board != constants.BoardNone {
name = fmt.Sprintf("metal-%s-%s.tar.gz", options.Board, stdruntime.GOARCH)
name := fmt.Sprintf("metal-%s-%s.img", options.Board, stdruntime.GOARCH)
file = filepath.Join(outputArg, name)
err = os.Rename(img, file)
if err != nil {
return err
}
log.Println("compressing image")
if err = xz(file); err != nil {
return err
}
break
}
name := fmt.Sprintf("metal-%s.tar.gz", stdruntime.GOARCH)
if err = tar(name, file, dir); err != nil {
return err
}
@ -171,6 +186,14 @@ func tar(filename, src, dir string) error {
return nil
}
func xz(filename string) error {
if _, err := cmd.Run("xz", "-0", filename); err != nil {
return err
}
return nil
}
func tarOutput() error {
return archiver.TarGz(context.Background(), outputArg, os.Stdout)
}

View File

@ -5,11 +5,11 @@ title: "Banana Pi M64"
## Download the Image
An official image is provided in a release.
Download the tarball and extract the image:
Download the compressed image and decompress it:
```bash
curl -LO https://github.com/talos-systems/talos/releases/download/<version>/metal-bananapi_m64-arm64.tar.gz
tar -xvf metal-bananapi_m64-arm64.tar.gz
curl -LO https://github.com/talos-systems/talos/releases/download/<version>/metal-bananapi_m64-arm64.img.xz
xz -d metal-bananapi_m64-arm64.img.xz
```
## Writing the Image
@ -17,7 +17,7 @@ tar -xvf metal-bananapi_m64-arm64.tar.gz
Now `dd` the image your SD card (be sure to update `x` in `mmcblkx`):
```bash
sudo dd if=disk.raw of=/dev/mmcblkx
sudo dd if=metal-bananapi_m64-arm64.img of=/dev/mmcblkx
```
## Bootstrapping the Node

View File

@ -5,11 +5,11 @@ title: "Libre Computer Board ALL-H3-CC"
## Download the Image
An official image is provided in a release.
Download the tarball and extract the image:
Download the compressed image and decompress it:
```bash
curl -LO https://github.com/talos-systems/talos/releases/download/<version>/metal-libretech_all_h3_cc_h5-arm64.tar.gz
tar -xvf metal-libretech_all_h3_cc_h5-arm64.tar.gz
curl -LO https://github.com/talos-systems/talos/releases/download/<version>/metal-libretech_all_h3_cc_h5-arm64.img.xz
xz -d metal-libretech_all_h3_cc_h5-arm64.img.xz
```
## Writing the Image
@ -17,7 +17,7 @@ tar -xvf metal-libretech_all_h3_cc_h5-arm64.tar.gz
Now `dd` the image your SD card (be sure to update `x` in `mmcblkx`):
```bash
sudo dd if=disk.raw of=/dev/mmcblkx
sudo dd if=metal-libretech_all_h3_cc_h5-arm64.img of=/dev/mmcblkx
```
## Bootstrapping the Node

View File

@ -23,11 +23,11 @@ Power off the Raspberry Pi and remove the SD card.
## Download the Image
An official image is provided in a release.
Download the tarball and extract the image:
Download the compressed image and decompress it:
```bash
curl -LO https://github.com/talos-systems/talos/releases/download/<version>/metal-rpi_4-arm64.tar.gz
tar -xvf metal-rpi_4-arm64.tar.gz
curl -LO https://github.com/talos-systems/talos/releases/download/<version>/metal-rpi_4-arm64.img.xz
xz -d metal-rpi_4-arm64.img.xz
```
## Writing the Image
@ -35,7 +35,7 @@ tar -xvf metal-rpi_4-arm64.tar.gz
Now `dd` the image your SD card (be sure to update `x` in `mmcblkx`):
```bash
sudo dd if=disk.raw of=/dev/mmcblkx
sudo dd if=metal-rpi_4-arm64.img of=/dev/mmcblkx
```
## Bootstrapping the Node