summaryrefslogtreecommitdiff
path: root/packaging/u-boot-rpi3.spec
blob: 1eda16e283c6816ecadb67fe7b4cd2721928e1a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
Name: u-boot-rpi3
Version: 2020.10
Release: 0
Summary: Das U-Boot - Tizen bootloader
Group: System/Kernel
License: GPL-2.0+
ExclusiveArch: aarch64
URL: https://source.denx.de/u-boot/u-boot.git
Source0: u-boot-%{version}.tar.bz2
Source1001: u_boot_rpi3.manifest

BuildRequires: gcc >= 6.0
BuildRequires: flex
BuildRequires: bison

%description
u-boot - Tizen bootloader for RPI3 boards based

%package -n u-boot-tools
Summary: Companion tools for Das U-Boot bootloader
Group: System/Kernel
Provides: dtc

%description -n u-boot-tools
This package includes the mkimage program, which allows generation of U-Boot
images in various formats, and the fw_printenv and fw_setenv programs to read
and modify U-Boot's environment.


%prep
%setup -q -n u-boot-%{version}

%build
%{?asan:/usr/bin/gcc-unforce-options}
cp %{SOURCE1001} .

CONFIG=rpi_3_defconfig

make mrproper

# Build dtc
make HOSTCC="gcc $RPM_OPT_FLAGS" -C tools/dtc

# Set configuration
make $CONFIG

# Build tools
make %{?_smp_mflags} HOSTCC="gcc $RPM_OPT_FLAGS" HOSTSTRIP=/bin/true tools

make HOSTCC="gcc $RPM_OPT_FLAGS" envtools

# Build u-boot
export PATH="$PATH:tools:tools/dtc/"
make %{?_smp_mflags} EXTRAVERSION=`echo %{vcs} | sed 's/.*u-boot.*#\(.\{9\}\).*/-g\1-TIZEN.org/'`

# Generate params.bin
cp `find ./env -name "built-in.o"` copy_env_common.o
objcopy -O binary --only-section=.rodata.default_environment `find . -name "copy_env_common.o"`
tr '\0' '\n' < copy_env_common.o > default_envs.txt
mkenvimage -s 16384 -o uboot.env default_envs.txt
rm copy_env_common.o default_envs.txt

# Build boot.scr
mkimage -A arm64 -T script -C none -n "Tizen RPI3 u-boot helper" -d ./tizen/bootscript/tizen-boot-rpi3.scr ./boot.scr.uimg

%install
rm -rf %{buildroot}

# Tools installation
mkdir -p %{buildroot}%{_bindir}
install -p -m 0755 tools/mkimage %{buildroot}%{_bindir}
install -p -m 0755 tools/env/fw_printenv %{buildroot}%{_bindir}
install -p -m 0755 tools/dtc/dtc %{buildroot}%{_bindir}
( cd %{buildroot}%{_bindir}; ln -sf fw_printenv fw_setenv )

# u-boot installation
mkdir -p %{buildroot}/boot
install -m 755 u-boot.bin %{buildroot}/boot/
install -m 755 uboot.env %{buildroot}/boot/
install -m 755 boot.scr.uimg %{buildroot}/boot/

%clean

%files
%manifest u_boot_rpi3.manifest
%defattr(-,root,root,-)
/boot/u-boot.bin
/boot/uboot.env
/boot/boot.scr.uimg

%files -n u-boot-tools
%manifest u_boot_rpi3.manifest
%defattr(-,root,root,-)
%{_bindir}/mkimage
%{_bindir}/fw_printenv
%{_bindir}/fw_setenv
%{_bindir}/dtc