mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-20 01:20:35 +08:00
Compare commits
3 Commits
sysmngr_co
...
ex400
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b10cf23b33 | ||
|
|
6ade1cf8f5 | ||
|
|
679436f2dd |
@@ -43,6 +43,10 @@ ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCHIP_$(CHIP_ID) -DCONFIG_BCM9$(CHIP_ID) \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/userspace/public/include
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_ramips),y)
|
||||
TARGET_PLATFORM=MEDIATEK
|
||||
TARGET_WIFI_TYPE=MAC80211
|
||||
TARGET_CFLAGS +=-DIOPSYS_MAC80211
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_x86),y)
|
||||
TARGET_PLATFORM=TEST
|
||||
TARGET_WIFI_TYPE=TEST
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
define Package/libethernet
|
||||
$(call Package/easy-soc-libs)
|
||||
TITLE:= Ethernet library (libethernet)
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_airoha:ecnt_api
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_iopsys_ramips:swconfig +TARGET_airoha:ecnt_api
|
||||
endef
|
||||
|
||||
define Package/libethernet/config
|
||||
|
||||
@@ -14,6 +14,7 @@ function genconfig {
|
||||
target="bogus"
|
||||
target_config_path=""
|
||||
brcmbca_feed="target/linux/feeds/brcmbca"
|
||||
ramips_feed="target/linux/feeds/iopsys-ramips"
|
||||
airoha_feed="target/linux/feeds/airoha"
|
||||
x86_feed="target/linux/feeds/iopsys-x86"
|
||||
armvirt_feed="target/linux/feeds/iopsys-armvirt"
|
||||
@@ -110,6 +111,8 @@ function genconfig {
|
||||
|
||||
[ -e $brcmbca_feed/genconfig ] &&
|
||||
brcmbca=$(cd $brcmbca_feed; ./genconfig)
|
||||
[ -e $ramips_feed/genconfig ] &&
|
||||
iopsys_ramips=$(cd $ramips_feed; ./genconfig)
|
||||
[ -e $airoha_feed/genconfig ] &&
|
||||
airoha=$(cd $airoha_feed; ./genconfig)
|
||||
[ -e $x86_feed/genconfig ] &&
|
||||
@@ -122,7 +125,7 @@ function genconfig {
|
||||
ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig)
|
||||
|
||||
if [ "$profile" == "LIST" ]; then
|
||||
for list in brcmbca airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
|
||||
for list in brcmbca iopsys_ramips airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
|
||||
echo "$list based boards:"
|
||||
for b in ${!list}; do
|
||||
echo -e "\t$b"
|
||||
@@ -139,6 +142,14 @@ function genconfig {
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_ramips; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_ramips"
|
||||
target_config_path="$ramips_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $airoha; do
|
||||
if [ $p == $profile ]; then
|
||||
target="airoha"
|
||||
@@ -342,7 +353,7 @@ function genconfig {
|
||||
|
||||
# Special handling for targets which use TARGET_DEVICES
|
||||
case "$target" in
|
||||
airoha | iopsys_mediatek | brcmbca | ipq95xx)
|
||||
iopsys_ramips | airoha | iopsys_mediatek | brcmbca | ipq95xx)
|
||||
# This assumes the device name to be unique within one target,
|
||||
# which is a fair assumption to make.
|
||||
local mk_file="$(grep -Fx --files-with-matches "define Device/${BOARDTYPE}" "$target_config_path/../image/"*.mk)"
|
||||
|
||||
@@ -13,6 +13,7 @@ function genconfig_min {
|
||||
target="bogus"
|
||||
target_config_path=""
|
||||
brcmbca_feed="target/linux/feeds/brcmbca"
|
||||
ramips_feed="target/linux/feeds/iopsys-ramips"
|
||||
airoha_feed="target/linux/feeds/airoha"
|
||||
x86_feed="target/linux/feeds/iopsys-x86"
|
||||
armvirt_feed="target/linux/feeds/iopsys-armvirt"
|
||||
@@ -109,6 +110,8 @@ function genconfig_min {
|
||||
|
||||
[ -e $brcmbca_feed/genconfig ] &&
|
||||
brcmbca=$(cd $brcmbca_feed; ./genconfig)
|
||||
[ -e $ramips_feed/genconfig ] &&
|
||||
iopsys_ramips=$(cd $ramips_feed; ./genconfig)
|
||||
[ -e $airoha_feed/genconfig ] &&
|
||||
airoha=$(cd $airoha_feed; ./genconfig)
|
||||
[ -e $x86_feed/genconfig ] &&
|
||||
@@ -121,7 +124,7 @@ function genconfig_min {
|
||||
ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig)
|
||||
|
||||
if [ "$profile" == "LIST" ]; then
|
||||
for list in brcmbca airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
|
||||
for list in brcmbca iopsys_ramips airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
|
||||
echo "$list based boards:"
|
||||
for b in ${!list}; do
|
||||
echo -e "\t$b"
|
||||
@@ -138,6 +141,14 @@ function genconfig_min {
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_ramips; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_ramips"
|
||||
target_config_path="$ramips_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $airoha; do
|
||||
if [ $p == $profile ]; then
|
||||
target="airoha"
|
||||
@@ -316,7 +327,7 @@ function genconfig_min {
|
||||
|
||||
# Special handling for targets which use TARGET_DEVICES
|
||||
case "$target" in
|
||||
airoha | iopsys_mediatek | brcmbca | ipq95xx)
|
||||
iopsys_ramips | airoha | iopsys_mediatek | brcmbca | ipq95xx)
|
||||
# This assumes the device name to be unique within one target,
|
||||
# which is a fair assumption to make.
|
||||
local mk_file="$(grep -Fx --files-with-matches "define Device/${BOARDTYPE}" "$target_config_path/../image/"*.mk)"
|
||||
|
||||
137
uboot/Makefile
Normal file
137
uboot/Makefile
Normal file
@@ -0,0 +1,137 @@
|
||||
#
|
||||
# Copyright (C) 2013-2014 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=u-boot
|
||||
PKG_VERSION:=2016.08
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
|
||||
ifdef CONFIG_TARGET_airoha
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/ensemble/u-boot.git
|
||||
PKG_SOURCE_VERSION:=1b320f0656bfc8504fa4f771dd77d8e403ed00e0
|
||||
else
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/fork/uboot.git
|
||||
PKG_SOURCE_VERSION:=4cd73fe5db0ebfc1242ca9c85c14d7f0718eaf73
|
||||
endif
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-or-later
|
||||
|
||||
# u-boot for mips_intel do not build in parallel.
|
||||
#PKG_BUILD_PARALLEL:=1
|
||||
|
||||
# we currently do not use OpenWRT u_boot make files
|
||||
#include $(INCLUDE_DIR)/u-boot.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
# prevent openwrt source date to be used as build date by u-boot
|
||||
unexport SOURCE_DATE_EPOCH
|
||||
|
||||
|
||||
define uboot/Default
|
||||
TITLE:=
|
||||
CONFIG:=
|
||||
IMAGE:=
|
||||
endef
|
||||
|
||||
UBOOT_IMG:=uboot.img
|
||||
|
||||
define uboot/ex400
|
||||
TITLE:=U-Boot for the ex400
|
||||
DEPENDS:=@TARGET_iopsys_ramips
|
||||
PKG_RELEASE:=7
|
||||
endef
|
||||
|
||||
define uboot/en7562
|
||||
TITLE:=U-Boot for the en7562
|
||||
CONFIG:=econet-en7562-ram
|
||||
DEPENDS:=@TARGET_airoha
|
||||
UBOOT_IMG:=u-boot-nand.bin
|
||||
endef
|
||||
|
||||
UBOOTS := \
|
||||
ex400 \
|
||||
en7562
|
||||
|
||||
define Package/uboot/template
|
||||
define Package/uboot-$(1)
|
||||
SECTION:=boot
|
||||
CATEGORY:=Boot Loaders
|
||||
TITLE:=$(2)
|
||||
URL:=http://www.denx.de/wiki/U-Boot
|
||||
VARIANT:=$(1)
|
||||
endef
|
||||
endef
|
||||
|
||||
define BuildUBootPackage
|
||||
$(eval $(uboot/Default))
|
||||
$(eval $(uboot/$(1)))
|
||||
$(call Package/uboot/template,$(1),$(TITLE))
|
||||
endef
|
||||
|
||||
ifdef BUILD_VARIANT
|
||||
$(eval $(call uboot/$(BUILD_VARIANT)))
|
||||
UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
|
||||
UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
|
||||
UBOOT_IOPSYS_VERSION:=$(PKG_RELEASE)
|
||||
endif
|
||||
|
||||
define Build/Configure
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
$(UBOOT_CONFIG)_config
|
||||
|
||||
$(SED) "s,CONFIG_INTENO_MAJOR=\"0\",CONFIG_INTENO_MAJOR=\"$(UBOOT_IOPSYS_VERSION)\"," $(PKG_BUILD_DIR)/.config
|
||||
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
oldconfig
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
CROSS_COMPILE=$(TARGET_CROSS)
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
CROSS_COMPILE=$(TARGET_CROSS) env
|
||||
endef
|
||||
|
||||
# don't install /etc/init.d/uboot for intel-mips as it's not needed
|
||||
define Package/uboot/install/default
|
||||
$(INSTALL_DIR) $$(1)/lib/upgrade
|
||||
$(CP) ./files/uboot-upgrade $$(1)/lib/upgrade/
|
||||
|
||||
$(INSTALL_DIR) $(BIN_DIR)/$(TARGET)
|
||||
$(CP) \
|
||||
$(PKG_BUILD_DIR)/$(UBOOT_IMG) \
|
||||
$(BIN_DIR)/$(TARGET)/uboot.img
|
||||
$(CP) \
|
||||
$(PKG_BUILD_DIR)/$(UBOOT_IMG) \
|
||||
$(wildcard $(BUILD_DIR)/linux-$(BOARD)*)/uboot.img
|
||||
|
||||
$(INSTALL_DIR) $$(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/env/fw_printenv $$(1)/usr/sbin/
|
||||
ln -s /usr/sbin/fw_printenv $$(1)/usr/sbin/fw_setenv
|
||||
endef
|
||||
|
||||
define Package/uboot/install/template
|
||||
define Package/uboot-$(1)/install
|
||||
$(call Package/uboot/install/default,$(2))
|
||||
endef
|
||||
endef
|
||||
|
||||
$(foreach u,$(UBOOTS), \
|
||||
$(eval $(call Package/uboot/install/template,$(u),$(u))) \
|
||||
)
|
||||
|
||||
$(foreach u,$(UBOOTS), \
|
||||
$(eval $(call BuildUBootPackage,$(u))) \
|
||||
$(eval $(call BuildPackage,uboot-$(u))) \
|
||||
)
|
||||
8
uboot/files/uboot
Executable file
8
uboot/files/uboot
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=50
|
||||
|
||||
start() {
|
||||
. /lib/upgrade/uboot-upgrade
|
||||
uboot_upgrade /boot/uboot.img
|
||||
}
|
||||
87
uboot/files/uboot-upgrade
Executable file
87
uboot/files/uboot-upgrade
Executable file
@@ -0,0 +1,87 @@
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
sanity_check_env(){
|
||||
|
||||
# make sure iboot is used to start board, but only if verify_boot != 1
|
||||
# that allows a person to change the bootcmd and not have it overwritten automatically
|
||||
# but still force it to iboot for old boards.
|
||||
vb=$(fw_printenv -n verify_boot 2>/dev/null)
|
||||
|
||||
if [ "1" != "$verify_boot" ]
|
||||
then
|
||||
if ! fw_printenv -n bootcmd 2>/dev/null| grep iboot >/dev/null
|
||||
then
|
||||
echo "update uboot boot command"
|
||||
fw_setenv bootcmd "rescue;iboot"
|
||||
fw_setenv verify_boot 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# just set 115200 baudrate as it is really hardcoded in the binary blob
|
||||
fw_setenv baudrate 115200
|
||||
}
|
||||
|
||||
do_uboot_upgrade(){
|
||||
local u_ver
|
||||
echo "doing upgrade of u-boot old version $cur_Major.$cur_Minor new version $Major.$Minor"
|
||||
mtd erase /dev/mtd0
|
||||
mtd write $1 /dev/mtd0
|
||||
u_ver=$(strings /dev/mtd0 | grep 938f0820-2ffb-11e7-bbc9-2f21351ee6fb)
|
||||
[ -n "$u_ver" ] && fw_setenv uboot_inteno_version "$u_ver"
|
||||
sanity_check_env
|
||||
}
|
||||
|
||||
|
||||
# Return:
|
||||
# 0: update is successfull
|
||||
# 1: update is not needed
|
||||
# 2: error occured
|
||||
uboot_upgrade() {
|
||||
[ ! -f $1 ] && return 2
|
||||
|
||||
iver=$(fw_printenv -n uboot_inteno_version 2>/dev/null)
|
||||
|
||||
# Fixup improper json string for major and minor key.
|
||||
# this adds the missing "
|
||||
iver=$(echo $iver | sed -e 's/{Major:/{"Major":/' | sed -e 's/,Minor:/,"Minor":/')
|
||||
|
||||
if [ -z "$iver" ]
|
||||
then
|
||||
# if this variable is not set by u-boot the u-boot version is too old.
|
||||
do_uboot_upgrade $1
|
||||
return 0
|
||||
fi
|
||||
|
||||
# read in current version into Major Minor variables
|
||||
json_init
|
||||
json_load $(echo $iver |sed -e 's/938f0820-2ffb-11e7-bbc9-2f21351ee6fb: //')
|
||||
json_get_vars Major Minor
|
||||
|
||||
# echo "Major $Major"
|
||||
# echo "Minor $Minor"
|
||||
|
||||
cur_Major=$Major
|
||||
cur_Minor=$Minor
|
||||
|
||||
# read in new uboot version into Major Minor variables
|
||||
json_load $(strings $1 | grep 938f0820-2ffb-11e7-bbc9-2f21351ee6fb |sed -e 's/938f0820-2ffb-11e7-bbc9-2f21351ee6fb: //')
|
||||
json_get_vars Major Minor
|
||||
|
||||
# echo "Major $Major"
|
||||
# echo "Minor $Minor"
|
||||
|
||||
if [ $Major -gt $cur_Major ]
|
||||
then
|
||||
do_uboot_upgrade $1
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ $Major -eq $cur_Major -a $Minor -gt $cur_Minor ]
|
||||
then
|
||||
do_uboot_upgrade $1
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
Reference in New Issue
Block a user