diff mbox series

[OpenWrt-Devel,v3,4/7] uboot-tegra: add U-Boot for tegra boards

Message ID 20190328162015.2552-5-tomek_n@o2.pl
State Superseded
Headers show
Series tegra: add new target with support for CompuLab TrimSlice | expand

Commit Message

Tomasz Maciej Nowak March 28, 2019, 4:20 p.m. UTC
Add U-Boot for NVIDIA Tegra based boards, with the first being CompuLab
TrimSlice. This is part of initial support for this board.

Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
---
 package/boot/uboot-tegra/Makefile             | 59 +++++++++++++++++++
 .../tegra/base-files/lib/upgrade/platform.sh  |  2 +
 target/linux/tegra/image/Makefile             |  4 +-
 3 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100644 package/boot/uboot-tegra/Makefile

Comments

Hauke Mehrtens March 30, 2019, 11:01 p.m. UTC | #1
On 3/28/19 5:20 PM, Tomasz Maciej Nowak wrote:
> Add U-Boot for NVIDIA Tegra based boards, with the first being CompuLab
> TrimSlice. This is part of initial support for this board.
> 
> Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
> ---

U-Boot uses binman for tegra and binman needs swig to build.
In mainline U-Boot sunxi, tegra and x86 are using binman for building
and depend on swig at build time. On sunxi I patched this dependency
out, but I do not know how we should handle this here?

"apt install swig" solves the problem for me, I do not know if we can
easily build swig in the tools and if this would be sufficient.

Hauke
Tomasz Maciej Nowak March 31, 2019, 12:12 p.m. UTC | #2
W dniu 31.03.2019 o 00:01, Hauke Mehrtens pisze:
> On 3/28/19 5:20 PM, Tomasz Maciej Nowak wrote:
>> Add U-Boot for NVIDIA Tegra based boards, with the first being CompuLab
>> TrimSlice. This is part of initial support for this board.
>>
>> Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
>> ---
> 
> U-Boot uses binman for tegra and binman needs swig to build.
> In mainline U-Boot sunxi, tegra and x86 are using binman for building
> and depend on swig at build time. On sunxi I patched this dependency
> out, but I do not know how we should handle this here?

Thanks for pointing this out. Looks like tegra has already definition in place for building without binman[1], so deleting 'select BINMAN' from arch/arm/mach-tegra/Kconfig lets the package build without swig.
After testing on the hardware, I'll send next iteration of the patches.

> 
> "apt install swig" solves the problem for me, I do not know if we can
> easily build swig in the tools and if this would be sufficient.

Following documentation[2] it needs libpcre, but I don't have any insight if we can rely on host library or should provide one in tools. Anyway U-Boot is building fine *for now* without it.

BTW Is there somewhere a list of packages installed on buildbots and is the list consistent across all of them? 

1. http://git.denx.de/?p=u-boot.git;a=blob;f=Makefile;h=c1af9307b38e2b941d651bc316dcdf82e1bff8e6#l1363
2. http://swig.org/Doc4.0/Preface.html#Preface_unix_installation

> 
> Hauke
> 

Regards
Jo-Philipp Wich March 31, 2019, 12:30 p.m. UTC | #3
Hi Tomasz,

> BTW Is there somewhere a list of packages installed on buildbots and is the list consistent across all of them? 

we're slowly converging towards this:

apt-get install -y \
        pwgen \
        locales \
        buildbot-slave \
        build-essential \
        git-core \
	subversion \
        libncurses5-dev \
        gawk \
        unzip \
        wget \
	curl \
        ccache \
        rsync

on top of a Debian 9 base image. The effective resulting package list is
attached to this mail.

The packages installed are not yet consistent among all slaves but the
list attached to this mail should be the common subset.

~ Jo
root@1be523fcdeb0:/# dpkg --get-selections
adduser						install
apt						install
base-files					install
base-passwd					install
bash						install
binutils					install
bsdutils					install
build-essential					install
buildbot-slave					install
bzip2						install
ca-certificates					install
ccache						install
coreutils					install
cpp						install
cpp-6						install
curl						install
dash						install
debconf						install
debian-archive-keyring				install
debianutils					install
diffutils					install
dirmngr						install
dpkg						install
dpkg-dev					install
e2fslibs:amd64					install
e2fsprogs					install
fakeroot					install
file						install
findutils					install
g++						install
g++-6						install
gawk						install
gcc						install
gcc-6						install
gcc-6-base:amd64				install
git						install
git-core					install
git-man						install
gnupg						install
gnupg-agent					install
gnupg-l10n					install
gosu						install
gpgv						install
grep						install
gzip						install
hostname					install
init-system-helpers				install
iproute2					install
iputils-ping					install
krb5-locales					install
less						install
libacl1:amd64					install
libalgorithm-diff-perl				install
libalgorithm-diff-xs-perl			install
libalgorithm-merge-perl				install
libapr1:amd64					install
libaprutil1:amd64				install
libapt-pkg5.0:amd64				install
libasan3:amd64					install
libassuan0:amd64				install
libatomic1:amd64				install
libattr1:amd64					install
libaudit-common					install
libaudit1:amd64					install
libblkid1:amd64					install
libbsd0:amd64					install
libbz2-1.0:amd64				install
libc-bin					install
libc-dev-bin					install
libc-l10n					install
libc6:amd64					install
libc6-dev:amd64					install
libcap-ng0:amd64				install
libcap2:amd64					install
libcc1-0:amd64					install
libcilkrts5:amd64				install
libcomerr2:amd64				install
libcurl3:amd64					install
libcurl3-gnutls:amd64				install
libdb5.3:amd64					install
libdebconfclient0:amd64				install
libdpkg-perl					install
libedit2:amd64					install
libelf1:amd64					install
liberror-perl					install
libexpat1:amd64					install
libfakeroot:amd64				install
libfdisk1:amd64					install
libffi6:amd64					install
libfile-fcntllock-perl				install
libgcc-6-dev:amd64				install
libgcc1:amd64					install
libgcrypt20:amd64				install
libgdbm3:amd64					install
libgmp10:amd64					install
libgnutls30:amd64				install
libgomp1:amd64					install
libgpg-error0:amd64				install
libgpm2:amd64					install
libgssapi-krb5-2:amd64				install
libhogweed4:amd64				install
libidn11:amd64					install
libidn2-0:amd64					install
libisl15:amd64					install
libitm1:amd64					install
libk5crypto3:amd64				install
libkeyutils1:amd64				install
libkrb5-3:amd64					install
libkrb5support0:amd64				install
libksba8:amd64					install
libldap-2.4-2:amd64				install
libldap-common					install
liblocale-gettext-perl				install
liblsan0:amd64					install
liblz4-1:amd64					install
liblzma5:amd64					install
libmagic-mgc					install
libmagic1:amd64					install
libmnl0:amd64					install
libmount1:amd64					install
libmpc3:amd64					install
libmpfr4:amd64					install
libmpx2:amd64					install
libncurses5:amd64				install
libncurses5-dev:amd64				install
libncursesw5:amd64				install
libnettle6:amd64				install
libnghttp2-14:amd64				install
libnpth0:amd64					install
libp11-kit0:amd64				install
libpam-modules:amd64				install
libpam-modules-bin				install
libpam-runtime					install
libpam0g:amd64					install
libpcre3:amd64					install
libperl5.24:amd64				install
libpopt0:amd64					install
libpsl5:amd64					install
libpython-stdlib:amd64				install
libpython2.7-minimal:amd64			install
libpython2.7-stdlib:amd64			install
libquadmath0:amd64				install
libreadline7:amd64				install
librtmp1:amd64					install
libsasl2-2:amd64				install
libsasl2-modules:amd64				install
libsasl2-modules-db:amd64			install
libselinux1:amd64				install
libsemanage-common				install
libsemanage1:amd64				install
libsepol1:amd64					install
libserf-1-1:amd64				install
libsigsegv2:amd64				install
libsmartcols1:amd64				install
libsqlite3-0:amd64				install
libss2:amd64					install
libssh2-1:amd64					install
libssl1.0.2:amd64				install
libssl1.1:amd64					install
libstdc++-6-dev:amd64				install
libstdc++6:amd64				install
libsvn1:amd64					install
libsystemd0:amd64				install
libtasn1-6:amd64				install
libtinfo-dev:amd64				install
libtinfo5:amd64					install
libtsan0:amd64					install
libubsan0:amd64					install
libudev1:amd64					install
libunistring0:amd64				install
libustr-1.0-1:amd64				install
libuuid1:amd64					install
libx11-6:amd64					install
libx11-data					install
libxau6:amd64					install
libxcb1:amd64					install
libxdmcp6:amd64					install
libxext6:amd64					install
libxmuu1:amd64					install
linux-libc-dev:amd64				install
locales						install
login						install
lsb-base					install
make						install
manpages					install
manpages-dev					install
mawk						install
mime-support					install
mount						install
multiarch-support				install
ncurses-base					install
ncurses-bin					install
netbase						install
openssh-client					install
openssl						install
passwd						install
patch						install
perl						install
perl-base					install
perl-modules-5.24				install
pinentry-curses					install
publicsuffix					install
pwgen						install
python						install
python-attr					install
python-cffi-backend				install
python-click					install
python-colorama					install
python-constantly				install
python-cryptography				install
python-enum34					install
python-idna					install
python-incremental				install
python-ipaddress				install
python-minimal					install
python-openssl					install
python-pam					install
python-pkg-resources				install
python-pyasn1					install
python-pyasn1-modules				install
python-serial					install
python-service-identity				install
python-setuptools				install
python-six					install
python-twisted					install
python-twisted-bin:amd64			install
python-twisted-core				install
python-zope.interface				install
python2.7					install
python2.7-minimal				install
readline-common					install
rename						install
rsync						install
sed						install
sensible-utils					install
signify-openbsd					install
subversion					install
sysvinit-utils					install
tar						install
tzdata						install
unzip						install
util-linux					install
wget						install
xauth						install
xz-utils					install
zlib1g:amd64					install
Tomasz Maciej Nowak March 31, 2019, 12:33 p.m. UTC | #4
W dniu 31.03.2019 o 14:12, Tomasz Maciej Nowak pisze:
> W dniu 31.03.2019 o 00:01, Hauke Mehrtens pisze:
>> On 3/28/19 5:20 PM, Tomasz Maciej Nowak wrote:
>>> Add U-Boot for NVIDIA Tegra based boards, with the first being CompuLab
>>> TrimSlice. This is part of initial support for this board.
>>>
>>> Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
>>> ---
>>
>> U-Boot uses binman for tegra and binman needs swig to build.
>> In mainline U-Boot sunxi, tegra and x86 are using binman for building
>> and depend on swig at build time. On sunxi I patched this dependency
>> out, but I do not know how we should handle this here?
> 
> Thanks for pointing this out. Looks like tegra has already definition in place for building without binman[1], so deleting 'select BINMAN' from arch/arm/mach-tegra/Kconfig lets the package build without swig.
> After testing on the hardware, I'll send next iteration of the patches.
> 
>>
>> "apt install swig" solves the problem for me, I do not know if we can
>> easily build swig in the tools and if this would be sufficient.
> 
> Following documentation[2] it needs libpcre, but I don't have any insight if we can rely on host library or should provide one in tools. Anyway U-Boot is building fine *for now* without it.

Oh wait, if it links against libpcre, that would definitely require us to provide libpcre in tools, but as mentioned swig is not required, for now.

> 
> BTW Is there somewhere a list of packages installed on buildbots and is the list consistent across all of them? 
> 
> 1. http://git.denx.de/?p=u-boot.git;a=blob;f=Makefile;h=c1af9307b38e2b941d651bc316dcdf82e1bff8e6#l1363
> 2. http://swig.org/Doc4.0/Preface.html#Preface_unix_installation
> 
>>
>> Hauke
>>
> 
> Regards
> 

Regards
Tomasz Maciej Nowak March 31, 2019, 12:44 p.m. UTC | #5
Hi Jo,

W dniu 31.03.2019 o 14:30, Jo-Philipp Wich pisze:
> Hi Tomasz,
> 
>> BTW Is there somewhere a list of packages installed on buildbots and is the list consistent across all of them? 
> 
> we're slowly converging towards this:
> 
> apt-get install -y \
>         pwgen \
>         locales \
>         buildbot-slave \
>         build-essential \
>         git-core \
> 	subversion \
>         libncurses5-dev \
>         gawk \
>         unzip \
>         wget \
> 	curl \
>         ccache \
>         rsync
> 
> on top of a Debian 9 base image. The effective resulting package list is
> attached to this mail.

Thank You for this list, it'll help in future contributions to avoid breakages.

> 
> The packages installed are not yet consistent among all slaves but the
> list attached to this mail should be the common subset.

Would be nice to see this list on OpenWrt documentation, after all builbots setups are identical.

> 
> ~ Jo
> 

Regards
diff mbox series

Patch

diff --git a/package/boot/uboot-tegra/Makefile b/package/boot/uboot-tegra/Makefile
new file mode 100644
index 0000000000..60d1b02a60
--- /dev/null
+++ b/package/boot/uboot-tegra/Makefile
@@ -0,0 +1,59 @@ 
+#
+# Copyright (C) 2017-2019 Tomasz Maciej Nowak <tomek_n@o2.pl>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_VERSION := 2019.01
+PKG_RELEASE := 1
+
+PKG_HASH := 50bd7e5a466ab828914d080d5f6a432345b500e8fba1ad3b7b61e95e60d51c22
+
+PKG_MAINTAINER := Tomasz Maciej Nowak <tomek_n@o2.pl>
+
+include $(INCLUDE_DIR)/u-boot.mk
+include $(INCLUDE_DIR)/package.mk
+
+define U-Boot/Default
+  BUILD_TARGET := tegra
+  HIDDEN := y
+endef
+
+define U-Boot/trimslice
+  NAME := CompuLab TrimSlice
+  BUILD_DEVICES := trimslice
+  UBOOT_IMAGE := trimslice-mmc.img trimslice-spi.img
+  SOC := tegra20
+  VENDOR := compulab
+endef
+
+UBOOT_TARGETS := trimslice
+
+define Build/bct-image
+	$(CP) $(PKG_BUILD_DIR)/u-boot-dtb-tegra.bin $(PKG_BUILD_DIR)/u-boot.bin
+	$(foreach bct,$(basename $(UBOOT_IMAGE)), \
+		cd $(PKG_BUILD_DIR); \
+		cbootimage -s $(SOC) -gbct \
+			$(STAGING_DIR_HOST)/share/cbootimage-configs/$(SOC)/$(VENDOR)/$(VARIANT)/$(bct).bct.cfg \
+			$(bct).bct; \
+		cbootimage -s $(SOC) \
+			$(STAGING_DIR_HOST)/share/cbootimage-configs/$(SOC)/$(VENDOR)/$(VARIANT)/$(bct).img.cfg \
+			$(PKG_BUILD_DIR)/$(bct).img; \
+		rm -f $(bct).bct; \
+	)
+endef
+
+define Build/Compile
+	$(call Build/Compile/U-Boot)
+	$(call Build/bct-image)
+endef
+
+define Build/InstallDev
+	$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
+	$(foreach img,$(UBOOT_IMAGE), \
+		$(CP) $(PKG_BUILD_DIR)/$(img) $(STAGING_DIR_IMAGE)/;)
+endef
+
+$(eval $(call BuildPackage/U-Boot))
diff --git a/target/linux/tegra/base-files/lib/upgrade/platform.sh b/target/linux/tegra/base-files/lib/upgrade/platform.sh
index be453bdf9f..97dd381041 100644
--- a/target/linux/tegra/base-files/lib/upgrade/platform.sh
+++ b/target/linux/tegra/base-files/lib/upgrade/platform.sh
@@ -87,6 +87,8 @@  platform_do_upgrade() {
 		return 0
 	fi
 
+	#write uboot image
+	get_image "$@" | dd of="$diskdev" bs=512 skip=1 seek=1 count=4097 conv=fsync,notrunc
 	#iterate over each partition from the image and write it to the boot disk
 	while read part start size; do
 		if export_partdevice partdev $part; then
diff --git a/target/linux/tegra/image/Makefile b/target/linux/tegra/image/Makefile
index 757e5b823f..5e3427ad27 100644
--- a/target/linux/tegra/image/Makefile
+++ b/target/linux/tegra/image/Makefile
@@ -32,9 +32,11 @@  define Build/tegra-sdcard
 		$(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \
 		$(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS) \
 		2048
+
+	$(if $(UBOOT),dd if=$(STAGING_DIR_IMAGE)/$(UBOOT).img of=$@ bs=512 skip=1 seek=1 conv=notrunc)
 endef
 
-DEVICE_VARS += BOOT_SCRIPT
+DEVICE_VARS += BOOT_SCRIPT UBOOT
 define Device/Default
   BOOT_SCRIPT := generic-bootscript
   IMAGES := sdcard.img.gz