Message ID | 3c926f637c4738bd14db10e8fe8f72a6eae2dfd4.1671789736.git.oleksii.kurochko@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Add minimal RISC-V Xen build and build testing | expand |
On 23/12/2022 11:16 am, Oleksii Kurochko wrote: > diff --git a/automation/scripts/build b/automation/scripts/build > index a593419063..026f480e76 100755 > --- a/automation/scripts/build > +++ b/automation/scripts/build > @@ -2,12 +2,12 @@ > > test -f /etc/os-release && cat "$_" > > -$CC --version > +${CROSS_COMPILE}${CC} --version > > # Express the compiler version as an integer. e.g. GCC 4.9.2 => 0x040902 > cc-ver() > { > - $CC -dumpversion | awk -F. '{ printf "0x%02x%02x%02x", $1, $2, $3 }' > + ${CROSS_COMPILE}${CC} -dumpversion | awk -F. '{ printf "0x%02x%02x%02x", $1, $2, $3 }' > } > > # random config or default config > @@ -66,7 +66,7 @@ if ! type python3 || python3 -c "import sys; res = sys.version_info < (3, 5); ex > fi > > # SeaBIOS requires GCC 4.6 or later > -if [[ "${CC}" == "gcc" && `cc-ver` -lt 0x040600 ]]; then > +if [[ "${CROSS_COMPILE}${CC}" == "gcc" && `cc-ver` -lt 0x040600 ]]; then This change won't work, because it's no longer a plain "gcc". Also, prepreding CROSS_COMPILE isn't compatible with LLVM toolchains, but that's not something you've made any worse with your change (just more obvious). We probably want a stanza near the top which sets CC="${CROSS_COMPILE}${CC}" which can be adjusted to support LLVM in due course, and we'll need to detect GCC using --version | grep as its done elsewhere. But the other logic wants reworking too so we don't play around with bits of the tools build when we're doing a hypervisor-only build anyway... ~Andrew
On Wed, 2022-12-28 at 23:24 +0000, Andrew Cooper wrote: > On 23/12/2022 11:16 am, Oleksii Kurochko wrote: > > diff --git a/automation/scripts/build b/automation/scripts/build > > index a593419063..026f480e76 100755 > > --- a/automation/scripts/build > > +++ b/automation/scripts/build > > @@ -2,12 +2,12 @@ > > > > test -f /etc/os-release && cat "$_" > > > > -$CC --version > > +${CROSS_COMPILE}${CC} --version > > > > # Express the compiler version as an integer. e.g. GCC 4.9.2 => > > 0x040902 > > cc-ver() > > { > > - $CC -dumpversion | awk -F. '{ printf "0x%02x%02x%02x", $1, $2, > > $3 }' > > + ${CROSS_COMPILE}${CC} -dumpversion | awk -F. '{ printf > > "0x%02x%02x%02x", $1, $2, $3 }' > > } > > > > # random config or default config > > @@ -66,7 +66,7 @@ if ! type python3 || python3 -c "import sys; res > > = sys.version_info < (3, 5); ex > > fi > > > > # SeaBIOS requires GCC 4.6 or later > > -if [[ "${CC}" == "gcc" && `cc-ver` -lt 0x040600 ]]; then > > +if [[ "${CROSS_COMPILE}${CC}" == "gcc" && `cc-ver` -lt 0x040600 > > ]]; then > > This change won't work, because it's no longer a plain "gcc". > If look at tests on GitLab CI&CD these changes don't break anything. > Also, prepreding CROSS_COMPILE isn't compatible with LLVM toolchains, > but that's not something you've made any worse with your change (just > more obvious). > CROSS_COMPILE isn't use with LLVM toolchain. I mean that in case of LLVM toolchain CROSS_COMPILE would be equal to empty string plus CC=clang or something similar. > We probably want a stanza near the top which sets > CC="${CROSS_COMPILE}${CC}" which can be adjusted to support LLVM in > due > course, and we'll need to detect GCC using --version | grep as its > done > elsewhere. > > But the other logic wants reworking too so we don't play around with > bits of the tools build when we're doing a hypervisor-only build > anyway... > I think that I can get rid of CROSS_COMPILE variable at all and use CC=riscv64-linux-gnu-gcc direcly for RISC-V 64 targers in build.yaml. Would this be a better solution? > ~Andrew ~Oleksii
On Thu, 2022-12-29 at 10:13 +0200, Oleksii wrote: > On Wed, 2022-12-28 at 23:24 +0000, Andrew Cooper wrote: > > On 23/12/2022 11:16 am, Oleksii Kurochko wrote: > > > diff --git a/automation/scripts/build b/automation/scripts/build > > > index a593419063..026f480e76 100755 > > > --- a/automation/scripts/build > > > +++ b/automation/scripts/build > > > @@ -2,12 +2,12 @@ > > > > > > test -f /etc/os-release && cat "$_" > > > > > > -$CC --version > > > +${CROSS_COMPILE}${CC} --version > > > > > > # Express the compiler version as an integer. e.g. GCC 4.9.2 => > > > 0x040902 > > > cc-ver() > > > { > > > - $CC -dumpversion | awk -F. '{ printf "0x%02x%02x%02x", $1, > > > $2, > > > $3 }' > > > + ${CROSS_COMPILE}${CC} -dumpversion | awk -F. '{ printf > > > "0x%02x%02x%02x", $1, $2, $3 }' > > > } > > > > > > # random config or default config > > > @@ -66,7 +66,7 @@ if ! type python3 || python3 -c "import sys; > > > res > > > = sys.version_info < (3, 5); ex > > > fi > > > > > > # SeaBIOS requires GCC 4.6 or later > > > -if [[ "${CC}" == "gcc" && `cc-ver` -lt 0x040600 ]]; then > > > +if [[ "${CROSS_COMPILE}${CC}" == "gcc" && `cc-ver` -lt 0x040600 > > > ]]; then > > > > This change won't work, because it's no longer a plain "gcc". > > > > If look at tests on GitLab CI&CD these changes don't break anything. > > > Also, prepreding CROSS_COMPILE isn't compatible with LLVM > > toolchains, > > but that's not something you've made any worse with your change > > (just > > more obvious). > > > > CROSS_COMPILE isn't use with LLVM toolchain. I mean that in case of > LLVM toolchain CROSS_COMPILE would be equal to empty string plus > CC=clang or something similar. > > > We probably want a stanza near the top which sets > > CC="${CROSS_COMPILE}${CC}" which can be adjusted to support LLVM in > > due > > course, and we'll need to detect GCC using --version | grep as its > > done > > elsewhere. > > > > But the other logic wants reworking too so we don't play around > > with > > bits of the tools build when we're doing a hypervisor-only build > > anyway... > > > > I think that I can get rid of CROSS_COMPILE variable at all and use > CC=riscv64-linux-gnu-gcc direcly for RISC-V 64 targers in build.yaml. > Would this be a better solution? > It will not work. At least that CROSS_COMPILE variable is set in riscv64.dockerfile. So it will definitely mess the hypervisor build. > > ~Andrew > > ~Oleksii >
diff --git a/automation/scripts/build b/automation/scripts/build index a593419063..026f480e76 100755 --- a/automation/scripts/build +++ b/automation/scripts/build @@ -2,12 +2,12 @@ test -f /etc/os-release && cat "$_" -$CC --version +${CROSS_COMPILE}${CC} --version # Express the compiler version as an integer. e.g. GCC 4.9.2 => 0x040902 cc-ver() { - $CC -dumpversion | awk -F. '{ printf "0x%02x%02x%02x", $1, $2, $3 }' + ${CROSS_COMPILE}${CC} -dumpversion | awk -F. '{ printf "0x%02x%02x%02x", $1, $2, $3 }' } # random config or default config @@ -66,7 +66,7 @@ if ! type python3 || python3 -c "import sys; res = sys.version_info < (3, 5); ex fi # SeaBIOS requires GCC 4.6 or later -if [[ "${CC}" == "gcc" && `cc-ver` -lt 0x040600 ]]; then +if [[ "${CROSS_COMPILE}${CC}" == "gcc" && `cc-ver` -lt 0x040600 ]]; then cfgargs+=("--with-system-seabios=/bin/false") fi
Docker images that are currently available and used for cross-compilation is additionally installed GCC/Binutils which is why the build script doesn't crash. RISC-V docker image doesn't have native GCC only cross-compiler which will lead to the fact that the build script will fail. Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com> --- automation/scripts/build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)