From 238de1b2821ebf9fd47b400a5dc5382c78b92a9e Mon Sep 17 00:00:00 2001 From: WangRunji Date: Thu, 24 Jan 2019 00:08:25 +0800 Subject: [PATCH] fix compile for rv64 --- kernel/build-rv64 | 103 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 87 insertions(+), 16 deletions(-) diff --git a/kernel/build-rv64 b/kernel/build-rv64 index 42fcb7d..bde489c 100755 --- a/kernel/build-rv64 +++ b/kernel/build-rv64 @@ -54,7 +54,7 @@ fi fi # if some crates are not exist, build for riscv32 first -if ! [[ -f $CARGO_PATH/git/checkouts/bit-vec-437fa4a002bd318d/9861a58/src/lib.rs ]] +if ! [[ -f $CARGO_PATH/git/checkouts/bit-vec-437fa4a002bd318d/9861a58/src/lib.rs ]] || ! [[ -z ${TRAVIS_OS_NAME} ]] then make kernel arch=riscv32 board=none fi @@ -95,14 +95,7 @@ fi CNAME=compiler_builtins if ! [[ -f ${OUTDIR}/${CNAME}.o ]] then - - if [[ -d $CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.3 ]] - then - COMPILER_BUILTINS_PATH=$CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.3 - elif [[ -d $CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.4 ]] - then - COMPILER_BUILTINS_PATH=$CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.4 - elif [[ -d $CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.5 ]] + if [[ -d $CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.5 ]] then COMPILER_BUILTINS_PATH=$CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.5 else @@ -261,14 +254,16 @@ rustc --crate-name bitflags $CARGO_PATH/registry/src/github.com-1ecc6299db9ec823 gen_full_rlib fi -CNAME=volatile +CNAME=managed if ! [[ -f ${OUTDIR}/${CNAME}.o ]] then -rustc --crate-name volatile $CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/volatile-0.2.5/src/lib.rs \ +rustc --crate-name managed $CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/managed-0.7.1/src/lib.rs \ --color always --crate-type lib --emit=metadata,llvm-bc \ -C opt-level=1 \ -C debuginfo=2 \ -C debug-assertions=on \ + --cfg 'feature="alloc"' \ + --cfg 'feature="map"' \ --out-dir ${OUTDIR} \ --target $TARGET_JSON \ -L ${OUTDIR} \ @@ -276,10 +271,10 @@ rustc --crate-name volatile $CARGO_PATH/registry/src/github.com-1ecc6299db9ec823 gen_full_rlib fi -CNAME=once +CNAME=device_tree if ! [[ -f ${OUTDIR}/${CNAME}.o ]] then -rustc --crate-name once $CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/once-0.3.3/src/lib.rs \ +rustc --crate-name device_tree $CARGO_PATH/git/checkouts/device_tree-rs-7c4f9e86f346d07b/1bd9b4d*/src/lib.rs \ --color always --crate-type lib --emit=metadata,llvm-bc \ -C opt-level=1 \ -C debuginfo=2 \ @@ -291,17 +286,18 @@ rustc --crate-name once $CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/onc gen_full_rlib fi -CNAME=bbl +CNAME=byteorder if ! [[ -f ${OUTDIR}/${CNAME}.o ]] then -rustc --crate-name bbl $PWD/../crate/bbl/src/lib.rs \ +rustc --crate-name byteorder $CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/byteorder-1.3.1/src/lib.rs \ --color always --crate-type lib --emit=metadata,llvm-bc \ -C opt-level=1 \ -C debuginfo=2 \ -C debug-assertions=on \ --out-dir ${OUTDIR} \ --target $TARGET_JSON \ - -L ${OUTDIR} + -L ${OUTDIR} \ + --cap-lints allow gen_full_rlib fi @@ -320,6 +316,77 @@ rustc --crate-name log $CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/log- gen_full_rlib fi +CNAME=smoltcp +if ! [[ -f ${OUTDIR}/${CNAME}.o ]] +then +rustc --crate-name smoltcp $CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/smoltcp-0.5.0/src/lib.rs \ + --color always --crate-type lib --emit=metadata,llvm-bc \ + -C opt-level=1 \ + -C debuginfo=2 \ + -C debug-assertions=on \ + --cfg 'feature="alloc"' \ + --cfg 'feature="log"' \ + --cfg 'feature="managed"' \ + --cfg 'feature="proto-igmp"' \ + --cfg 'feature="proto-ipv4"' \ + --cfg 'feature="socket-icmp"' \ + --cfg 'feature="socket-tcp"' \ + --cfg 'feature="socket-udp"' \ + --extern bitflags=${OUTDIR}/libbitflags.rlib \ + --extern byteorder=${OUTDIR}/libbyteorder.rlib \ + --extern log=${OUTDIR}/liblog.rlib \ + --extern managed=${OUTDIR}/libmanaged.rlib \ + --out-dir ${OUTDIR} \ + --target $TARGET_JSON \ + -L ${OUTDIR} \ + --cap-lints allow +gen_full_rlib +fi + +CNAME=volatile +if ! [[ -f ${OUTDIR}/${CNAME}.o ]] +then +rustc --crate-name volatile $CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/volatile-0.2.5/src/lib.rs \ + --color always --crate-type lib --emit=metadata,llvm-bc \ + -C opt-level=1 \ + -C debuginfo=2 \ + -C debug-assertions=on \ + --out-dir ${OUTDIR} \ + --target $TARGET_JSON \ + -L ${OUTDIR} \ + --cap-lints allow +gen_full_rlib +fi + +CNAME=once +if ! [[ -f ${OUTDIR}/${CNAME}.o ]] +then +rustc --crate-name once $CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/once-0.3.3/src/lib.rs \ + --color always --crate-type lib --emit=metadata,llvm-bc \ + -C opt-level=1 \ + -C debuginfo=2 \ + -C debug-assertions=on \ + --out-dir ${OUTDIR} \ + --target $TARGET_JSON \ + -L ${OUTDIR} \ + --cap-lints allow +gen_full_rlib +fi + +CNAME=bbl +if ! [[ -f ${OUTDIR}/${CNAME}.o ]] +then +rustc --crate-name bbl $PWD/../crate/bbl/src/lib.rs \ + --color always --crate-type lib --emit=metadata,llvm-bc \ + -C opt-level=1 \ + -C debuginfo=2 \ + -C debug-assertions=on \ + --out-dir ${OUTDIR} \ + --target $TARGET_JSON \ + -L ${OUTDIR} +gen_full_rlib +fi + CNAME=linked_list_allocator if ! [[ -f ${OUTDIR}/${CNAME}.o ]] then @@ -565,6 +632,8 @@ rustc --edition=2018 --crate-name rcore src/lib.rs \ --extern rcore_process=${OUTDIR}/librcore_process.rlib \ --extern volatile=${OUTDIR}/libvolatile.rlib \ --extern xmas_elf=${OUTDIR}/libxmas_elf.rlib \ + --extern device_tree=${OUTDIR}/libdevice_tree.rlib \ + --extern smoltcp=${OUTDIR}/libsmoltcp.rlib \ -L native=${OUTDIR} -l static=sfsimg -l static=atomic_rt gen_full_rlib @@ -600,5 +669,7 @@ rustc --edition=2018 --crate-name rcore src/main.rs \ --extern rcore_process=${OUTDIR}/librcore_process.rlib \ --extern volatile=${OUTDIR}/libvolatile.rlib \ --extern xmas_elf=${OUTDIR}/libxmas_elf.rlib \ + --extern device_tree=${OUTDIR}/libdevice_tree.rlib \ + --extern smoltcp=${OUTDIR}/libsmoltcp.rlib \ -L native=${OUTDIR} ${LINK_K210} #fi