mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
Re-extract the kernel patches as a series. Re-extract the u-boot patches as "git format-patch" command. Unified patch extraction makes it easier to work with patches.
339 lines
13 KiB
Diff
339 lines
13 KiB
Diff
From eec3cefda7f6f5b50b7fce2f07736f79c855d93a Mon Sep 17 00:00:00 2001
|
|
From: Patrick Yavitz <pyavitz@armbian.com>
|
|
Date: Thu, 11 Jul 2024 07:43:37 -0400
|
|
Subject: [PATCH 3/4] Syslinux and script support
|
|
|
|
Signed-off-by: Patrick Yavitz <pyavitz@armbian.com>
|
|
---
|
|
board/spacemit/k1-x/k1-x.env | 185 ++++-------------------------------
|
|
board/spacemit/k1-x/k1x.c | 20 ++--
|
|
configs/k1_defconfig | 3 +
|
|
include/configs/k1-x.h | 23 ++---
|
|
4 files changed, 43 insertions(+), 188 deletions(-)
|
|
|
|
diff --git a/board/spacemit/k1-x/k1-x.env b/board/spacemit/k1-x/k1-x.env
|
|
index bdb32b35..acb1ef7a 100644
|
|
--- a/board/spacemit/k1-x/k1-x.env
|
|
+++ b/board/spacemit/k1-x/k1-x.env
|
|
@@ -8,169 +8,24 @@ loglevel=8
|
|
stderr=serial
|
|
stdin=serial,usbkbd
|
|
stdout=serial
|
|
-workqueue.default_affinity_scope=system
|
|
-
|
|
-//partitions/mtdparts/mtdids would set while flashing env.bin
|
|
-
|
|
-// Nor flash rootfs device
|
|
-nor_root=/dev/mtdblock6
|
|
-nor_rootfstype=squashfs
|
|
-
|
|
-// eMMC/SDCard rootfs device
|
|
-mmc_rootfstype=ext4
|
|
-
|
|
-// rootfs part number must less than 99
|
|
-rootfs_part_to_ul=echo "set rootfs_part to ul"; setexpr temp_num_0 ${rootfs_part} / a;\
|
|
- setexpr temp_num_1 ${rootfs_part} % a;\
|
|
- setenv rootfs_part ${temp_num_0}${temp_num_1};
|
|
-
|
|
-// Get "rootfs" partition number in decimal, and set var "blk_root"
|
|
-// Variable "boot_devnum" is set during board_lat_init()
|
|
-set_rootfs_env=if test "${bootfs_devname}" = mmc; then \
|
|
- setenv blk_root "/dev/mmcblk${boot_devnum}p${rootfs_part}"; \
|
|
- elif test "${bootfs_devname}" = nvme; then \
|
|
- setenv blk_root "/dev/nvme${boot_devnum}n1p${rootfs_part}"; \
|
|
- else echo "not define rootfs part at this blk device, add to env"; \
|
|
- fi;
|
|
-get_rootfs_env=part number ${bootfs_devname} ${boot_devnum} rootfs rootfs_part; \
|
|
- setexpr rootfs_part ${rootfs_part} + 0; \
|
|
- if test ${rootfs_part} > 9 ; then run rootfs_part_to_ul;fi; \
|
|
- echo "get rootfs_part index:${rootfs_part}";
|
|
-
|
|
-set_mmc_root=run get_rootfs_env; run set_rootfs_env;
|
|
-
|
|
-set_nor_root=run get_rootfs_env; run set_rootfs_env;
|
|
-
|
|
-//override here, otherwise gen random addr and save to eeprom by uboot
|
|
-//ethaddr=fe:fe:fe:22:22:01
|
|
-//eth1addr=fe:fe:fe:22:22:02
|
|
-
|
|
-ipaddr=10.0.92.100
|
|
-netmask=255.255.255.0
|
|
-serverip=10.0.92.134
|
|
-gatewayip=10.0.92.1
|
|
-net_data_path=net_flash_file/net_flash_file/
|
|
-
|
|
-preboot=
|
|
-ramdisk_size=-
|
|
-ramdisk_combo=-
|
|
-knl_name=Image.itb
|
|
-ramdisk_name=initramfs-generic.img
|
|
-dtb_dir=
|
|
-dtb_name=k1-x_evb.dtb
|
|
-splashfile=bianbu.bmp
|
|
-mdio_intf=
|
|
-phyaddr0=1
|
|
-phy_link_time=10000
|
|
-netdev=eth0
|
|
-
|
|
-// Common boot args
|
|
-set_bootargs=setenv bootargs earlycon=${earlycon} earlyprintk quiet splash console=${console} loglevel=${loglevel} clk_ignore_unused swiotlb=65536 rdinit=${init} product_name=${product_name}
|
|
-commonargs=run set_bootargs; setenv bootargs "${bootargs}" plymouth.ignore-serial-consoles plymouth.prefer-fbcon workqueue.default_affinity_scope=${workqueue.default_affinity_scope}
|
|
-
|
|
-//detect product_name from env and select dtb file to load
|
|
-dtb_env=if test -n "${product_name}"; then \
|
|
- if test "${product_name}" = k1_evb; then \
|
|
- setenv dtb_name ${dtb_dir}/k1-x_evb.dtb; \
|
|
- elif test "${product_name}" = k1_deb1; then \
|
|
- setenv dtb_name ${dtb_dir}/k1-x_deb1.dtb; \
|
|
- elif test "${product_name}" = k1_deb2; then \
|
|
- setenv dtb_name ${dtb_dir}/k1-x_deb2.dtb; \
|
|
- elif test "${product_name}" = k1_hs450; then \
|
|
- setenv dtb_name ${dtb_dir}/k1-x_hs450.dtb; \
|
|
- elif test "${product_name}" = k1_kx312; then \
|
|
- setenv dtb_name ${dtb_dir}/k1-x_kx312.dtb; \
|
|
- elif test "${product_name}" = k1_mingo; then \
|
|
- setenv dtb_name ${dtb_dir}/k1-x_mingo.dtb; \
|
|
- elif test "${product_name}" = k1_MINI-PC; then \
|
|
- setenv dtb_name ${dtb_dir}/k1-x_MINI-PC.dtb; \
|
|
- else \
|
|
- echo "match dtb by product_name: ${dtb_dir}/${product_name}.dtb"; \
|
|
- setenv dtb_name ${dtb_dir}/${product_name}.dtb; \
|
|
- fi; \
|
|
- fi;
|
|
-
|
|
-detect_dtb=echo "product_name: ${product_name}"; run dtb_env; echo "select ${dtb_name} to load";
|
|
-
|
|
-loadknl=echo "Loading kernel..."; \
|
|
- load ${bootfs_devname} ${boot_devnum}:${bootfs_part} ${kernel_addr_r} ${knl_name};
|
|
-
|
|
-loadramdisk=echo "Loading ramdisk ..."; \
|
|
- if load ${bootfs_devname} ${boot_devnum}:${bootfs_part} ${ramdisk_addr} ${ramdisk_name}; then \
|
|
- size ${bootfs_devname} ${boot_devnum}:${bootfs_part} ${ramdisk_name}; \
|
|
- setenv ramdisk_size ${filesize}; \
|
|
- setenv ramdisk_combo ${ramdisk_addr}:${ramdisk_size}; \
|
|
- else \
|
|
- echo "load ramdisk from bootfs fail, use built-in ramdisk"; \
|
|
- setenv ramdisk_addr -; \
|
|
- fi;
|
|
-
|
|
-loaddtb=echo "Loading dtb..."; \
|
|
- if load ${bootfs_devname} ${boot_devnum}:${bootfs_part} ${dtb_addr} ${dtb_name}; then \
|
|
- else \
|
|
- echo "load dtb from bootfs fail, use built-in dtb"; \
|
|
- setenv dtb_addr ""; \
|
|
- fi;
|
|
-
|
|
-// Nor+ssd boot combo
|
|
-set_nor_args=setenv bootargs "${bootargs}" mtdparts=${mtdparts} root=${blk_root} rootfstype=ext4
|
|
-nor_boot=echo "Try to boot from ${bootfs_devname}${boot_devnum} ..."; \
|
|
- run commonargs; \
|
|
- run set_nor_root; \
|
|
- run set_nor_args; \
|
|
- run detect_dtb; \
|
|
- run loadknl; \
|
|
- run loaddtb; \
|
|
- run loadramdisk; \
|
|
- bootm ${kernel_addr_r} ${ramdisk_combo} ${dtb_addr}; \
|
|
- echo "########### boot kernel failed by default config, check your boot config #############"
|
|
-
|
|
-//##############################################################################
|
|
-// eMMC/SDCard boot
|
|
-//##############################################################################
|
|
-set_mmc_args=setenv bootargs "${bootargs}" root=${blk_root} rootwait rootfstype=${mmc_rootfstype};
|
|
-
|
|
-mmc_boot=echo "Try to boot from ${bootfs_devname}${boot_devnum} ..."; \
|
|
- run commonargs; \
|
|
- run set_mmc_root; \
|
|
- run set_mmc_args; \
|
|
- run detect_dtb; \
|
|
- run loadknl; \
|
|
- run loaddtb; \
|
|
- run loadramdisk; \
|
|
- bootm ${kernel_addr_r} ${ramdisk_combo} ${dtb_addr}; \
|
|
- echo "########### boot kernel failed by default config, check your boot config #############"
|
|
-
|
|
-// Variable "boot_device" is set during board_late_init()
|
|
-autoboot=if test ${boot_device} = nand; then \
|
|
- run nand_boot; \
|
|
- elif test ${boot_device} = nor; then \
|
|
- run nor_boot; \
|
|
- elif test ${boot_device} = mmc; then \
|
|
- run mmc_boot; \
|
|
- fi;
|
|
-
|
|
-bootcmd=run autoboot; echo "run autoboot"
|
|
-
|
|
-// Boot menu definitions
|
|
-boot_default=echo "Current Boot Device: ${boot_device}"
|
|
-flash_default=echo "Returning to Boot Menu..."
|
|
-flash_from_usb=echo "recovery from usb...... "; \
|
|
- flash_image usb;
|
|
-flash_from_mmc=echo "recovery from mmc...... " \
|
|
- flash_image mmc;
|
|
-flash_from_net=echo "recovery from net...... " \
|
|
- flash_image net;
|
|
-
|
|
-bootmenu_delay=5
|
|
-bootmenu_0="-------- Boot Options --------"=run boot_default
|
|
-bootmenu_1="Boot from Nor"=run nor_boot
|
|
-bootmenu_2="Boot from Nand"=run nand_boot
|
|
-bootmenu_3="Boot from MMC"=run mmc_boot
|
|
-bootmenu_4="Autoboot"=run autoboot
|
|
-bootmenu_5="Show current Boot Device"=run boot_default
|
|
-bootmenu_6="-------- Flash Options --------"=run flash_default
|
|
-bootmenu_7="recovery from usb"=run flash_from_usb
|
|
-bootmenu_8="recovery from mmc"=run flash_from_mmc
|
|
-bootmenu_9="recovery from net"=run flash_from_net
|
|
|
|
+// SYSLINUX and SCRIPT Support
|
|
+autoboot=if test -e ${devtype} ${devnum}:${distro_bootpart} /extlinux/extlinux.conf; then \
|
|
+ sysboot ${devtype} ${devnum}:${distro_bootpart} any 0x2000000 /extlinux/extlinux.conf; \
|
|
+ elif test -e ${devtype} ${devnum}:${distro_bootpart} /boot/extlinux/extlinux.conf; then \
|
|
+ sysboot ${devtype} ${devnum}:${distro_bootpart} any 0x2000000 /boot/extlinux/extlinux.conf; \
|
|
+ elif test -e ${devtype} ${devnum}:${distro_bootpart} /boot.scr; then \
|
|
+ load ${devtype} ${devnum}:${distro_bootpart} 0x2000000 /boot.scr; source 0x2000000; \
|
|
+ elif test -e ${devtype} ${devnum}:${distro_bootpart} /boot/boot.scr; then \
|
|
+ load ${devtype} ${devnum}:${distro_bootpart} 0x2000000 /boot/boot.scr; source 0x2000000; \
|
|
+ elif test -e nvme 0:1 /extlinux/extlinux.conf; then \
|
|
+ sysboot nvme 0:1 any 0x2000000 /extlinux/extlinux.conf; \
|
|
+ elif test -e nvme 0:1 /boot/extlinux/extlinux.conf; then \
|
|
+ sysboot nvme 0:1 any 0x2000000 /boot/extlinux/extlinux.conf; \
|
|
+ elif test -e nvme 0:1 /boot.scr; then \
|
|
+ load nvme 0:1 0x2000000 /boot.scr; source 0x2000000; \
|
|
+ elif test -e nvme 0:1 /boot/boot.scr; then \
|
|
+ load nvme 0:1 0x2000000 /boot/boot.scr; source 0x2000000; \
|
|
+ fi;
|
|
+
|
|
+bootcmd=echo "Loading ..."; run autoboot
|
|
diff --git a/board/spacemit/k1-x/k1x.c b/board/spacemit/k1-x/k1x.c
|
|
index 70141121..ada5f1fc 100644
|
|
--- a/board/spacemit/k1-x/k1x.c
|
|
+++ b/board/spacemit/k1-x/k1x.c
|
|
@@ -330,8 +330,8 @@ void _load_env_from_blk(struct blk_desc *dev_desc, const char *dev_name, int dev
|
|
#endif
|
|
}
|
|
|
|
- env_set("bootfs_part", simple_itoa(part));
|
|
- env_set("bootfs_devname", dev_name);
|
|
+ env_set("distro_bootpart", simple_itoa(part));
|
|
+ env_set("devnum", dev_name);
|
|
|
|
/*load env.txt and import to uboot*/
|
|
memset((void *)CONFIG_SPL_LOAD_FIT_ADDRESS, 0, CONFIG_ENV_SIZE);
|
|
@@ -510,7 +510,7 @@ void setenv_boot_mode(void)
|
|
u32 boot_mode = get_boot_mode();
|
|
switch (boot_mode) {
|
|
case BOOT_MODE_NAND:
|
|
- env_set("boot_device", "nand");
|
|
+ env_set("devtype", "nand");
|
|
break;
|
|
case BOOT_MODE_NOR:
|
|
char *blk_name;
|
|
@@ -521,23 +521,23 @@ void setenv_boot_mode(void)
|
|
return;
|
|
}
|
|
|
|
- env_set("boot_device", "nor");
|
|
- env_set("boot_devnum", simple_itoa(blk_index));
|
|
+ env_set("devtype", "nor");
|
|
+ env_set("devnum", simple_itoa(blk_index));
|
|
break;
|
|
case BOOT_MODE_EMMC:
|
|
- env_set("boot_device", "mmc");
|
|
- env_set("boot_devnum", simple_itoa(MMC_DEV_EMMC));
|
|
+ env_set("devtype", "mmc");
|
|
+ env_set("devnum", simple_itoa(MMC_DEV_EMMC));
|
|
break;
|
|
case BOOT_MODE_SD:
|
|
- env_set("boot_device", "mmc");
|
|
- env_set("boot_devnum", simple_itoa(MMC_DEV_SD));
|
|
+ env_set("devtype", "mmc");
|
|
+ env_set("devnum", simple_itoa(MMC_DEV_SD));
|
|
break;
|
|
case BOOT_MODE_USB:
|
|
// for fastboot image download and run test
|
|
env_set("bootcmd", CONFIG_BOOTCOMMAND);
|
|
break;
|
|
default:
|
|
- env_set("boot_device", "");
|
|
+ env_set("devtype", "");
|
|
break;
|
|
}
|
|
}
|
|
diff --git a/configs/k1_defconfig b/configs/k1_defconfig
|
|
index 7ae44243..5af667bf 100644
|
|
--- a/configs/k1_defconfig
|
|
+++ b/configs/k1_defconfig
|
|
@@ -43,6 +43,8 @@ CONFIG_AUTOBOOT_STOP_STR=" "
|
|
CONFIG_AUTOBOOT_KEYED_CTRLC=y
|
|
CONFIG_USE_BOOTCOMMAND=y
|
|
CONFIG_BOOTCOMMAND="bootm 0x11000000"
|
|
+CONFIG_USE_PREBOOT=y
|
|
+CONFIG_PREBOOT="usb start; nvme scan; nvme part"
|
|
CONFIG_LOGLEVEL=7
|
|
CONFIG_SPL_LOGLEVEL=1
|
|
# CONFIG_SYS_DEVICE_NULLDEV is not set
|
|
@@ -279,3 +281,4 @@ CONFIG_PRINT_TIMESTAMP=y
|
|
# CONFIG_SPL_SHA1 is not set
|
|
# CONFIG_SPL_SHA256 is not set
|
|
CONFIG_ZSTD=y
|
|
+CONFIG_OF_LIBFDT_OVERLAY=y
|
|
diff --git a/include/configs/k1-x.h b/include/configs/k1-x.h
|
|
index f1f4be78..34ad156e 100644
|
|
--- a/include/configs/k1-x.h
|
|
+++ b/include/configs/k1-x.h
|
|
@@ -84,11 +84,6 @@
|
|
#define TLV_CODE_EEPROM_I2C_INDEX 0x81
|
|
#define TLV_CODE_EEPROM_PIN_GROUP 0x82
|
|
|
|
-// #define RAMDISK_LOAD_ADDR (CONFIG_FASTBOOT_BUF_ADDR + CONFIG_FASTBOOT_BUF_SIZE)
|
|
-// #define DTB_LOAD_ADDR (CONFIG_FASTBOOT_BUF_ADDR + CONFIG_FASTBOOT_BUF_SIZE * 2)
|
|
-#define RAMDISK_LOAD_ADDR 0x21000000
|
|
-#define DTB_LOAD_ADDR 0x31000000
|
|
-
|
|
// for those has NOT been through test procedure(ATE)
|
|
#define SVT_DRO_DEFAULT_VALUE (120)
|
|
|
|
@@ -142,6 +137,11 @@ struct boot_storage_op
|
|
#define BOOT_TARGET_DEVICES(func) \
|
|
func(QEMU, qemu, na)
|
|
|
|
+#define KERNEL_ADDR_R __stringify(0x10000000)
|
|
+#define RAMDISK_ADDR_R __stringify(0x21000000)
|
|
+#define FDT_ADDR_R __stringify(0x31000000)
|
|
+#define FDTOVERLAY_ADDR_R __stringify(0x01000000)
|
|
+
|
|
#include <config_distro_bootcmd.h>
|
|
|
|
#define BOOTENV_DEV_QEMU(devtypeu, devtypel, instance) \
|
|
@@ -167,11 +167,6 @@ struct boot_storage_op
|
|
/*if env not use for spl, please define to board/spacemit/k1-x/k1-x.env */
|
|
#define CONFIG_EXTRA_ENV_SETTINGS \
|
|
"stdout_flash=serial,vidconsole\0" \
|
|
- "kernel_comp_addr_r=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
|
|
- "kernel_comp_size=" __stringify(CONFIG_FASTBOOT_BUF_SIZE) "\0" \
|
|
- "kernel_addr_r=" __stringify(CONFIG_FASTBOOT_BUF_ADDR) "\0" \
|
|
- "ramdisk_addr=" __stringify(RAMDISK_LOAD_ADDR) "\0" \
|
|
- "dtb_addr=" __stringify(DTB_LOAD_ADDR) "\0" \
|
|
"scriptaddr=0x2c100000\0" \
|
|
"pxefile_addr_r=0x0c200000\0" \
|
|
"ipaddr=192.168.1.15\0" \
|
|
@@ -179,9 +174,11 @@ struct boot_storage_op
|
|
"serverip=10.0.92.134\0" \
|
|
"gatewayip=192.168.1.1\0" \
|
|
"net_data_path=spacemit_flash_file/net_flash_file/\0" \
|
|
- "splashimage=" __stringify(CONFIG_FASTBOOT_BUF_ADDR) "\0" \
|
|
- "splashpos=m,m\0" \
|
|
- "splashfile=bianbu.bmp\0" \
|
|
+ "fdt_addr_r=" FDT_ADDR_R "\0" \
|
|
+ "kernel_addr_r=" KERNEL_ADDR_R "\0" \
|
|
+ "ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \
|
|
+ "fdtoverlay_addr_r=" FDTOVERLAY_ADDR_R "\0" \
|
|
+ "fdtfile=spacemit/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
|
|
BOOTENV_DEVICE_CONFIG
|
|
|
|
|
|
--
|
|
2.35.3
|
|
|