add pve-install pve-container pve-common-patch
This commit is contained in:
parent
6778e5437a
commit
f02477f3dd
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -13,3 +13,9 @@
|
||||
[submodule "packages/pve-common/pve-common"]
|
||||
path = packages/pve-common/pve-common
|
||||
url = https://git.proxmox.com/git/pve-common
|
||||
[submodule "packages/pve-installer/pve-installer"]
|
||||
path = packages/pve-installer/pve-installer
|
||||
url = https://git.proxmox.com/git/pve-installer.git
|
||||
[submodule "packages/pve-container/pve-container"]
|
||||
path = packages/pve-container/pve-container
|
||||
url = https://git.proxmox.com/git/pve-container.git
|
||||
|
||||
2
packages/pve-common/series
Normal file
2
packages/pve-common/series
Normal file
@ -0,0 +1,2 @@
|
||||
patches/001-add-for-port.patch
|
||||
patches/changelog/001-add-changlog-8.1.0-1.patch
|
||||
109
packages/pve-container/patches/001-add-loongarch-support.patch
Normal file
109
packages/pve-container/patches/001-add-loongarch-support.patch
Normal file
@ -0,0 +1,109 @@
|
||||
diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
|
||||
index 1664a35..73f60f0 100644
|
||||
--- a/src/PVE/LXC/Config.pm
|
||||
+++ b/src/PVE/LXC/Config.pm
|
||||
@@ -473,7 +473,7 @@ my $confdesc = {
|
||||
arch => {
|
||||
optional => 1,
|
||||
type => 'string',
|
||||
- enum => ['amd64', 'i386', 'arm64', 'armhf', 'riscv32', 'riscv64'],
|
||||
+ enum => ['amd64', 'i386', 'arm64', 'armhf', 'riscv32', 'riscv64', 'loongarch64'],
|
||||
description => "OS architecture type.",
|
||||
default => 'amd64',
|
||||
},
|
||||
diff --git a/src/PVE/LXC/Setup.pm b/src/PVE/LXC/Setup.pm
|
||||
index 5c9114c..cae55b1 100644
|
||||
--- a/src/PVE/LXC/Setup.pm
|
||||
+++ b/src/PVE/LXC/Setup.pm
|
||||
@@ -135,17 +135,6 @@ sub new {
|
||||
if (!defined($conf->{arch})) {
|
||||
my $arch = eval { $self->protected_call(sub { $plugin->detect_architecture() }) };
|
||||
|
||||
- if (my $err = $@) {
|
||||
- warn "Architecture detection failed: $err" if $err;
|
||||
- }
|
||||
-
|
||||
- if (!defined($arch)) {
|
||||
- $arch = 'amd64';
|
||||
- print "Falling back to $arch.\nUse `pct set VMID --arch ARCH` to change.\n";
|
||||
- } else {
|
||||
- print "Detected container architecture: $arch\n";
|
||||
- }
|
||||
-
|
||||
$conf->{arch} = $arch;
|
||||
}
|
||||
|
||||
diff --git a/src/PVE/LXC/Setup/Plugin.pm b/src/PVE/LXC/Setup/Plugin.pm
|
||||
index b9d9c2d..533afe0 100644
|
||||
--- a/src/PVE/LXC/Setup/Plugin.pm
|
||||
+++ b/src/PVE/LXC/Setup/Plugin.pm
|
||||
@@ -6,6 +6,7 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use Carp;
|
||||
+use PVE::Tools;
|
||||
|
||||
sub new {
|
||||
my ($class, $conf, $rootdir, $os_release) = @_;
|
||||
@@ -64,7 +65,48 @@ sub ssh_host_key_types_to_generate {
|
||||
|
||||
sub detect_architecture {
|
||||
my ($self) = @_;
|
||||
- croak "implement me in sub-class\n";
|
||||
+ # see https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
|
||||
+ my $supported_elf_machine = {
|
||||
+ 0x03 => 'i386',
|
||||
+ 0x3e => 'amd64',
|
||||
+ 0x28 => 'armhf',
|
||||
+ 0xb7 => 'arm64',
|
||||
+ 0xf3 => 'riscv',
|
||||
+ 0x2 => 'loongarch64',
|
||||
+ };
|
||||
+
|
||||
+ my $elf_fn = '/bin/sh'; # '/bin/sh' is POSIX mandatory
|
||||
+ my $detect_arch = sub {
|
||||
+ # chroot avoids a problem where we check the binary of the host system
|
||||
+ # if $elf_fn is an absolut symlink (e.g. $rootdir/bin/sh -> /bin/bash)
|
||||
+ open(my $fh, "<", $elf_fn) or die "open '$elf_fn' failed: $!\n";
|
||||
+ binmode($fh);
|
||||
+
|
||||
+ my $length = read($fh, my $data, 20) or die "read failed: $!\n";
|
||||
+
|
||||
+ # 4 bytes ELF magic number and 1 byte ELF class, padding, machine
|
||||
+ my ($magic, $class, undef, $machine) = unpack("A4CA12n", $data);
|
||||
+
|
||||
+ die "'$elf_fn' does not resolve to an ELF!\n"
|
||||
+ if (!defined($class) || !defined($magic) || $magic ne "\177ELF");
|
||||
+
|
||||
+ my $arch = $supported_elf_machine->{$machine};
|
||||
+ die "'$elf_fn' has unknown ELF machine '$machine'!\n"
|
||||
+ if !defined($arch);
|
||||
+
|
||||
+ return $arch;
|
||||
+ };
|
||||
+
|
||||
+ my $arch = eval { PVE::Tools::run_fork_with_timeout(5, $detect_arch) };
|
||||
+ if (my $err = $@) {
|
||||
+ $arch = 'arm64';
|
||||
+ print "Architecture detection failed: $err\nFalling back to loongarch64.\n" .
|
||||
+ "Use `pct set VMID --arch ARCH` to change.\n";
|
||||
+ } else {
|
||||
+ print "Detected container architecture: $arch\n";
|
||||
+ }
|
||||
+
|
||||
+ return $arch;
|
||||
}
|
||||
|
||||
# hooks
|
||||
diff --git a/src/PVE/LXC/Tools.pm b/src/PVE/LXC/Tools.pm
|
||||
index 7e3e530..838327f 100644
|
||||
--- a/src/PVE/LXC/Tools.pm
|
||||
+++ b/src/PVE/LXC/Tools.pm
|
||||
@@ -179,6 +179,7 @@ sub detect_elf_architecture {
|
||||
0x28 => 'armhf',
|
||||
0xb7 => 'arm64',
|
||||
0xf3 => 'riscv',
|
||||
+ 0x2 => 'loongarch64',
|
||||
};
|
||||
|
||||
my $detect_arch = sub {
|
||||
1
packages/pve-container/pve-container
Submodule
1
packages/pve-container/pve-container
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit eaeb2846ba2ca32773255e673dacb0049abffff3
|
||||
1
packages/pve-container/series
Normal file
1
packages/pve-container/series
Normal file
@ -0,0 +1 @@
|
||||
patches/001-add-loongarch-support.patch
|
||||
117
packages/pve-installer/patches/001-add-port-support.patch
Normal file
117
packages/pve-installer/patches/001-add-port-support.patch
Normal file
@ -0,0 +1,117 @@
|
||||
diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
|
||||
index fa2702c..636e684 100644
|
||||
--- a/Proxmox/Install.pm
|
||||
+++ b/Proxmox/Install.pm
|
||||
@@ -6,6 +6,7 @@ use warnings;
|
||||
use Cwd 'abs_path';
|
||||
use Encode;
|
||||
use POSIX ":sys_wait_h";
|
||||
+use POSIX qw(EINTR EEXIST EOPNOTSUPP);
|
||||
|
||||
use Proxmox::Install::ISOEnv;
|
||||
use Proxmox::Install::RunEnv;
|
||||
@@ -58,6 +59,13 @@ sub reset_last_display_change {
|
||||
$last_display_change = 0;
|
||||
}
|
||||
|
||||
+my $host_arch;
|
||||
+sub get_host_arch {
|
||||
+ $host_arch = (POSIX::uname())[4] if !$host_arch;
|
||||
+ return $host_arch;
|
||||
+}
|
||||
+my $arch = get_host_arch();
|
||||
+
|
||||
sub display_info {
|
||||
my $min_display_time = 15;
|
||||
|
||||
@@ -97,6 +105,7 @@ my $fssetup = {
|
||||
},
|
||||
};
|
||||
|
||||
+
|
||||
sub create_filesystem {
|
||||
my ($dev, $name, $type, $start, $end, $fs, $fe) = @_;
|
||||
|
||||
@@ -625,9 +653,18 @@ sub prepare_grub_efi_boot_esp {
|
||||
|
||||
syscmd("mount -n $espdev -t vfat $targetdir/boot/efi") == 0 ||
|
||||
die "unable to mount $espdev\n";
|
||||
-
|
||||
+ my $arch = get_host_arch();
|
||||
+ my $rc;
|
||||
eval {
|
||||
- my $rc = syscmd("chroot $targetdir /usr/sbin/grub-install --target x86_64-efi --no-floppy --bootloader-id='proxmox' $dev");
|
||||
+ if ($arch eq "aarch64"){
|
||||
+ my $rc = syscmd("chroot $targetdir /usr/sbin/grub-install --target arm64-efi --no-floppy --bootloader-id='proxmox' $dev");
|
||||
+ } elsif ($arch eq "loongarch64"){
|
||||
+ my $rc = syscmd("chroot $targetdir /usr/sbin/grub-install --target loongarch64-efi --no-floppy --bootloader-id='proxmox' $dev");
|
||||
+ } elsif ($arch eq "riscv64"){
|
||||
+ my $rc = syscmd("chroot $targetdir /usr/sbin/grub-install --target riscv64-efi --no-floppy --bootloader-id='proxmox' $dev");
|
||||
+ } else {
|
||||
+ die "unable to install grub on arch $arch\n";
|
||||
+ }
|
||||
if ($rc != 0) {
|
||||
my $run_env = Proxmox::Install::RunEnv::get();
|
||||
if ($run_env->{boot_type} eq 'efi') {
|
||||
@@ -636,12 +673,23 @@ sub prepare_grub_efi_boot_esp {
|
||||
warn "unable to install the EFI boot loader on '$dev', ignoring (not booted using UEFI)\n";
|
||||
}
|
||||
}
|
||||
+ rockchip_dtb_setup($espdev, $targetdir , 0);
|
||||
+
|
||||
# also install fallback boot file (OVMF does not boot without)
|
||||
mkdir("$targetdir/boot/efi/EFI/BOOT");
|
||||
- syscmd("cp $targetdir/boot/efi/EFI/proxmox/*.efi $targetdir/boot/efi/EFI/BOOT/") == 0 ||
|
||||
+ syscmd("cp -r $targetdir/boot/efi/EFI/proxmox/* $targetdir/boot/efi/EFI/BOOT/");
|
||||
+ if ($arch eq "aarch64"){
|
||||
+ syscmd("cp $targetdir/boot/efi/EFI/BOOT/grubaa64.efi $targetdir/boot/efi/EFI/BOOT/BOOTAA64.EFI ") == 0 ||
|
||||
die "unable to copy efi boot loader\n";
|
||||
- syscmd("mv $targetdir/boot/efi/EFI/BOOT/shimx64.efi $targetdir/boot/efi/EFI/BOOT/BOOTx64.efi") == 0 ||
|
||||
- die "unable to setup default efi boot loader\n";
|
||||
+ } elsif ($arch eq "loongarch64") {
|
||||
+ syscmd("cp $targetdir/boot/efi/EFI/BOOT/grubloongarch64.efi $targetdir/boot/efi/EFI/BOOT/BOOTLOONGARCH64.efi") == 0 ||
|
||||
+ die "unable to copy efi boot loader\n";
|
||||
+ } elsif ($arch eq "riscv64") {
|
||||
+ syscmd("cp $targetdir/boot/efi/EFI/BOOT/grubriscv64.efi $targetdir/boot/efi/EFI/BOOT/BOOTRISCV64.efi") == 0 ||
|
||||
+ die "unable to copy efi boot loader\n";
|
||||
+ } else {
|
||||
+ die "unable to opy efi boot loader on arch $arch\n";
|
||||
+ }
|
||||
};
|
||||
my $err = $@;
|
||||
|
||||
@@ -1258,14 +1306,6 @@ _EOD
|
||||
diversion_remove($targetdir, "/usr/sbin/update-grub");
|
||||
diversion_remove($targetdir, "/usr/sbin/update-initramfs");
|
||||
|
||||
- my $kapi;
|
||||
- foreach my $fn (<$targetdir/lib/modules/*>) {
|
||||
- if ($fn =~ m!/(\d+\.\d+\.\d+-\d+-pve)$!) {
|
||||
- die "found multiple kernels\n" if defined($kapi);
|
||||
- $kapi = $1;
|
||||
- }
|
||||
- }
|
||||
- die "unable to detect kernel version\n" if !defined($kapi);
|
||||
|
||||
if (!is_test_mode()) {
|
||||
|
||||
@@ -1275,7 +1315,7 @@ _EOD
|
||||
|
||||
my $bootloader_err_list = [];
|
||||
eval {
|
||||
- syscmd("chroot $targetdir /usr/sbin/update-initramfs -c -k $kapi") == 0 ||
|
||||
+ syscmd("chroot $targetdir /usr/sbin/update-initramfs -c -k all") == 0 ||
|
||||
die "unable to install initramfs\n";
|
||||
|
||||
my $native_4k_disk_bootable = 0;
|
||||
@@ -1290,8 +1330,8 @@ _EOD
|
||||
} else {
|
||||
if (!$native_4k_disk_bootable) {
|
||||
eval {
|
||||
- syscmd("chroot $targetdir /usr/sbin/grub-install --target i386-pc --no-floppy --bootloader-id='proxmox' $dev") == 0 ||
|
||||
- die "unable to install the i386-pc boot loader on '$dev'\n";
|
||||
+# syscmd("chroot $targetdir /usr/sbin/grub-install --target i386-pc --no-floppy --bootloader-id='proxmox' $dev") == 0 ||
|
||||
+ print ("not need install the i386-pc boot loader on '$dev'\n");
|
||||
};
|
||||
push @$bootloader_err_list, $@ if $@;
|
||||
}
|
||||
46
packages/pve-installer/patches/001-remove-kvm-check.patch
Normal file
46
packages/pve-installer/patches/001-remove-kvm-check.patch
Normal file
@ -0,0 +1,46 @@
|
||||
diff --git a/proxinstall b/proxinstall
|
||||
index 12f3eaa..dcf6e7e 100755
|
||||
--- a/proxinstall
|
||||
+++ b/proxinstall
|
||||
@@ -1592,6 +1592,6 @@ sub create_intro_view {
|
||||
- if ($iso_env->{product} eq 'pve' && !$run_env->{hvm_supported}) {
|
||||
- Proxmox::UI::error(
|
||||
- "No support for hardware-accelerated KVM virtualization detected.\n\n"
|
||||
- ."Check BIOS settings for Intel VT / AMD-V / SVM."
|
||||
- );
|
||||
- }
|
||||
+# if ($iso_env->{product} eq 'pve' && !$run_env->{hvm_supported}) {
|
||||
+# Proxmox::UI::error(
|
||||
+# "No support for hardware-accelerated KVM virtualization detected.\n\n"
|
||||
+# ."Check BIOS settings for Intel VT / AMD-V / SVM."
|
||||
+# );
|
||||
+# }
|
||||
diff --git a/proxmox-tui-installer/src/main.rs b/proxmox-tui-installer/src/main.rs
|
||||
index 3fb87a7..242978b 100644
|
||||
--- a/proxmox-tui-installer/src/main.rs
|
||||
+++ b/proxmox-tui-installer/src/main.rs
|
||||
@@ -207,15 +207,15 @@ fn installer_setup_late(siv: &mut Cursive) {
|
||||
);
|
||||
}
|
||||
|
||||
- if state.setup_info.config.product == ProxmoxProduct::PVE && !state.runtime_info.hvm_supported {
|
||||
- display_setup_warning(
|
||||
- siv,
|
||||
- concat!(
|
||||
- "No support for hardware-accelerated KVM virtualization detected.\n\n",
|
||||
- "Check BIOS settings for Intel VT / AMD-V / SVM."
|
||||
- ),
|
||||
- );
|
||||
- }
|
||||
+ // if state.setup_info.config.product == ProxmoxProduct::PVE && !state.runtime_info.hvm_supported {
|
||||
+ // display_setup_warning(
|
||||
+ // siv,
|
||||
+ // concat!(
|
||||
+ // "No support for hardware-accelerated KVM virtualization detected.\n\n",
|
||||
+ // "Check BIOS settings for Intel VT / AMD-V / SVM."
|
||||
+ // ),
|
||||
+ // );
|
||||
+ // }
|
||||
}
|
||||
|
||||
fn initial_setup_error(siv: &mut CursiveRunnable, message: &str) -> ! {
|
||||
@ -0,0 +1,28 @@
|
||||
diff --git a/debian/control b/debian/control
|
||||
index 04b0c6e..c6232af 100644
|
||||
--- a/debian/control
|
||||
+++ b/debian/control
|
||||
@@ -34,14 +34,22 @@ Homepage: https://www.proxmox.com
|
||||
|
||||
Package: proxmox-installer
|
||||
Architecture: any
|
||||
-Depends: chrony,
|
||||
+Depends: btrfs-progs,
|
||||
+ chrony,
|
||||
+ eject,
|
||||
geoip-bin,
|
||||
iproute2,
|
||||
libgtk3-perl,
|
||||
libgtk3-webkit2-perl,
|
||||
libjson-perl,
|
||||
+ lvm2,
|
||||
+ openbox,
|
||||
proxmox-kernel-helper,
|
||||
squashfs-tools,
|
||||
+ thin-provisioning-tools,
|
||||
+ xorg,
|
||||
+ zfsutils-linux,
|
||||
+ zfs-initramfs,
|
||||
${misc:Depends},
|
||||
${perl:Depends},
|
||||
${shlibs:Depends},
|
||||
@ -0,0 +1,13 @@
|
||||
diff --git a/Proxmox/Sys/Block.pm b/Proxmox/Sys/Block.pm
|
||||
index e337474..cb728cb 100644
|
||||
--- a/Proxmox/Sys/Block.pm
|
||||
+++ b/Proxmox/Sys/Block.pm
|
||||
@@ -171,6 +171,8 @@ sub get_partition_dev {
|
||||
return "${dev}$partnum";
|
||||
} elsif ($dev =~ m|^/dev/nvme\d+n\d+$|) {
|
||||
return "${dev}p$partnum";
|
||||
+ } elsif ($dev =~ m|^/dev/mmcblk\d+$|) {
|
||||
+ return "${dev}p$partnum";
|
||||
} else {
|
||||
die "unable to get device for partition $partnum on device $dev\n";
|
||||
}
|
||||
37
packages/pve-installer/patches/004-add-rockchip-dtb.patch
Normal file
37
packages/pve-installer/patches/004-add-rockchip-dtb.patch
Normal file
@ -0,0 +1,37 @@
|
||||
diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
|
||||
index fa2702c..636e684 100644
|
||||
--- a/Proxmox/Install.pm
|
||||
+++ b/Proxmox/Install.pm
|
||||
@@ -608,6 +617,24 @@ my sub chroot_chmod {
|
||||
die "chroot: unable to change permission mode for '$path'\n";
|
||||
}
|
||||
|
||||
+sub rockchip_dtb_setup {
|
||||
+ my ($espdev, $targetdir, $zfs) = @_;
|
||||
+ # For rockchpi efi env need Device Tree mode, https://github.com/edk2-porting/edk2-rk3588
|
||||
+ # We create \dtb\base\ in esp root
|
||||
+ my $kernel_version = `uname -r`;
|
||||
+ if ($kernel_version =~ /rockchip/){
|
||||
+ print "kernel is rockchip\n";
|
||||
+ if ($zfs == '1') {
|
||||
+ syscmd("mount $espdev $targetdir/boot/efi/");
|
||||
+ syscmd("cp -r /cdrom/dtb $targetdir/boot/efi/");
|
||||
+ syscmd("umount -l $targetdir/boot/efi/") ;
|
||||
+ }else{
|
||||
+ syscmd("cp -r /cdrom/dtb $targetdir/boot/efi/");
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
sub prepare_proxmox_boot_esp {
|
||||
my ($espdev, $targetdir, $secureboot) = @_;
|
||||
|
||||
@@ -618,6 +645,7 @@ sub prepare_proxmox_boot_esp {
|
||||
|
||||
syscmd("chroot $targetdir proxmox-boot-tool init $espdev $mode") == 0 ||
|
||||
die "unable to init ESP and install proxmox-boot loader on '$espdev'\n";
|
||||
+ rockchip_dtb_setup($espdev, $targetdir,1);
|
||||
}
|
||||
|
||||
sub prepare_grub_efi_boot_esp {
|
||||
1
packages/pve-installer/pve-installer
Submodule
1
packages/pve-installer/pve-installer
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 596595d3d6011f9ba1d3c719e4ccdf4d6c2cda29
|
||||
5
packages/pve-installer/series
Normal file
5
packages/pve-installer/series
Normal file
@ -0,0 +1,5 @@
|
||||
patches/001-add-port-support.patch
|
||||
patches/001-remove-kvm-check.patch
|
||||
patches/002-add-some-depends-for-pve-installer.patch
|
||||
patches/003-add-mmc-check-in-pve-installer.patch
|
||||
patches/004-add-rockchip-dtb.patch
|
||||
Loading…
Reference in New Issue
Block a user