mirror of
https://github.com/rosalinux/image-builder.git
synced 2025-02-23 10:22:50 +00:00
ad lot of improvements
This commit is contained in:
parent
422d19e932
commit
a68c5dac73
4 changed files with 71 additions and 36 deletions
|
@ -1,11 +1,34 @@
|
|||
ARCH="aarch64"
|
||||
BOOT_SOC="rk3568"
|
||||
|
||||
# kernel section
|
||||
KERNEL="https://github.com/armbian/linux-rockchip.git#rk-6.1-rkr3"
|
||||
KERNEL_CONFIG="rockchip_linux_defconfig"
|
||||
DTB="rockchip/rk3568-ok3568c"
|
||||
|
||||
# u-boot section
|
||||
UBOOT="https://github.com/radxa/u-boot.git"
|
||||
UBOOT_VERSION="next-dev-v2024.03"
|
||||
UBOOT_CONFIG="ok3568c-rk3568_defconfig"
|
||||
DTB="rockchip/rk3568-ok3568c"
|
||||
UBOOT_CONFIG="rk3568-ok3568c_defconfig"
|
||||
|
||||
# cmdline
|
||||
CMDLINE="earlycon=uart8250,mmio32,0xfeb50000 console=ttyFIQ0 console=tty1 consoleblank=0 irqchip.gicv3_pseudo_nmi=0 switolb=1 coherent_pool=2M cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1"
|
||||
|
||||
# disk section
|
||||
# /boot is vfat partition
|
||||
BOOT_FSTYPE="vfat"
|
||||
BOOT_SIZE="256MB"
|
||||
# / is ext4 partition
|
||||
ROOT_SIZE="1024MB"
|
||||
ROOT_FSTYPE="ext4"
|
||||
|
||||
# platform section
|
||||
# # put it in blobs dir
|
||||
RK_DDR="rk3568_ddr_1560MHz_v1.21.bin"
|
||||
BL31="rk3568_bl31_v1.44.elf"
|
||||
MKIMAGE_CMD="tools/mkimage -n {BOOT_SOC} -T rksd -d {RK_DDR}:spl/u-boot-spl.bin idbloader.img"
|
||||
UBOOT_BUILD="make BL31={BL31} spl/u-boot-spl.bin u-boot.dtb u-boot.itb CROSS_COMPILE='{ARCH}-linux-gnu-'"
|
||||
# make BL31=rk3568_bl31_v1.44.elf spl/u-boot-spl.bin u-boot.dtb u-boot.itb CROSS_COMPILE="aarch64-linux-gnu-"
|
||||
|
||||
# dd if=idbloader.img of=/dev/loop1 seek=64 conv=notrunc status=none
|
||||
# dd if=u-boot.itb of=/dev/loop1 seek=16384 conv=notrunc status=none
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: John Doe <john.doe@somewhere.on.planet>
|
||||
Date: Fri, 25 Oct 2024 14:54:00 +0000
|
||||
Subject: Patching u-boot rk35xx files arch/arm/dts/OK3568-C.dts
|
||||
configs/OK3568-rk3568_defconfig
|
||||
From 9d0b75e07f457afb6f3f27186e73daf251b9d88c Mon Sep 17 00:00:00 2001
|
||||
From: alexander stefanov <alexander@mezon.ru>
|
||||
Date: Sat, 16 Nov 2024 14:13:14 +0300
|
||||
Subject: [PATCH] add rk3568-ok3568c board
|
||||
|
||||
Signed-off-by: John Doe <john.doe@somewhere.on.planet>
|
||||
---
|
||||
arch/arm/dts/OK3568-C.dts | 475 ++++++++++
|
||||
configs/OK3568-rk3568_defconfig | 220 +++++
|
||||
arch/arm/dts/rk3568-ok3568c.dts | 475 +++++++++++++++++++++++++++++++
|
||||
configs/rk3568-ok3568c_defconfig | 220 ++++++++++++++
|
||||
2 files changed, 695 insertions(+)
|
||||
create mode 100644 arch/arm/dts/rk3568-ok3568c.dts
|
||||
create mode 100644 configs/rk3568-ok3568c_defconfig
|
||||
|
||||
diff --git a/arch/arm/dts/OK3568-C.dts b/arch/arm/dts/OK3568-C.dts
|
||||
diff --git a/arch/arm/dts/rk3568-ok3568c.dts b/arch/arm/dts/rk3568-ok3568c.dts
|
||||
new file mode 100644
|
||||
index 00000000000..21131dbba6b
|
||||
index 0000000..ae3003e
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/OK3568-C.dts
|
||||
+++ b/arch/arm/dts/rk3568-ok3568c.dts
|
||||
@@ -0,0 +1,475 @@
|
||||
+/*
|
||||
+ * SPDX-License-Identifier: GPL-2.0+
|
||||
|
@ -491,11 +491,11 @@ index 00000000000..21131dbba6b
|
|||
+ };
|
||||
+ };
|
||||
+};
|
||||
diff --git a/configs/OK3568-rk3568_defconfig b/configs/OK3568-rk3568_defconfig
|
||||
diff --git a/configs/rk3568-ok3568c_defconfig b/configs/rk3568-ok3568c_defconfig
|
||||
new file mode 100644
|
||||
index 00000000000..65ecbfcd904
|
||||
index 0000000..0832186
|
||||
--- /dev/null
|
||||
+++ b/configs/OK3568-rk3568_defconfig
|
||||
+++ b/configs/rk3568-ok3568c_defconfig
|
||||
@@ -0,0 +1,220 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_ARCH_ROCKCHIP=y
|
||||
|
@ -514,7 +514,7 @@ index 00000000000..65ecbfcd904
|
|||
+CONFIG_SPL_NAND_SUPPORT=y
|
||||
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
|
||||
+CONFIG_SPL_SPI_SUPPORT=y
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="OK3568-C"
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="rk3568-ok3568c"
|
||||
+CONFIG_SMBIOS_PRODUCT_NAME=""
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_FIT=y
|
||||
|
@ -717,5 +717,6 @@ index 00000000000..65ecbfcd904
|
|||
+CONFIG_RK_AVB_LIBAVB_USER=y
|
||||
+CONFIG_OPTEE_CLIENT=y
|
||||
+CONFIG_OPTEE_V2=y
|
||||
--
|
||||
Created with Armbian build tools https://github.com/armbian/build
|
||||
--
|
||||
2.46.1
|
||||
|
|
@ -31,7 +31,7 @@ grep -Irl /lib/modules | xargs sed -i -e 's,/lib/modules,%{_modulesdir},g' -e 's
|
|||
# Install kernel modules, if any
|
||||
make V=1 modules_install ARCH={KERNEL_ARCH} \
|
||||
INSTALL_MOD_PATH=%{buildroot} \
|
||||
INSTALL_DTBS_PATH=%{buildroot}/boot
|
||||
INSTALL_DTBS_PATH=%{buildroot}/boot/dtbs
|
||||
|
||||
make dtbs_install ARCH={KERNEL_ARCH} \
|
||||
INSTALL_MOD_PATH=%{buildroot} \
|
||||
|
|
|
@ -40,43 +40,55 @@ def cleanup_loop_devices():
|
|||
loop_device = loop_device.strip()
|
||||
if loop_device:
|
||||
print(f"Detaching {loop_device}")
|
||||
subprocess.run(["sudo", "losetup", "-d", loop_device], check=False)
|
||||
subprocess.run(["losetup", "-d", loop_device], check=False)
|
||||
|
||||
|
||||
def setup_loop_device(disk_image_path):
|
||||
cleanup_loop_devices()
|
||||
|
||||
cmd = ["sudo", "losetup", "-fP", "--show", disk_image_path]
|
||||
cmd = ["losetup", "-fP", "--show", disk_image_path]
|
||||
result = subprocess.run(cmd, check=True, capture_output=True, text=True)
|
||||
loop_device = result.stdout.strip()
|
||||
print(f"Disk image mounted to loop device {loop_device}")
|
||||
return loop_device
|
||||
|
||||
|
||||
def create_partitions(loop_device, config):
|
||||
root_size = config.get("ROOT_SIZE", "1024MB").rstrip("MB")
|
||||
root_fstype = config.get("ROOT_FSTYPE", "ext4")
|
||||
boot_size = config.get("BOOT_SIZE")
|
||||
boot_fstype = config.get("BOOT_FSTYPE", "vfat") if boot_size else None
|
||||
boot_fstype = config.get("BOOT_FSTYPE")
|
||||
|
||||
print(f"Creating partitions on {loop_device}...")
|
||||
|
||||
if boot_size:
|
||||
boot_size = boot_size.rstrip("MB")
|
||||
fdisk_commands = f"""\nn\np\n\n\n+{boot_size}M\nn\np\n\n\n\nw"""
|
||||
subprocess.run(["sudo", "fdisk", "--wipe", "always", loop_device], input=fdisk_commands, text=True, check=True)
|
||||
print(f" - Formatting /boot as {boot_fstype} ({boot_size} MB)")
|
||||
subprocess.run(["sudo", "mkfs.vfat", "-F", "32", f"{loop_device}p1"], check=True)
|
||||
|
||||
# boot partition with BOOT_SIZE from config
|
||||
fdisk_commands = f"""\nn\np\n\n\n+{boot_size}M\n"""
|
||||
# change partition type here to W95 FAT
|
||||
if boot_fstype == "vfat":
|
||||
fdisk_commands += "t\nc\n"
|
||||
fdisk_commands += f"""n\np\n\n\n\nw"""
|
||||
|
||||
# Применяем команды fdisk
|
||||
subprocess.run(["fdisk", "--wipe", "always", loop_device], input=fdisk_commands, text=True, check=True)
|
||||
|
||||
if boot_fstype == "vfat":
|
||||
print(f" - Formatting /boot as {boot_fstype} ({boot_size} MB)")
|
||||
subprocess.run(["mkfs.vfat", "-F", "32", f"{loop_device}p1"], check=True)
|
||||
else:
|
||||
print(f" - Formatting /boot as {boot_fstype or 'ext4'} ({boot_size} MB)")
|
||||
subprocess.run(["mkfs.ext4", f"{loop_device}p1"], check=True)
|
||||
|
||||
print(f" - Formatting root (/) as {root_fstype} ({root_size} MB)")
|
||||
subprocess.run(["sudo", "mkfs.ext4", f"{loop_device}p2"], check=True)
|
||||
subprocess.run(["mkfs.ext4", f"{loop_device}p2"], check=True)
|
||||
|
||||
else:
|
||||
fdisk_commands = f"""o\nn\np\n\n\n\nw\n"""
|
||||
subprocess.run(["sudo", "fdisk", "--wipe", "always", loop_device], input=fdisk_commands, text=True, check=True)
|
||||
subprocess.run(["fdisk", "--wipe", "always", loop_device], input=fdisk_commands, text=True, check=True)
|
||||
|
||||
print(f" - Formatting single root (/) partition as {root_fstype} ({root_size} MB)")
|
||||
subprocess.run(["sudo", "mkfs.ext4", f"{loop_device}p1"], check=True)
|
||||
subprocess.run(["mkfs.ext4", f"{loop_device}p1"], check=True)
|
||||
|
||||
print("Partitioning and formatting complete.")
|
||||
|
||||
|
@ -87,14 +99,13 @@ def mount_partitions(config, loop_device, tmp_dir, vendor, device):
|
|||
boot_partition = f"{loop_device}p1"
|
||||
root_partition = f"{loop_device}p2" if "BOOT_SIZE" in config else f"{loop_device}p1"
|
||||
|
||||
print(f"Mounting root (/) partition at {rootfs_dir}")
|
||||
subprocess.run(["mount", root_partition, rootfs_dir], check=True)
|
||||
|
||||
if "BOOT_SIZE" in config:
|
||||
boot_dir = os.path.join(rootfs_dir, "boot")
|
||||
os.makedirs(boot_dir, exist_ok=True)
|
||||
|
||||
print(f"Mounting /boot partition at {boot_dir}")
|
||||
subprocess.run(["sudo", "mount", boot_partition, boot_dir], check=True)
|
||||
|
||||
print(f"Mounting root (/) partition at {rootfs_dir}")
|
||||
subprocess.run(["sudo", "mount", root_partition, rootfs_dir], check=True)
|
||||
subprocess.run(["mount", boot_partition, boot_dir], check=True)
|
||||
|
||||
print("Mounting complete.")
|
||||
|
|
Loading…
Add table
Reference in a new issue