summaryrefslogtreecommitdiff
path: root/Makefile
AgeCommit message (Collapse)AuthorFilesLines
2019-06-19platform: Move platform common to lib/utils.Atish Patra1-10/+19
Currently, platform/common contains platform/non-platform specific common minimal drivers and libraries. This is helpful is all platforms are built within opensbi framework. Move them to lib/utils so that any external platform code also can reuse the minimalistic drivers or other common libraries. This patch doesn't introduce any functional changes. Signed-off-by: Atish Patra <atish.patra@wdc.com> Acked-by: Anup Patel <anup.patel@wdc.com>
2019-06-19lib: Move sbi core library to lib/sbiAtish Patra1-7/+7
Signed-off-by: Atish Patra <atish.patra@wdc.com> Acked-by: Anup Patel <anup.patel@wdc.com>
2019-04-30Makefile: explicitly disable PIEKarsten Merker1-0/+1
The various available RISC-V toolchains differ in their default configuration regarding PIE, e.g. the buildroot RISC-V toolchain has PIE disabled by default while the Debian toolchain has it enabled by default. OpenSBI currently doesn't support being built with PIE enabled, therefore disable it explicitly by passing "-fno-pie -no-pie" in CFLAGS. Signed-off-by: Karsten Merker <merker@debian.org> Acked-by: Anup Patel <anup.patel@wdc.com>
2019-04-09TOP: Allow building platform out-of-treeAnup Patel1-25/+49
This patch extends our current build-system for building platform sources which are not part of OpenSBI sources. For example: Let's say we have out-of-tree ABC platform sources. We place these sources under <XYZ>/ABC directory along with its config.mk and objects.mk. To build out-of-tree ABC platform from OpenSBI directory: $ make PLATFORM_DIR=<XYZ>/ABC OR $ make PLATFORM_DIR=<XYZ> PLATFORM=ABC To build out-of-tree ABC platform from <XYZ>/ABC directory: $ make PLATFORM_DIR=<XYZ>/ABC -C <path_to_opensbi> OR $ make PLATFORM_DIR=<XYZ> PLATFORM=ABC -C <path_to_opensbi> Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
2019-02-28Fix missing quotes in MakefileAndreas Schwab1-1/+1
2019-02-28Fix makefile dependency generationAndreas Schwab1-2/+2
2019-02-26Makefile: Set the platform variables before parsing the platformsAlistair Francis1-8/+10
Ensure the platform variable PLATFORM_RISCV_XLEN is set before we parse the platform files. This fixes the 32-bit openSBI FW_JUMP_ADDR. Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2019-02-22Makefile: Rename compile_ld() to compile_elf()Anup Patel1-7/+7
The compile_ld() is actually used to create ELF files so the name is misleading hence this patch renames it to compile_elf(). We also rename LDFLAGS to ELFFLAGS because these will be used for ELF creation only. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-02-19Makefile: Use sed instead of awk to parse OpenSBI versionAnup Patel1-2/+2
This patch replaces use of awk with sed in top-level makefile to parse OpenSBI version from include/sbi/sbi_version.h. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-02-19Makefile: Fix error evaluating OPENSBI_CC_XLENAnup Patel1-25/+25
We get following error evaluating OPENSBI_CC_XLEN on Ubuntu-18.04: /bin/sh: 1: Bad substitution This patch fixes above error by using "awk" in string assigned to OPENSBI_CC_XLEN and it also moves "Setup compilation commands" before OPENSBI_CC_XLEN. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-02-17Makefile: Fix the assignment of OPENSBI_CC_XLENAlistair Francis1-3/+3
Previously OPENSBI_CC_XLEN was not being correctly assigned either 32 or 64. It also was not assigned before config.mk was parsed. Ensure that it will always be assigned. Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2019-02-15Makefile: Add 'make run' command for platform specific runOlof Johansson1-0/+15
Makes for easy and quick build-run one-stop command. For now only added for qemu targets. It can be added for any platform having simulator/emulator (such as QEMU). Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-02-15Makefile: Make sure ld is always aware of the target abi/emulationNick Kossifidis1-1/+3
On Makefile merge_objs calls ld without providing any hints on the target so on a multilib toolchain for example it will always pick the default one (elf64-littleriscv) which will then result a failure when compiling on RV32 since the objects will be 32bits and the target will be 64bits. The same happens on compile_ld that calls gcc without CFLAGS so it doesn't get mabi/march. With this patch OpenSBI compiles on RV32 (PLATFORM_RISCV_XLEN=32), I tested fw_jump.elf on qemu (but it doesn't boot the kernel yet -bbl also doesn't boot the kernel so it may be something else). Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
2019-02-12Makefile: Set ABI, ISA and Code Model in top-level makeAnup Patel1-0/+26
This patch introduces following optional PLATFORM options: PLATFORM_RISCV_XLEN -> RISC-V register width PLATFORM_RISCV_ABI -> RISC-V GCC ABI PLATFORM_RISCV_ISA -> RISC-V GCC ISA string PLATFORM_RISCV_CODE_MODEL -> RISC-V GCC Code Model If the above options are not provided by platform config.mk or by command-line parameters then: 1. PLATFORM_RISCV_XLEN will be determined using toolchain capability 2. PLATFORM_RISCV_ABI, PLATFORM_RISCV_ISA, and PLATFORM_RISCV_CODE_MODEL is set to value best suited for generic libsbi.a As a result of these optional PLATFORM options, the platform-cflags-y and platform-asflags-y is further simplified for platform config.mk. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-02-08Makefile: Ensure lgcc is includedAlistair Francis1-1/+1
This fixes errors like this: undefined reference to `__umoddi3' when buildilng for 32-bit systems Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2019-02-08platform/qemu/virt: Dynamically calculate xlenAlistair Francis1-0/+3
The QEMU virt machine can be either 32 or 66 bit. Don't hard code the CPU bit length and instead let the compiler determine it. Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2019-02-06Makefile: don't disable built-in variablesAndreas Schwab1-2/+2
Signed-off-by: Andreas Schwab <schwab@suse.de>
2019-02-05Makefile: Don't rely on "echo -n"Olof Johansson1-2/+2
Turns out it doesn't behave as expected on MacOS, it doesn't honor -n and echoes that to the file instead. Add a slash and just let the newline be there instead. Signed-off-by: Olof Johansson <olof@lixom.net>
2019-01-25include: Add separate header for OpenSBI versionAnup Patel1-8/+6
Currently, the OpenSBI version is in top-level Makefile so firmware linking to OpenSBI static library have no-way to know OpenSBI version. This patch moves OpenSBI version from top-level Makefile to sbi/sbi_version.h header which provides OPENSBI_VERSION_MAJOR and OPENSBI_VERSION_MINOR defines. NOTE: the SBI spec (or SBI ecall interface) version is different. The SBI spec version is provided by functions sbi_ecall_version_major() and sbi_ecall_version_minor(). Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-01-24all: Update copyright header in all filesAnup patel1-3/+3
This patch updates copyright header in all files as follows: 1. Makes "SPDX-License-Identifier: BSD-2-Clause" as first line 2. Change copyright year to 2019 for Western Digital Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-01-22Makefile: Don't install generic headers under <install_dir>/platformAnup Patel1-1/+0
We don't need to install generic headers separately for every platforn under <install_dir>/platform. It is unnecessary duplication of files hence updating install_libplatsbi in top-level makefile. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-01-22docs: Add OpenSBI version to doxygen.cfgAnup Patel1-1/+1
The PDF document generated by doxygen should have OpenSBI version hence this patch adds OpenSBI version to doxygen.cfg. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-01-21Makefile: Improve readabilityDamien Le Moal1-24/+13
Repeating "ifdef CROSS_COMPILE" multiple times does not help with readability. Simplify by grouping compilation command setup under a single ifdef statement. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2019-01-21Makefile: Add support for device tree compilationDamien Le Moal1-0/+11
Add rules to compile dts files into dtb files using the device tree compiler (dtc). A platform can specify the DTS file to compile using the platform-dtb-y variable. The flattened device tree binary file to be used for building the final polatform firmware can be specified using the new FW_PAYLOAD_FDT firmware configuration option to point to the automatically compiled FDT file. Using the existing FW_PAYLOAD_FDT_PATH configuration option is still possible and will take precedence over the FW_PAYLOAD_FDT definition. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2019-01-18platform: Include libfdt & libc.Atish Patra1-0/+1
Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-01-16Makefile: Add make targets to build and install documentationAnup Patel1-0/+17
This patch extends top-level makefile to build and install documentation. The 'docs' make target is for building the documentation PDF whereas 'install_docs' make target is for installing the documentation PDF. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-01-05Makefile: Use '=' instead of '?=' for make variablesAnup Patel1-6/+26
The '?=' will not assign value if the target make variable is overriden via command-line or is set in environment variable. On other hand, '=' will not assign value only if variable is overriden via command-line parameter. It is quite common to have CC, AS, CPP, LD, etc to be set as environment variables pointing to native compiler and binutils. If '-rR' option is not set in MAKEFLAGS then this results in compile error because '?=' will use the native compiler and binutils. If '-rR' option is set in MAKEFLAGS then this again results in compile error because CC, AS, CPP, etc are set to empty strings which causes '?=' to use empty string as compiler and binutils. To handle this, we use '?=' only when CROSS_COMPILE is not defined and we use '=' when CROSS_COMPILE is defined. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-01-04Makefile: Force GCC to preprocess the linker fileAlistair Francis1-1/+1
To avoid this message (and subsequent errors): warning: linker input file unused because linking not done force GCC to treat the linker script preprocessing as a C file. Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2019-01-04Makefile: Convert to a more standard formatAlistair Francis1-38/+41
Convert the Makefile to a more standard format and don't forcefully overwrite a users enviroment. Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2019-01-04Makefile: Use generic flags for the firmwareAlistair Francis1-0/+1
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2019-01-04Makefile: Use generic flags for the platformAlistair Francis1-7/+10
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2019-01-04Makefile: Support verbosity using standard V=1Alistair Francis1-36/+26
Instead of using a confusing and custom option, allow verbose Makefile with the standard V=1. Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2019-01-03Makefile: Fix messagesDamien Le Moal1-7/+7
Instead of printing the generic "<build_directory>" and "<install_directory>" strings, print the actual paths for the build and install directories during "make clean" and "make distclean". Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-27top: Improve 'clean' and 'distclean' makefile targetsAnup Patel1-7/+14
This improves 'clean' and 'distclean' makefile target as follows: 1. Remove only .o, .a, .elf, and .bin files for 'clean' 2. Remove .dep in-addition to what 'clean' does for 'distclean' 3. Remove default build and install directory for 'distclean' Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-27top: Improve inst_file_list() in Makefile for payloads installationAnup Patel1-7/+11
We now have payloads sub-directory under firmware directory which means payload BINs and ELFs should be installed under firmware/payloads. This patch improves inst_file_list() to handle payloads sub-directory under firmware installation directory. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-27firmware: Use dummy payload for FW_PAYLOADAnup Patel1-1/+4
We use recently added separate dummy payload for FW_PAYLOAD when FW_PAYLOAD_PATH is not specified. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-26top: Rename back CROSS_COMPILE_PREFIX to CROSS_COMPILEAnup Patel1-7/+7
The name CROSS_COMPILE is an industry standard used across open-source project to specify cross-compiler prefix. In fact, distro build systems such as buildroot and yocto assume CROSS_COMPILE to be supported by projects added as packages to these build systems. This patch rename back CROSS_COMPILE_PREFIX to CROSS_COMPILE. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-25Makefile: Fix cleanDamien Le Moal1-1/+1
Clean was doing nothing. Fix it to remove all compiled files, leaving only dependency files. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-25Makefile: Rename CROSS_COMPILE to CROSS_COMPILE_PREFIXDamien Le Moal1-7/+7
Make it clear what this environment variable defines and update the README.md file to explain that. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-21top: Rename "plat" to "platform" everywhereAnup Patel1-40/+40
This patch renames "plat" to "platform" everywhere for better readablility. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-21top: Rename "blob" to "firmware" everywhereAnup Patel1-17/+17
This patch renames "blob" to "firmware" everywhere for better and intutive naming. Signed-off-by: Anup Patel <anup@brainfault.org>
2018-12-11Initial commit.Anup Patel1-0/+296
Signed-off-by: Anup Patel <anup.patel@wdc.com>