From: Dagg Stompler Date: Fri, 17 Jul 2020 16:46:42 +0000 (+0300) Subject: configs/odroidc2: new defconfig X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c8ee85ecd91c0b36be8694224b80846a276a849e;p=buildroot.git configs/odroidc2: new defconfig Signed-off-by: Dagg Stompler Signed-off-by: Thomas Petazzoni --- diff --git a/DEVELOPERS b/DEVELOPERS index 8c3f47cdb7..8faaf890c0 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -635,6 +635,8 @@ F: arch/Config.in.powerpc F: package/kvm-unit-tests N: Dagg Stompler +F: board/odroidc2/ +F: configs/odroidc2_defconfig F: package/meson-tools/ F: package/odroidc2-firmware/ diff --git a/board/hardkernel/odroidc2/boot.cmd b/board/hardkernel/odroidc2/boot.cmd new file mode 100644 index 0000000000..d800a6d44b --- /dev/null +++ b/board/hardkernel/odroidc2/boot.cmd @@ -0,0 +1,11 @@ +setenv kernel_filename "Image" +setenv fdt_filename "meson-gxbb-odroidc2.dtb" +setenv bootargs "console=ttyAML0,115200n8 earlyprintk root=/dev/mmcblk1p2 rootwait rw" + +echo > Loading Kernel... +fatload mmc 0:1 ${kernel_addr_r} ${kernel_filename} +echo > Loading FDT... +fatload mmc 0:1 ${fdt_addr_r} ${fdt_filename} + +echo > Booting System... +booti ${kernel_addr_r} - ${fdt_addr_r} diff --git a/board/hardkernel/odroidc2/genimage.cfg b/board/hardkernel/odroidc2/genimage.cfg new file mode 100644 index 0000000000..c9306b0639 --- /dev/null +++ b/board/hardkernel/odroidc2/genimage.cfg @@ -0,0 +1,39 @@ +image boot.vfat { + vfat { + files = { + "Image", + "meson-gxbb-odroidc2.dtb", + "boot.scr" + } + } + size = 64M +} + +image sdcard.img { + hdimage { + } + + partition bl1 { + in-partition-table = "no" + image = "bl1.bin.hardkernel" + offset = 0 + } + + partition u-boot { + in-partition-table = "no" + image = "uboot-odc2.img" + offset = 49664 + } + + partition boot { + partition-type = 0xC + bootable = "true" + image = "boot.vfat" + } + + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext4" + size = 512M + } +} diff --git a/board/hardkernel/odroidc2/post-image.sh b/board/hardkernel/odroidc2/post-image.sh new file mode 100755 index 0000000000..eb6fd4f09a --- /dev/null +++ b/board/hardkernel/odroidc2/post-image.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +BOARD_DIR="$(dirname $0)" + +${HOST_DIR}/bin/fip_create \ + --bl30 ${BINARIES_DIR}/bl30.bin \ + --bl301 ${BINARIES_DIR}/bl301.bin \ + --bl31 ${BINARIES_DIR}/bl31.bin \ + --bl33 ${BINARIES_DIR}/u-boot.bin \ + ${BINARIES_DIR}/fip.bin + +${HOST_DIR}/bin/fip_create --dump ${BINARIES_DIR}/fip.bin + +cat ${BINARIES_DIR}/bl2.package ${BINARIES_DIR}/fip.bin \ + > ${BINARIES_DIR}/boot_new.bin + +${HOST_DIR}/bin/amlbootsig ${BINARIES_DIR}/boot_new.bin ${BINARIES_DIR}/u-boot.img + +dd if=${BINARIES_DIR}/u-boot.img of=${BINARIES_DIR}/uboot-odc2.img bs=512 skip=96 + +support/scripts/genimage.sh -c ${BOARD_DIR}/genimage.cfg diff --git a/board/hardkernel/odroidc2/readme.txt b/board/hardkernel/odroidc2/readme.txt new file mode 100644 index 0000000000..24847827af --- /dev/null +++ b/board/hardkernel/odroidc2/readme.txt @@ -0,0 +1,64 @@ +ODROID-C2 + +Intro +===== +To be able to use ODROID-C2 board with the images generated by +Buildroot, you have to prepare the SDCard or eMMC. + +How to build it +=============== + + $ make odroidc2_defconfig + +Then you can edit the build options using + + $ make menuconfig + +Compile all and build rootfs image: + + $ make + +Note: you will need to have access to the network, since Buildroot will +download the packages' sources. + +Result of the build +------------------- + +After building, you should obtain this tree: + + output/images/ + +-- bl1.bin.hardkernel + +-- bl2.package + +-- bl301.bin + +-- bl30.bin + +-- bl31.bin + +-- boot_new.bin + +-- boot.scr [1] + +-- boot.vfat + +-- fip.bin + +-- Image [2] + +-- meson-gxbb-odroidc2.dtb + +-- rootfs.ext2 + +-- rootfs.ext4 + +-- rootfs.tar + +-- sdcard.img + +-- u-boot.bin + +-- u-boot.img + +-- uboot-odc2.img [3] + +[1] This is the ODROID-C2 configuration file used in u-boot. +[2] This is the ODROID-C2 kernel image file which will be booted. +[3] This is the ODROID-C2 signed u-boot image which will be used. + +How to write the SD card or eMMC +================================ + +Once the build process is finished you will have an image called "sdcard.img" +in the output/images/ directory. + +Copy the bootable "sdcard.img" onto an SD card or eMMC with "dd": + + $ sudo dd if=output/images/sdcard.img of=/dev/sdX + +Insert the SDcard into your ODROID-C2, and power it up. Your new system +should come up now. diff --git a/board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload b/board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload new file mode 100755 index 0000000000..8d694a7331 --- /dev/null +++ b/board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload @@ -0,0 +1,23 @@ +#!/bin/sh +# + +load_drivers() +{ + echo "Loading needed modules..." + for file in $(echo "dwmac_generic dwmac-meson8b meson_dw_hdmi meson_gxbb_wdt"); do + modprobe ${file} + done +} + +case "$1" in + start) + load_drivers + ;; + stop) + ;; + restart|reload) + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac diff --git a/configs/odroidc2_defconfig b/configs/odroidc2_defconfig new file mode 100644 index 0000000000..bb85431891 --- /dev/null +++ b/configs/odroidc2_defconfig @@ -0,0 +1,37 @@ +# Architecture +BR2_aarch64=y + +# System +BR2_TARGET_GENERIC_HOSTNAME="odroidc2" +BR2_TARGET_GENERIC_GETTY_PORT="ttyAML0" +BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_4=y +BR2_ROOTFS_OVERLAY="board/hardkernel/odroidc2/rootfs_overlay" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/hardkernel/odroidc2/post-image.sh" + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.7" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="amlogic/meson-gxbb-odroidc2" +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y + +# U-Boot +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY=y +BR2_TARGET_UBOOT_BOARDNAME="odroid-c2" +BR2_TARGET_UBOOT_CUSTOM_VERSION="2020.07" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_BOOT_SCRIPT=y +BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE="board/hardkernel/odroidc2/boot.cmd" + +# Firmware +BR2_PACKAGE_ODROIDC2_FIRMWARE=y + +# Required tools to create the SD image +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MESON_TOOLS=y +BR2_PACKAGE_HOST_MTOOLS=y