Skip to content

Commit 4d5657b

Browse files
committed
fix: drop SBC board code
Boards were deprecated in favor of overlays from Talos 1.7. Now completely remove all board specific code. Part of: #12492 Signed-off-by: Noel Georgi <git@frezbo.dev>
1 parent c4f3f6d commit 4d5657b

File tree

25 files changed

+16
-1288
lines changed

25 files changed

+16
-1288
lines changed

cmd/installer/cmd/imager/root.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
var cmdFlags struct {
3232
Platform string
3333
Arch string
34-
Board string
3534
// Insecure can be set to true to force pull from insecure registry.
3635
Insecure bool
3736
ExtraKernelArgs []string
@@ -77,7 +76,6 @@ var rootCmd = &cobra.Command{
7776
prof = profile.Profile{
7877
BaseProfileName: baseProfile,
7978
Arch: cmdFlags.Arch,
80-
Board: cmdFlags.Board,
8179
Platform: cmdFlags.Platform,
8280
Customization: profile.CustomizationProfile{
8381
ExtraKernelArgs: cmdFlags.ExtraKernelArgs,
@@ -236,7 +234,6 @@ func init() {
236234
rootCmd.PersistentFlags().StringVar(&cmdFlags.Arch, "arch", runtime.GOARCH, "The target architecture")
237235
rootCmd.PersistentFlags().StringVar(&cmdFlags.BaseInstallerImage, "base-installer-image", "", "Base installer image to use")
238236
rootCmd.PersistentFlags().StringVar(&cmdFlags.ImageCache, "image-cache", "", "Image cache container image or oci path")
239-
rootCmd.PersistentFlags().StringVar(&cmdFlags.Board, "board", "", "The value of "+constants.KernelParamBoard)
240237
rootCmd.PersistentFlags().BoolVar(&cmdFlags.Insecure, "insecure", false, "Pull assets from insecure registry")
241238
rootCmd.PersistentFlags().StringArrayVar(&cmdFlags.ExtraKernelArgs, "extra-kernel-arg", []string{}, "Extra argument to pass to the kernel")
242239
rootCmd.PersistentFlags().Var(&cmdFlags.MetaValues, "meta", "A key/value pair for META")
@@ -248,9 +245,6 @@ func init() {
248245
rootCmd.PersistentFlags().StringVar(&cmdFlags.OverlayImage, "overlay-image", "", "The image reference to the overlay")
249246
rootCmd.PersistentFlags().StringArrayVar(&cmdFlags.OverlayOptions, "overlay-option", []string{}, "Extra options to pass to the overlay")
250247
rootCmd.PersistentFlags().StringVar(&cmdFlags.EmbeddedConfigPath, "embedded-config-path", "", "Path to a file containing the machine configuration to embed into the image")
251-
rootCmd.MarkFlagsMutuallyExclusive("board", "overlay-name")
252-
rootCmd.MarkFlagsMutuallyExclusive("board", "overlay-image")
253-
rootCmd.MarkFlagsMutuallyExclusive("board", "overlay-option")
254248
rootCmd.PersistentFlags().BoolVar(
255249
&cmdFlags.SecurebootIncludeWellKnownCerts, "secureboot-include-well-known-certs", false, "Include well-known (Microsoft) UEFI certificates when generating a secure boot database")
256250
}

cmd/installer/cmd/installer/root.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,14 @@ func Execute() {
4848
}
4949
}
5050

51-
var options = &install.Options{
52-
Board: constants.BoardNone,
53-
}
54-
55-
var (
56-
bootloader bool
57-
dummy string
58-
)
51+
var options = &install.Options{}
5952

6053
func init() {
6154
rootCmd.PersistentFlags().StringVar(&options.ConfigSource, "config", "", "The value of "+constants.KernelParamConfig)
6255
rootCmd.PersistentFlags().StringVar(&options.DiskPath, "disk", "", "The path to the disk to install to")
6356
rootCmd.PersistentFlags().StringVar(&options.Platform, "platform", "", "The value of "+constants.KernelParamPlatform)
6457
rootCmd.PersistentFlags().StringVar(&options.Arch, "arch", runtime.GOARCH, "The target architecture")
65-
rootCmd.PersistentFlags().StringVar(&dummy, "board", constants.BoardNone, "Deprecated: no op")
6658
rootCmd.PersistentFlags().StringArrayVar(&options.ExtraKernelArgs, "extra-kernel-arg", []string{}, "Extra argument to pass to the kernel")
67-
rootCmd.PersistentFlags().BoolVar(&bootloader, "bootloader", true, "Deprecated: no op")
6859
rootCmd.PersistentFlags().BoolVar(&options.Upgrade, "upgrade", false, "Indicates that the install is being performed by an upgrade")
6960
rootCmd.PersistentFlags().BoolVar(&options.Force, "force", false, "Indicates that the install should forcefully format the partition")
7061
rootCmd.PersistentFlags().BoolVar(&options.Zero, "zero", false, "Indicates that the install should write zeros to the disk before installing")

cmd/installer/pkg/install/install.go

Lines changed: 5 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"go.yaml.in/yaml/v4"
2828

2929
"github.com/siderolabs/talos/internal/app/machined/pkg/runtime"
30-
"github.com/siderolabs/talos/internal/app/machined/pkg/runtime/v1alpha1/board"
3130
bootloaderpkg "github.com/siderolabs/talos/internal/app/machined/pkg/runtime/v1alpha1/bootloader"
3231
"github.com/siderolabs/talos/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub"
3332
bootloaderoptions "github.com/siderolabs/talos/internal/app/machined/pkg/runtime/v1alpha1/bootloader/options"
@@ -53,7 +52,6 @@ type Options struct {
5352
DiskPath string
5453
Platform string
5554
Arch string
56-
Board string
5755
ExtraKernelArgs []string
5856
Upgrade bool
5957
Force bool
@@ -104,13 +102,7 @@ const diskImageLabel = "talos-image-disk"
104102
//
105103
//nolint:gocyclo
106104
func Install(ctx context.Context, p runtime.Platform, mode Mode, opts *Options) error {
107-
overlayPresent := overlayPresent()
108-
109-
if b := getBoard(); b != constants.BoardNone && !overlayPresent {
110-
return fmt.Errorf("using standard installer image is not supported for board: %s, use an installer with overlay", b)
111-
}
112-
113-
if overlayPresent {
105+
if overlayPresent() {
114106
extraOptionsBytes, err := os.ReadFile(constants.ImagerOverlayExtraOptionsPath)
115107
if err != nil {
116108
return err
@@ -144,24 +136,6 @@ func Install(ctx context.Context, p runtime.Platform, mode Mode, opts *Options)
144136
return err
145137
}
146138

147-
if opts.Board != constants.BoardNone {
148-
// board 'rpi_4' was removed in Talos 1.5 in favor of `rpi_generic`
149-
if opts.Board == "rpi_4" {
150-
opts.Board = constants.BoardRPiGeneric
151-
}
152-
153-
var b runtime.Board
154-
155-
b, err := board.NewBoard(opts.Board) //nolint:staticcheck
156-
if err != nil {
157-
return err
158-
}
159-
160-
cmdline.Append(constants.KernelParamBoard, b.Name())
161-
162-
cmdline.SetAll(b.KernelArgs().Strings())
163-
}
164-
165139
if opts.OverlayInstaller != nil {
166140
overlayOpts, getOptsErr := opts.OverlayInstaller.GetOptions(ctx, opts.ExtraOptions)
167141
if getOptsErr != nil {
@@ -545,28 +519,6 @@ func (i *Installer) generateBootloaderOptions(ctx context.Context, mode Mode, in
545519
BlkidInfo: info,
546520

547521
ExtraInstallStep: func() error {
548-
if i.options.Board != constants.BoardNone {
549-
var b runtime.Board
550-
551-
b, err := board.NewBoard(i.options.Board) //nolint:staticcheck
552-
if err != nil {
553-
return err
554-
}
555-
556-
i.options.Printf("installing U-Boot for %q", b.Name())
557-
558-
if err = b.Install(runtime.BoardInstallOptions{
559-
InstallDisk: i.options.DiskPath,
560-
MountPrefix: i.options.MountPrefix,
561-
UBootPath: i.options.BootAssets.UBootPath,
562-
DTBPath: i.options.BootAssets.DTBPath,
563-
RPiFirmwarePath: i.options.BootAssets.RPiFirmwarePath,
564-
Printf: i.options.Printf,
565-
}); err != nil {
566-
return fmt.Errorf("failed to install for board %s: %w", b.Name(), err)
567-
}
568-
}
569-
570522
if i.options.OverlayInstaller != nil {
571523
i.options.Printf("running overlay installer %q", i.options.OverlayName)
572524

@@ -919,18 +871,7 @@ func (i *Installer) handleGrubBlocklist(gptdev gpt.Device, pt *gpt.Table, partit
919871
//
920872
//nolint:gocyclo
921873
func (i *Installer) getPartitionOptions(ctx context.Context, mode Mode, hostTalosVersion *compatibility.TalosVersion, bootPartitions []partition.Options) ([]partition.Options, []gpt.Option, error) {
922-
var partitionOptions *runtime.PartitionOptions
923-
924-
if i.options.Board != constants.BoardNone && !quirks.New(i.options.Version).SupportsOverlay() {
925-
var b runtime.Board
926-
927-
b, err := board.NewBoard(i.options.Board) //nolint:staticcheck
928-
if err != nil {
929-
return nil, nil, err
930-
}
931-
932-
partitionOptions = b.PartitionOptions()
933-
}
874+
var partitionOffset uint64
934875

935876
if i.options.OverlayInstaller != nil {
936877
overlayOpts, getOptsErr := i.options.OverlayInstaller.GetOptions(ctx, i.options.ExtraOptions)
@@ -939,16 +880,14 @@ func (i *Installer) getPartitionOptions(ctx context.Context, mode Mode, hostTalo
939880
}
940881

941882
if overlayOpts.PartitionOptions.Offset != 0 {
942-
partitionOptions = &runtime.PartitionOptions{
943-
PartitionsOffset: overlayOpts.PartitionOptions.Offset,
944-
}
883+
partitionOffset = overlayOpts.PartitionOptions.Offset
945884
}
946885
}
947886

948887
var gptOptions []gpt.Option
949888

950-
if partitionOptions != nil && partitionOptions.PartitionsOffset != 0 {
951-
gptOptions = append(gptOptions, gpt.WithSkipLBAs(uint(partitionOptions.PartitionsOffset)))
889+
if partitionOffset != 0 {
890+
gptOptions = append(gptOptions, gpt.WithSkipLBAs(uint(partitionOffset)))
952891
}
953892

954893
if i.options.LegacyBIOSSupport {
@@ -1045,17 +984,3 @@ func overlayPresent() bool {
1045984

1046985
return err == nil
1047986
}
1048-
1049-
func getBoard() string {
1050-
cmdline := procfs.ProcCmdline()
1051-
if cmdline == nil {
1052-
return constants.BoardNone
1053-
}
1054-
1055-
board := cmdline.Get(constants.KernelParamBoard)
1056-
if board == nil {
1057-
return constants.BoardNone
1058-
}
1059-
1060-
return *board.First()
1061-
}

internal/app/machined/pkg/runtime/board.go

Lines changed: 0 additions & 31 deletions
This file was deleted.

internal/app/machined/pkg/runtime/v1alpha1/board/bananapi_m64/bananapi_m64.go

Lines changed: 0 additions & 102 deletions
This file was deleted.

internal/app/machined/pkg/runtime/v1alpha1/board/board.go

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)