mirror of
https://github.com/siderolabs/talos.git
synced 2026-05-06 04:46:17 +02:00
chore: drop unused package
It was implemented to support Firecracker which wasn't able to load compressed Linux kernels. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
This commit is contained in:
parent
961d1567d9
commit
adf05072ac
5
go.mod
5
go.mod
@ -22,7 +22,7 @@ require (
|
||||
k8s.io/apiserver v0.23.0-alpha.4 // indirect
|
||||
k8s.io/cli-runtime v0.23.0-alpha.4 // indirect
|
||||
k8s.io/client-go v0.23.0-alpha.4
|
||||
k8s.io/component-base v0.23.0-alpha.4 // indirect
|
||||
k8s.io/component-base v0.23.0-alpha.4
|
||||
k8s.io/cri-api v0.23.0-alpha.4
|
||||
k8s.io/kubectl v0.23.0-alpha.4
|
||||
k8s.io/kubelet v0.23.0-alpha.4
|
||||
@ -36,7 +36,6 @@ require (
|
||||
github.com/containerd/cgroups v1.0.2
|
||||
github.com/containerd/containerd v1.5.8
|
||||
github.com/containerd/cri v1.19.0
|
||||
github.com/containerd/go-cni v1.1.0
|
||||
github.com/containerd/typeurl v1.0.2
|
||||
github.com/containernetworking/cni v1.0.1
|
||||
github.com/containernetworking/plugins v1.0.1
|
||||
@ -79,7 +78,6 @@ require (
|
||||
github.com/rs/xid v1.3.0
|
||||
github.com/ryanuber/columnize v2.1.2+incompatible
|
||||
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7
|
||||
github.com/smira/go-xz v0.0.0-20201019130106-9921ed7a9935
|
||||
github.com/spf13/cobra v1.2.1
|
||||
github.com/stretchr/testify v1.7.0
|
||||
github.com/talos-systems/crypto v0.3.4
|
||||
@ -152,6 +150,7 @@ require (
|
||||
github.com/cilium/ebpf v0.7.0 // indirect
|
||||
github.com/containerd/continuity v0.1.0 // indirect
|
||||
github.com/containerd/fifo v1.0.0 // indirect
|
||||
github.com/containerd/go-cni v1.1.0 // indirect
|
||||
github.com/containerd/ttrpc v1.1.0 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
|
||||
|
||||
2
go.sum
2
go.sum
@ -1003,8 +1003,6 @@ github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1
|
||||
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/smira/go-xz v0.0.0-20201019130106-9921ed7a9935 h1:64eGQ94st1udqkO66IaMG05KGThUJcXHqyE6UeKQBoE=
|
||||
github.com/smira/go-xz v0.0.0-20201019130106-9921ed7a9935/go.mod h1:smSuTvETRIkX95VAIWBdKoGJuUxif7NT7FgbkpVqOiA=
|
||||
github.com/smira/tcpproxy v0.0.0-20201015133617-de5f7797b95b h1:95WXQlM2dDPgIXTlnpwiJPa0l0ipl1RwMvdy8KLUyH8=
|
||||
github.com/smira/tcpproxy v0.0.0-20201015133617-de5f7797b95b/go.mod h1:yDIWrelwlTRXdKvQqqQ+8lCwCjbSRtkat49REnui7hk=
|
||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||
|
||||
@ -1,75 +0,0 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
// Package vmlinuz provides utilities for reading bzImage kernel format.
|
||||
package vmlinuz
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/bzip2"
|
||||
"compress/gzip"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/smira/go-xz"
|
||||
)
|
||||
|
||||
type decompressFunc func(io.Reader) (io.ReadCloser, error)
|
||||
|
||||
// Based on https://github.com/torvalds/linux/blob/master/scripts/extract-vmlinux.
|
||||
var bzImageMagic = []struct {
|
||||
magic []byte
|
||||
reader decompressFunc
|
||||
}{
|
||||
{
|
||||
magic: []byte("\3757zXZ\000"),
|
||||
reader: func(r io.Reader) (io.ReadCloser, error) {
|
||||
return xz.NewReader(r)
|
||||
},
|
||||
},
|
||||
{
|
||||
magic: []byte("\037\213\010"),
|
||||
reader: func(r io.Reader) (io.ReadCloser, error) {
|
||||
return gzip.NewReader(r)
|
||||
},
|
||||
},
|
||||
{
|
||||
magic: []byte("BZh"),
|
||||
reader: func(r io.Reader) (io.ReadCloser, error) {
|
||||
return ioutil.NopCloser(bzip2.NewReader(r)), nil
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// Decompress the bzImage Linux kernel format and extract vmlinux kernel.
|
||||
//
|
||||
// Only following formats are supported: gzip, xz and bzip2.
|
||||
func Decompress(r io.Reader) (io.ReadCloser, error) {
|
||||
// read first 64Kb and look for signature
|
||||
head := make([]byte, 65536)
|
||||
|
||||
if _, err := io.ReadFull(r, head); err != nil {
|
||||
return nil, fmt.Errorf("error reading 64Kb vmlinuz head: %w", err)
|
||||
}
|
||||
|
||||
start := -1
|
||||
|
||||
var decompress decompressFunc
|
||||
|
||||
for _, matcher := range bzImageMagic {
|
||||
start = bytes.Index(head, matcher.magic)
|
||||
if start != -1 {
|
||||
decompress = matcher.reader
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if start == -1 {
|
||||
return nil, fmt.Errorf("error looking for vmlinuz magic")
|
||||
}
|
||||
|
||||
return decompress(io.MultiReader(bytes.NewReader(head[start:]), r))
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user