Skip to content

Commit

Permalink
[syterkit] support card boot
Browse files Browse the repository at this point in the history
  • Loading branch information
YuzukiTsuru committed Dec 1, 2023
1 parent 591ffee commit dfe25f0
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 5 deletions.
2 changes: 1 addition & 1 deletion kernel/SyterKit/app/hello_world/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extern uint32_t __stack_ddr_srv_end;

sunxi_uart_t uart_dbg = {
.base = 0x02500000,
.id = 2,
.id = 0,
.gpio_tx = {GPIO_PIN(PORTH, 9), GPIO_PERIPH_MUX5},
.gpio_rx = {GPIO_PIN(PORTH, 10), GPIO_PERIPH_MUX5},
};
Expand Down
2 changes: 1 addition & 1 deletion kernel/SyterKit/app/read_chip_efuse/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extern uint32_t __stack_ddr_srv_end;

sunxi_uart_t uart_dbg = {
.base = 0x02500000,
.id = 2,
.id = 0,
.gpio_tx = {GPIO_PIN(PORTH, 9), GPIO_PERIPH_MUX5},
.gpio_rx = {GPIO_PIN(PORTH, 10), GPIO_PERIPH_MUX5},
};
Expand Down
2 changes: 1 addition & 1 deletion kernel/SyterKit/app/read_chipsid/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extern uint32_t __stack_ddr_srv_end;

sunxi_uart_t uart_dbg = {
.base = 0x02500000,
.id = 2,
.id = 0,
.gpio_tx = {GPIO_PIN(PORTH, 9), GPIO_PERIPH_MUX5},
.gpio_rx = {GPIO_PIN(PORTH, 10), GPIO_PERIPH_MUX5},
};
Expand Down
4 changes: 2 additions & 2 deletions kernel/SyterKit/app/syter_boot/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extern uint32_t __stack_ddr_srv_start;
extern uint32_t __stack_ddr_srv_end;

#define CONFIG_KERNEL_FILENAME "zImage"
#define CONFIG_DTB_FILENAME "sun8i-v851s-tinyvision.dtb"
#define CONFIG_DTB_FILENAME "sunxi.dtb"

#define CONFIG_SDMMC_SPEED_TEST_SIZE 1024 // (unit: 512B sectors)

Expand Down Expand Up @@ -67,7 +67,7 @@ typedef struct

sunxi_uart_t uart_dbg = {
.base = 0x02500000,
.id = 2,
.id = 0,
.gpio_tx = {GPIO_PIN(PORTH, 9), GPIO_PERIPH_MUX5},
.gpio_rx = {GPIO_PIN(PORTH, 10), GPIO_PERIPH_MUX5},
};
Expand Down
48 changes: 48 additions & 0 deletions kernel/SyterKit/scripts/genimage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash

die() {
cat <<EOF >&2
Error: $@
Usage: ${0} -c GENIMAGE_CONFIG_FILE
EOF
exit 1
}

# Parse arguments and put into argument list of the script
opts="$(getopt -n "${0##*/}" -o c: -- "$@")" || exit $?
eval set -- "$opts"

GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"

while true ; do
case "$1" in
-c)
GENIMAGE_CFG="${2}";
shift 2 ;;
--) # Discard all non-option parameters
shift 1;
break ;;
*)
die "unknown option '${1}'" ;;
esac
done

[ -n "${GENIMAGE_CFG}" ] || die "Missing argument"

# Pass an empty rootpath. genimage makes a full copy of the given rootpath to
# ${GENIMAGE_TMP}/root so passing TARGET_DIR would be a waste of time and disk
# space. We don't rely on genimage to build the rootfs image, just to insert a
# pre-built one in the disk image.

trap 'rm -rf "${ROOTPATH_TMP}"' EXIT
ROOTPATH_TMP="$(mktemp -d)"
GENIMAGE_TMP="$(mktemp -d)"
rm -rf "${GENIMAGE_TMP}"

genimage \
--rootpath "${ROOTPATH_TMP}" \
--tmppath "${GENIMAGE_TMP}" \
--inputpath "${BINARIES_DIR}" \
--outputpath "${BINARIES_DIR}" \
--config "${GENIMAGE_CFG}"
36 changes: 36 additions & 0 deletions kernel/SyterKit/scripts/genimage_buildroot.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
image boot.vfat {
vfat {
files = {
"zImage",
"sunxi.dtb"
}
}
size = 8M
}

image sdcard.img {
hdimage {}

partition boot0 {
in-partition-table = "no"
image = "syter_boot_bin.elf"
offset = 8K
}

partition boot0-gpt {
in-partition-table = "no"
image = "syter_boot_bin.elf"
offset = 128K
}

partition kernel {
partition-type = 0xC
bootable = "true"
image = "boot.vfat"
}

partition rootfs {
partition-type = 0x83
image = "rootfs.img"
}
}
15 changes: 15 additions & 0 deletions kernel/SyterKit/scripts/genimage_syterboot_only.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
image sdcard.img {
hdimage {}

partition boot0 {
in-partition-table = "no"
image = "syter_boot_bin.elf"
offset = 8K
}

partition boot0-gpt {
in-partition-table = "no"
image = "syter_boot_bin.elf"
offset = 128K
}
}

0 comments on commit dfe25f0

Please sign in to comment.