commit
dc681ec8eb
@ -0,0 +1,11 @@
|
||||
# Moxie soft-core architecture
|
||||
|
||||
## no-package
|
||||
## select ARCH_SUPPORTS_32
|
||||
## select ARCH_DEFAULT_32
|
||||
## select ARCH_SUPPORTS_EITHER_ENDIAN
|
||||
## select ARCH_DEFAULT_BE
|
||||
## depends on EXPERIMENTAL
|
||||
|
||||
## help The Moxie soft-core architecture, as defined by:
|
||||
## help http://moxielogic.org/blog/pages/architecture.html
|
@ -0,0 +1,6 @@
|
||||
# Kernel.org's device tree compiler
|
||||
|
||||
## default y if !CONFIGURE_has_dtc && ARCH_MOXIE
|
||||
|
||||
config DTC_VERBOSE
|
||||
bool "Verbose DTC build output"
|
@ -0,0 +1,16 @@
|
||||
# moxiebox options
|
||||
|
||||
# Moxie is distributed in non-bootstrapped form, so we really need
|
||||
# autoconfig and automake.
|
||||
|
||||
## depends on ARCH_MOXIE
|
||||
## depends on BARE_METAL
|
||||
## select LIBC_NEWLIB_SHOW
|
||||
## select LIBC_SUPPORT_THREADS_NONE
|
||||
## select COMP_TOOLS_AUTOCONF if !CONFIGURE_has_autoconf_2_65_or_newer || !CONFIGURE_has_autoreconf_2_64_or_newer
|
||||
## select COMP_TOOLS_AUTOMAKE if !CONFIGURE_has_automake_1_15_or_newer
|
||||
## select CC_CORE_PASSES_NEEDED if CANADIAN
|
||||
## select CC_CORE_PASS_2_NEEDED if ! CANADIAN
|
||||
## select LIBELF_NEEDED
|
||||
##
|
||||
## help Secure execution runtime for Moxie architecture.
|
@ -0,0 +1,8 @@
|
||||
md5 dtc-1.4.7.tar.xz cdf3bfae59374fdcd2bbc5ae4f0e835e
|
||||
sha1 dtc-1.4.7.tar.xz f9724c51caae4fef4da0c8a5d52e9d4d9fc7e8af
|
||||
sha256 dtc-1.4.7.tar.xz 6643e8f00ff86350f465bb54b2185058b5b1b7bac01a0842c81a52b86589cde7
|
||||
sha512 dtc-1.4.7.tar.xz 01e0c88aee154d8ce8a5b84a299c98d12df9698e5eff572409e5e912236028532309fd21ca6a146dffef859c665d476bbbe13c371c621c1dee4abe546e5e6ebf
|
||||
md5 dtc-1.4.7.tar.gz d51a50202d323fdafd0778f53e861cdd
|
||||
sha1 dtc-1.4.7.tar.gz 1de4ad95e08efd6d04dae5f1a71ce18f26565bba
|
||||
sha256 dtc-1.4.7.tar.gz 9f4ee98d402b55b4afd79a4bcfce52f891b160d16c0f46d9aee3c0f7e034516d
|
||||
sha512 dtc-1.4.7.tar.gz d58855746d9d05f19b2cc091438901acf2dc8cb2b24191de6292abffadfd1fa62a32ea82c300cde51ce30ca5facb0553bed42741a41bc4f4c20c1b9221bdd164
|
@ -0,0 +1,4 @@
|
||||
repository='git git://git.kernel.org/pub/scm/utils/dtc/dtc.git'
|
||||
mirrors='$(CT_Mirrors kernel.org dtc)'
|
||||
archive_formats='.tar.xz .tar.gz'
|
||||
signature_format='unpacked/.sign'
|
@ -0,0 +1,29 @@
|
||||
From a59675779247f544695959646a1615a033ca2d8d Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Neyman <stilor@att.net>
|
||||
Date: Tue, 20 Nov 2018 10:54:40 -0800
|
||||
Subject: [PATCH] Remove PKG_CONFIG check
|
||||
|
||||
... it is not used afterwards anyway, and causes errors if pkg-config
|
||||
is not installed (since one cannot just run configure - one has to
|
||||
run autogen.sh first).
|
||||
|
||||
Signed-off-by: Alexey Neyman <stilor@att.net>
|
||||
---
|
||||
configure.ac | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index aeadb36..1925a88 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -22,7 +22,6 @@ AC_PATH_TOOL(STRIP, strip)
|
||||
AC_CHECK_PROG(MOX_AS, moxiebox-as, moxiebox-as)
|
||||
AC_CHECK_PROG(MOX_AR, moxiebox-ar, moxiebox-ar)
|
||||
AC_CHECK_PROG(MOX_GCC, moxiebox-gcc, moxiebox-gcc)
|
||||
-PKG_PROG_PKG_CONFIG
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
|
||||
--
|
||||
2.14.1
|
||||
|
@ -0,0 +1,2 @@
|
||||
repository='git https://github.com/jgarzik/moxiebox.git'
|
||||
repository_cset='9a79ac546faa4196b66e279f8017814ba8d6fd4b'
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
Wrapper around moxiebox'es implementation of SHA256 digest that
|
||||
mimics the API of the OpenSSL implementation.
|
||||
*/
|
||||
|
||||
#ifndef __SHA_H_
|
||||
#define __SHA_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../runtime/sandboxrt_crypto.h"
|
||||
#define SHA256_DIGEST_LENGTH SHA256_BLOCK_SIZE
|
||||
void SHA256_Init(SHA256_CTX *ctx);
|
||||
void SHA256_Update(SHA256_CTX *ctx, const void *data, size_t len);
|
||||
void SHA256_Final(unsigned char *md, SHA256_CTX *ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
Wrapper around moxiebox'es implementation of SHA256 digest that
|
||||
mimics the API of the OpenSSL implementation.
|
||||
*/
|
||||
|
||||
#include "sha.h"
|
||||
#include "../runtime/sha256.c"
|
||||
|
||||
void
|
||||
SHA256_Init(SHA256_CTX *ctx)
|
||||
{
|
||||
sha256_init(ctx);
|
||||
}
|
||||
|
||||
void
|
||||
SHA256_Update(SHA256_CTX *ctx, const void *data, size_t len)
|
||||
{
|
||||
sha256_update(ctx, data, len);
|
||||
}
|
||||
|
||||
void
|
||||
SHA256_Final(unsigned char *md, SHA256_CTX *ctx)
|
||||
{
|
||||
sha256_final(ctx, md);
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
CT_EXPERIMENTAL=y
|
||||
CT_ARCH_MOXIE=y
|
||||
CT_LIBC_NEWLIB=y
|
||||
CT_DEBUG_GDB=y
|
||||
CT_GDB_CROSS_SIM=y
|
||||
# CT_GDB_CROSS_PYTHON is not set
|
||||
CT_COMP_LIBS_LIBELF=y
|
||||
CT_DTC_VERBOSE=y
|
@ -0,0 +1,10 @@
|
||||
reporter_name="Alexey Neyman"
|
||||
reporter_url=""
|
||||
reporter_comment="Bare metal configuration for moxie architecture.
|
||||
|
||||
It appears to generate a broken toolchain. E.g. newlib's CRT expects
|
||||
symbols __bss_start__ and __bss_end__, while linker script generates
|
||||
__bss_start (no underscores at the end) and no __bss_end__whatsoever.
|
||||
|
||||
This is not a bug in crosstool-NG. If you're interested in saving the
|
||||
moxie, please report this upstream."
|
@ -0,0 +1,6 @@
|
||||
CT_EXPERIMENTAL=y
|
||||
CT_ARCH_MOXIE=y
|
||||
CT_DEBUG_GDB=y
|
||||
CT_GDB_CROSS_SIM=y
|
||||
# CT_GDB_CROSS_PYTHON is not set
|
||||
CT_DTC_VERBOSE=y
|
@ -0,0 +1,3 @@
|
||||
reporter_name="Alexey Neyman"
|
||||
reporter_url=""
|
||||
reporter_comment="Moxie toolchain with moxiebox+newlib as the C library."
|
@ -0,0 +1,9 @@
|
||||
CT_EXPERIMENTAL=y
|
||||
CT_ARCH_MOXIE=y
|
||||
CT_CANADIAN=y
|
||||
CT_HOST="x86_64-multilib-linux-uclibc"
|
||||
CT_DEBUG_GDB=y
|
||||
CT_GDB_CROSS_SIM=y
|
||||
# CT_LIBICONV_NEEDED is not set
|
||||
# CT_GETTEXT_NEEDED is not set
|
||||
CT_DTC_VERBOSE=y
|
@ -0,0 +1,3 @@
|
||||
reporter_name="Alexey Neyman"
|
||||
reporter_url=""
|
||||
reporter_comment="Canadian cross using moxiebox lib."
|
@ -0,0 +1,11 @@
|
||||
# Moxie-specific arch callbacks
|
||||
|
||||
# No arch-specific overrides yet
|
||||
CT_DoArchTupleValues()
|
||||
{
|
||||
case "${CT_LIBC}" in
|
||||
moxiebox)
|
||||
CT_TARGET_SYS=moxiebox
|
||||
;;
|
||||
esac
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
# Build script for DTC (device tree compiler)
|
||||
|
||||
do_companion_tools_dtc_get()
|
||||
{
|
||||
CT_Fetch DTC
|
||||
}
|
||||
|
||||
do_companion_tools_dtc_extract()
|
||||
{
|
||||
CT_ExtractPatch DTC
|
||||
}
|
||||
|
||||
do_companion_tools_dtc_for_build()
|
||||
{
|
||||
CT_DoStep INFO "Installing dtc for build"
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-dtc-build"
|
||||
do_dtc_backend \
|
||||
host=${CT_BUILD} \
|
||||
prefix="${CT_BUILD_COMPTOOLS_DIR}" \
|
||||
cflags="${CT_CFLAGS_FOR_BUILD}" \
|
||||
ldflags="${CT_LDFLAGS_FOR_BUILD}"
|
||||
CT_Popd
|
||||
CT_EndStep
|
||||
}
|
||||
|
||||
do_companion_tools_dtc_for_host()
|
||||
{
|
||||
CT_DoStep INFO "Installing dtc for host"
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-dtc-host"
|
||||
do_dtc_backend \
|
||||
host=${CT_HOST} \
|
||||
prefix="${CT_PREFIX_DIR}" \
|
||||
cflags="${CT_CFLAGS_FOR_HOST}" \
|
||||
ldflags="${CT_LDFLAGS_FOR_HOST}"
|
||||
CT_Popd
|
||||
CT_EndStep
|
||||
}
|
||||
|
||||
do_dtc_backend()
|
||||
{
|
||||
local host
|
||||
local prefix
|
||||
local cflags
|
||||
local ldflags
|
||||
local -a extra_opts
|
||||
|
||||
for arg in "$@"; do
|
||||
eval "${arg// /\\ }"
|
||||
done
|
||||
|
||||
extra_opts=( \
|
||||
CC="${host}-gcc" \
|
||||
AR="${host}-ar" \
|
||||
PREFIX="${prefix}" \
|
||||
NO_PYTHON=1 \
|
||||
BIN=dtc \
|
||||
)
|
||||
if [ -n "${CT_DTC_VERBOSE}" ]; then
|
||||
extra_opts+=( V=1 )
|
||||
fi
|
||||
case "${host}" in
|
||||
*-mingw32)
|
||||
# Turn off warnings: mingw32 hosts complain about %zd formats even though
|
||||
# they seem to be supported by mingw32. Only build 'dtc', again, because
|
||||
# other binaries use syscalls not available under mingw32, but we also
|
||||
# do not need them. Hijack WARNINGS to override lstat with stat (Windows
|
||||
# does not have symlinks).
|
||||
extra_opts+=( BIN=dtc WARNINGS=-Dlstat=stat )
|
||||
;;
|
||||
esac
|
||||
|
||||
CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/dtc/." .
|
||||
|
||||
CT_DoLog EXTRA "Building dtc"
|
||||
CT_DoExecLog ALL make all "${extra_opts[@]}"
|
||||
|
||||
# Only install binaries, we don't support shared libraries in installation
|
||||
# directory yet.
|
||||
CT_DoLog EXTRA "Installing dtc"
|
||||
CT_DoExecLog ALL make install-bin "${extra_opts[@]}"
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
# C library build routines. We don't invoke the corresponding functions directly
|
||||
# because some of them build on top of another. E.g. moxiebox runtime requires
|
||||
# newlib as a prerequisite.
|
||||
|
||||
# Define default hooks - download/unpack just the main package; no-op build hooks.
|
||||
# The actual implementation can override just what it needs then.
|
||||
eval "${CT_LIBC//[^A-Za-z0-9]/_}_get() { CT_Fetch ${CT_LIBC_CHOICE_KSYM}; }"
|
||||
eval "${CT_LIBC//[^A-Za-z0-9]/_}_extract() { CT_ExtractPatch ${CT_LIBC_CHOICE_KSYM}; }"
|
||||
for _m in start_files main post_cc; do
|
||||
eval "${CT_LIBC//[^A-Za-z0-9]/_}_${_m}() { :; }"
|
||||
done
|
||||
|
||||
# Source the selected libc.
|
||||
. "${CT_LIB_DIR}/scripts/build/libc/${CT_LIBC}.sh"
|
||||
|
||||
do_libc_get()
|
||||
{
|
||||
eval "${CT_LIBC//[^A-Za-z0-9]/_}_get"
|
||||
}
|
||||
|
||||
do_libc_extract()
|
||||
{
|
||||
eval "${CT_LIBC//[^A-Za-z0-9]/_}_extract"
|
||||
}
|
||||
|
||||
do_libc_start_files()
|
||||
{
|
||||
eval "${CT_LIBC//[^A-Za-z0-9]/_}_start_files"
|
||||
}
|
||||
|
||||
do_libc_main()
|
||||
{
|
||||
eval "${CT_LIBC//[^A-Za-z0-9]/_}_main"
|
||||
}
|
||||
|
||||
do_libc_post_cc()
|
||||
{
|
||||
eval "${CT_LIBC//[^A-Za-z0-9]/_}_post_cc"
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
# Functions to build the moxiebox runtime.
|
||||
|
||||
. "${CT_LIB_DIR}/scripts/build/libc/newlib.sh"
|
||||
|
||||
moxiebox_get()
|
||||
{
|
||||
CT_Fetch NEWLIB
|
||||
CT_Fetch MOXIEBOX
|
||||
}
|
||||
|
||||
moxiebox_extract()
|
||||
{
|
||||
CT_ExtractPatch NEWLIB
|
||||
CT_ExtractPatch MOXIEBOX
|
||||
}
|
||||
|
||||
moxiebox_start_files()
|
||||
{
|
||||
newlib_start_files
|
||||
}
|
||||
|
||||
moxiebox_main()
|
||||
{
|
||||
newlib_main
|
||||
|
||||
# newlib installs the linker script, moxiebox.ld, to the
|
||||
# PREFIX/moxie-unknown-moxiebox/lib, but ld searches PREFIX/lib when
|
||||
# configured for that target. ld does find scripts in PREFIX/TARGET/lib
|
||||
# for other targets, so this seems to be moxie architecture's quirk.
|
||||
# Move it to PREFIX/lib.
|
||||
# TBD CT_DoExecLog ALL mv -v "${CT_SYSROOT_DIR}/lib/"*.ld "${CT_PREFIX_DIR}/lib"
|
||||
# TBD what about moxie-*-elf? Does it need the same?
|
||||
|
||||
CT_DoStep INFO "Installing moxiebox runtime and VM"
|
||||
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-moxiebox"
|
||||
CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/moxiebox/." .
|
||||
|
||||
CT_DoLog EXTRA "Building SHA256-only libcrypto"
|
||||
# Moxiebox needs libcrypto on the host, but it only uses SHA256 digest functions
|
||||
# from it. We don't want to pull the whole OpenSSL for the host; fortunately,
|
||||
# moxiebox comes with a standalone SHA256 implementation - which it only uses
|
||||
# for the target library. Help it use the same implementation for the host.
|
||||
CT_mkdir_pushd openssl
|
||||
CT_DoExecLog ALL cp -v "${CT_LIB_DIR}/packages/moxiebox/"sha*.[ch] ./
|
||||
CT_DoExecLog ALL "${CT_HOST}-gcc" -c sha256_wrap.c -O2 -Wall
|
||||
CT_DoExecLog ALL "${CT_HOST}-ar" cru libcrypto.a sha256_wrap.o
|
||||
CT_Popd
|
||||
|
||||
# Moxiebox includes a VM which we're building for the
|
||||
# host machine.
|
||||
CT_DoLog EXTRA "Configuring moxiebox"
|
||||
|
||||
CT_DoExecLog CFG ./autogen.sh
|
||||
|
||||
# moxiebox build script create symlinks from the installation location to the build
|
||||
# directory for the moxiebox library. This seems backwards. Instead, pass the search
|
||||
# as part of the MOX_GCC definition.
|
||||
# moxiebox also depends on the tools being named moxiebox-{gcc,as,ar}. However, failure
|
||||
# to detect such tools is non-fatal in the configure and we need to override it in
|
||||
# make's command line anyway.
|
||||
CT_DoExecLog CFG \
|
||||
LDFLAGS="${CT_LDFLAGS_FOR_HOST} -L${CT_BUILD_DIR}/build-libc-moxiebox/openssl" \
|
||||
CFLAGS="${CT_CFLAGS_FOR_HOST} -I${CT_BUILD_DIR}/build-libc-moxiebox" \
|
||||
CXXFLAGS="${CT_CFLAGS_FOR_HOST} -I${CT_BUILD_DIR}/build-libc-moxiebox" \
|
||||
./configure \
|
||||
--host="${CT_HOST}"
|
||||
CT_DoLog EXTRA "Building moxiebox"
|
||||
CT_DoExecLog CFG make all \
|
||||
MOX_GCC="${CT_TARGET}-gcc -B ${CT_BUILD_DIR}/build-libc-moxiebox/runtime -B ${CT_SYSROOT_DIR}/lib" \
|
||||
MOX_AS="${CT_TARGET}-as" \
|
||||
MOX_AR="${CT_TARGET}-ar"
|
||||
|
||||
CT_DoLog EXTRA "Installing moxiebox"
|
||||
|
||||
# moxiebox does not have install target. Copy the interesting stuff manually.
|
||||
CT_DoExecLog ALL cp -v "${CT_BUILD_DIR}/build-libc-moxiebox/runtime/libsandboxrt.a" \
|
||||
"${CT_BUILD_DIR}/build-libc-moxiebox/runtime/crt0.o" \
|
||||
"${CT_SYSROOT_DIR}/lib/"
|
||||
CT_DoExecLog ALL cp -v "${CT_BUILD_DIR}/build-libc-moxiebox/src/sandbox" \
|
||||
"${CT_PREFIX_DIR}/bin"
|
||||
CT_Popd
|
||||
CT_EndStep
|
||||
}
|