forked from home-assistant/operating-system
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request home-assistant#7 from adeepn/jethome_5.7
Jethome 5.7 j80 support
- Loading branch information
Showing
42 changed files
with
5,871 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
buildroot-external/board/jethome/jethub-h1/hassos-hook.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#!/bin/bash | ||
# shellcheck disable=SC2155 | ||
|
||
# Change size partitions | ||
BOOT_SIZE=(64M 64M) | ||
BOOTSTATE_SIZE=8M | ||
SYSTEM_SIZE=256M | ||
KERNEL_SIZE=64M | ||
OVERLAY_SIZE=128M | ||
DATA_SIZE=1G | ||
|
||
set -e # Exit immediately if a command exits with a non-zero status | ||
set -u # Treat unset variables and parameters as an error | ||
|
||
# some functions | ||
print_var() { | ||
if [ -n "$1" ] ; then | ||
echo "-- ${1}==${!1}" | ||
else | ||
echo "${FUNCNAME[0]}(): Null parameter passed to this function" | ||
fi | ||
} | ||
|
||
print_cmd_title() { | ||
if [ -n "$1" ] ; then | ||
echo "###### ${1} ######" | ||
else | ||
echo "${FUNCNAME[0]}(): Null parameter passed to this function" | ||
fi | ||
} | ||
|
||
self_name() { | ||
echo ${0##*/} | ||
} | ||
|
||
|
||
function hassos_pre_image() { | ||
local BOOT_DATA="$(path_boot_dir)" | ||
|
||
echo "console=tty0 console=ttyAML0,115200n8" > "${BOOT_DATA}/cmdline.txt" | ||
cp "${BINARIES_DIR}/meson-gxl-s905w-jethome-jethub-j80.dtb" "${BOOT_DATA}/meson-gxl-s905w-jethome-jethub-j80.dtb" | ||
} | ||
|
||
function hassos_post_image() { | ||
convert_disk_image_xz | ||
} | ||
|
||
function create_disk_image() { | ||
_prepare_disk_image | ||
_create_disk_aml | ||
} | ||
|
||
function create_platform_conf () { | ||
echo 'Platform:0x0811' > ${BINARIES_DIR}/platform.conf | ||
echo 'DDRLoad:0xd9000000' >> ${BINARIES_DIR}/platform.conf | ||
echo 'DDRRun:0xd9000000' >> ${BINARIES_DIR}/platform.conf | ||
echo 'UbootLoad:0x200c000' >> ${BINARIES_DIR}/platform.conf | ||
echo 'UbootRun:0xd9000000' >> ${BINARIES_DIR}/platform.conf | ||
echo 'Control0=0xd9000000:0x000000b1' >> ${BINARIES_DIR}/platform.conf | ||
echo 'Control1=0xd9000000:0x00005183' >> ${BINARIES_DIR}/platform.conf | ||
echo 'Encrypt_reg:0xc8100228' >> ${BINARIES_DIR}/platform.conf | ||
echo 'bl2ParaAddr=0xd900c000' >> ${BINARIES_DIR}/platform.conf | ||
} | ||
|
||
function _create_disk_aml() { | ||
local boot_img="$(path_boot_img)" | ||
local rootfs_img="$(path_rootfs_img)" | ||
local overlay_img="$(path_overlay_img)" | ||
local data_img="$(path_data_img)" | ||
local kernel_img="$(path_kernel_img)" | ||
local hdd_img="$(hassos_image_name img)" | ||
local hdd_count=${DISK_SIZE:-2} | ||
local disk_layout="${BINARIES_DIR}/disk.layout" | ||
local boot_start=$(size2sectors "8M") | ||
local bootloader_img="u-boot.bin" # bootloader | ||
local ubootbin_img="u-boot.bin.usb.tpl" # UBOOT | ||
local ddrbin_img="u-boot.bin.usb.bl2" # DDR | ||
|
||
echo '[LIST_NORMAL]' > ${BINARIES_DIR}/image.cfg | ||
echo 'file="'${ddrbin_img}'" main_type="USB" sub_type="DDR"' >> ${BINARIES_DIR}/image.cfg | ||
echo 'file="'${ubootbin_img}'" main_type="USB" sub_type="UBOOT"' >> ${BINARIES_DIR}/image.cfg | ||
echo 'file="_aml_dtb.PARTITION" main_type="dtb" sub_type="meson1"' >> ${BINARIES_DIR}/image.cfg | ||
echo 'file="platform.conf" main_type="conf" sub_type="platform"' >> ${BINARIES_DIR}/image.cfg | ||
echo '' >> ${BINARIES_DIR}/image.cfg | ||
echo '[LIST_VERIFY]' >> ${BINARIES_DIR}/image.cfg | ||
echo 'file="_aml_dtb.PARTITION" main_type="PARTITION" sub_type="_aml_dtb"' >> ${BINARIES_DIR}/image.cfg | ||
echo 'file="'${bootloader_img}'" main_type="PARTITION" sub_type="bootloader"' >> ${BINARIES_DIR}/image.cfg | ||
echo 'file="'${boot_img##*/}'" main_type="PARTITION" sub_type="boot"' >> ${BINARIES_DIR}/image.cfg | ||
echo 'file="'${kernel_img##*/}'" main_type="PARTITION" sub_type="kernela"' >> ${BINARIES_DIR}/image.cfg | ||
echo 'file="'${rootfs_img##*/}'" main_type="PARTITION" sub_type="systema"' >> ${BINARIES_DIR}/image.cfg | ||
echo 'file="'${overlay_img##*/}'" main_type="PARTITION" sub_type="overlay"' >> ${BINARIES_DIR}/image.cfg | ||
echo 'file="'${data_img##*/}'" main_type="PARTITION" sub_type="data"' >> ${BINARIES_DIR}/image.cfg | ||
|
||
create_platform_conf | ||
|
||
cc -o $BINARIES_DIR/dtbTool $BOARD_DIR/../src/dtbTool.c | ||
$BINARIES_DIR/dtbTool -o $BINARIES_DIR/_aml_dtb.PARTITION ${BINARIES_DIR}/ | ||
$BOARD_DIR/../bin/aml_image_v2_packer -r ${BINARIES_DIR}/image.cfg ${BINARIES_DIR}/ $hdd_img | ||
echo "Image created" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
BOARD_ID=jethub-h1 | ||
BOARD_NAME="JetHome JetHub H1" | ||
CHASSIS=embedded | ||
BOOTLOADER=uboot | ||
KERNEL_FILE=Image | ||
BOOT_SYS=mbr | ||
BOOT_SPL=false | ||
BOOT_ENV_SIZE=0x10000 | ||
SUPERVISOR_MACHINE=odroid-c2 | ||
#SUPERVISOR_MACHINE=jethub-h1 TODO: add supervisor | ||
SUPERVISOR_ARCH=aarch64 |
2 changes: 2 additions & 0 deletions
2
buildroot-external/board/jethome/jethub-h1/rootfs-overlay/usr/lib/firmware/rtlbt/ReadMe.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Files rtl8822cs_config, rtl8822cs_fw are not from Linux_BT_UART_v3.10_20200301_8822CS_BTCOEX_20200103-1717. | ||
They are from stb project. |
Binary file added
BIN
+73 Bytes
...t-external/board/jethome/jethub-h1/rootfs-overlay/usr/lib/firmware/rtlbt/rtl8822cs_config
Binary file not shown.
Binary file added
BIN
+43.6 KB
...droot-external/board/jethome/jethub-h1/rootfs-overlay/usr/lib/firmware/rtlbt/rtl8822cs_fw
Binary file not shown.
59 changes: 59 additions & 0 deletions
59
buildroot-external/board/jethome/jethub-h1/rootfs-overlay/usr/lib/jethome/init_j80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
|
||
GPIO_DIRECTION_OUTPUT=0 | ||
GPIO_DIRECTION_INPUT=1 | ||
|
||
GPIO_ACTIVE_LOW=0 | ||
GPIO_ACTIVE_HIGH=1 | ||
|
||
configure_gpio() { | ||
echo "${0}: Configure: gpio=${1}, direction=${2}, active_level=${3}" | ||
|
||
if [ ! -d /sys/class/gpio/gpio${1} ]; then | ||
echo ${1} > /sys/class/gpio/export | ||
if [ ! -d /sys/class/gpio/gpio${1} ]; then | ||
echo "${0}: *** Error: Failed to configure GPIO ${1}" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
if [ "${2}" == "${GPIO_DIRECTION_OUTPUT}" ]; then | ||
echo "out" > /sys/class/gpio/gpio${1}/direction | ||
else | ||
echo "in" > /sys/class/gpio/gpio${1}/direction | ||
fi | ||
|
||
if [ "${3}" == "${GPIO_ACTIVE_LOW}" ]; then | ||
echo 1 > /sys/class/gpio/gpio${1}/active_low | ||
fi | ||
} | ||
|
||
echo "${0}: Configure GPIOs ..." | ||
|
||
# Zigbee module: RESET, BOOT | ||
configure_gpio "507" "${GPIO_DIRECTION_OUTPUT}" "${GPIO_ACTIVE_HIGH}" | ||
configure_gpio "510" "${GPIO_DIRECTION_OUTPUT}" "${GPIO_ACTIVE_HIGH}" | ||
# Z-Wave module: RESET, SUSPEND | ||
configure_gpio "490" "${GPIO_DIRECTION_OUTPUT}" "${GPIO_ACTIVE_HIGH}" | ||
configure_gpio "491" "${GPIO_DIRECTION_OUTPUT}" "${GPIO_ACTIVE_HIGH}" | ||
# LED | ||
configure_gpio "474" "${GPIO_DIRECTION_OUTPUT}" "${GPIO_ACTIVE_HIGH}" | ||
|
||
|
||
echo "${0}: Turn off LED ..." | ||
echo 0 > /sys/class/gpio/gpio474/value | ||
|
||
echo "${0}: Reset Zigbee module ..." | ||
echo 1 > /sys/class/gpio/gpio510/value | ||
echo 1 > /sys/class/gpio/gpio507/value | ||
sleep 1 | ||
echo 0 > /sys/class/gpio/gpio507/value | ||
|
||
echo "${0}: Reset Z-Wave module ..." | ||
# Optional SUSPEND pin | ||
#echo 1 > /sys/class/gpio/gpio491/value | ||
echo 1 > /sys/class/gpio/gpio490/value | ||
sleep 1 | ||
echo 0 > /sys/class/gpio/gpio490/value | ||
|
||
exit 0 |
15 changes: 15 additions & 0 deletions
15
...oot-external/board/jethome/jethub-h1/rootfs-overlay/usr/lib/jethome/rtk_hciattach_starter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
if grep -Eq "^GXL.+S905W" /sys/devices/soc0/soc_id; then | ||
if [ ! -f /sys/class/gpio/gpio497/value ]; then | ||
echo 497 > /sys/class/gpio/export | ||
echo out > /sys/class/gpio/gpio497/direction | ||
fi | ||
echo 0 > /sys/class/gpio/gpio497/value && sleep 0.1 | ||
echo 1 > /sys/class/gpio/gpio497/value && sleep 0.1 | ||
rtk_hciattach /dev/ttyAML1 -s 115200 rtk_h5 115200 | ||
elif grep -Eq "^AXG" /sys/devices/soc0/soc_id; then | ||
echo "Amlogic AXG detected. Skip rtk_hciattach execution." | ||
else | ||
echo "SoC detection failed. Unable to execute rtk_hciattach." | ||
fi |
15 changes: 15 additions & 0 deletions
15
...ard/jethome/jethub-h1/rootfs-overlay/usr/lib/systemd/system/jethome_rtk_hciattach.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
[Unit] | ||
Description=rtk_hciattach | ||
DefaultDependencies=no | ||
After=local-fs.target | ||
Conflicts=shutdown.target | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/bin/bash /usr/lib/jethome/rtk_hciattach_starter | ||
RemainAfterExit=yes | ||
TimeoutStartSec=30sec | ||
|
||
[Install] | ||
WantedBy=sysinit.target |
Oops, something went wrong.