Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,34 +41,34 @@ automatically download and build an appropriate toolchain as part of the build
process, so you don't need to worry about setting up a
cross-compiler. Cross-compiling from a x86-64 host is officially supported.

The machine your building on will need Python 2.7, GCC 8.4 (or later), and
The machine your building on will need Python 3, GCC 8.4 (or later), and
a handful of other packages (see below).

### Dependencies for *64-bit* Ubuntu/Debian systems

1. Install Ubuntu 22.04 or Debian 12 (x86_64 or ppc64le).
1. Install Ubuntu 26.04 or Debian 13 (x86_64 or ppc64le).
2. Enable Universe (Ubuntu only):

sudo apt-get install software-properties-common
sudo add-apt-repository universe
3. Install the packages necessary for the build:

sudo apt-get install cscope universal-ctags libz-dev libexpat-dev \
python2 python-is-python3 language-pack-en texinfo gawk cpio xxd \
python3 python-is-python3 language-pack-en texinfo gawk cpio xxd \
build-essential g++ git bison flex unzip \
libssl-dev libxml-simple-perl libxml-sax-perl libxml-parser-perl libxml2-dev libxml2-utils xsltproc \
wget bc rsync

### Dependencies for *64-bit* Fedora systems

1. Install Fedora 33 (x86_64 or ppc64le).
1. Install Fedora 44 (x86_64 or ppc64le).
2. Install the packages necessary for the build:

sudo dnf install gcc-c++ flex bison git ctags cscope expat-devel patch \
zlib-devel zlib-static texinfo "perl(bigint)" "perl(XML::Simple)" \
"perl(YAML)" "perl(XML::SAX)" "perl(Fatal)" "perl(Thread::Queue)" \
"perl(Env)" "perl(XML::LibXML)" "perl(Digest::SHA1)" "perl(ExtUtils::MakeMaker)" \
"perl(FindBin)" "perl(English)" "perl(Time::localtime)" "perl(open)" \
"perl(FindBin)" "perl(English)" "perl(Time::localtime)" "perl(open)" "perl(IPC::Cmd)" "perl(Time::Piece)" \
libxml2-devel which wget unzip tar cpio python bzip2 bc findutils ncurses-devel \
openssl-devel make libxslt vim-common lzo-devel python2 rsync hostname
openssl-devel make libxslt vim-common lzo-devel python3 rsync hostname

2 changes: 1 addition & 1 deletion buildroot
Submodule buildroot updated 2150 files
2 changes: 1 addition & 1 deletion openpower/package/hcode/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ config BR2_HCODE_CUSTOM_VERSION_VALUE

config BR2_HCODE_VERSION
string
default "hw091323a.opmst" if BR2_HCODE_LATEST_VERSION
default "888cb36253c3c4a0770b6481e570960481a13e50" if BR2_HCODE_LATEST_VERSION
default BR2_HCODE_CUSTOM_VERSION_VALUE \
if BR2_HCODE_CUSTOM_VERSION

Expand Down
17 changes: 15 additions & 2 deletions openpower/package/occ/occ.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,26 @@ OCC_TARGET_CROSS = $(TARGET_CROSS)
OCC_DEPENDENCIES += host-binutils
endif

# OCC's host-side build tools (ppetracepp, ppe2fsp, imageHdrScript, ffdcparser,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once open-power/occ#37 is merged, we could remove this wrapper

# ...) are old pre-C23 / K&R C that GCC >= 14 rejects by default (implicit int,
# and "bool" being a keyword in C23). Provide a host gcc/g++ wrapper that relaxes
# the standard for these tools only; target code is built via CROSS_PREFIX and is
# unaffected. The flags are harmless on older host compilers (e.g. Fedora 33).
define OCC_HOSTCC_WRAP
mkdir -p $(@D)/.hostcc
printf '#!/bin/sh\nexec /usr/bin/gcc -std=gnu17 -fpermissive "$$@"\n' > $(@D)/.hostcc/gcc
printf '#!/bin/sh\nexec /usr/bin/g++ -fpermissive "$$@"\n' > $(@D)/.hostcc/g++
chmod +x $(@D)/.hostcc/gcc $(@D)/.hostcc/g++
endef

define OCC_BUILD_CMDS
$(OCC_HOSTCC_WRAP)
if [ "$(BR2_OCC_GPU_BIN_BUILD)" == "y" ]; then \
cd $(@D)/src && \
make PPE_TOOL_PATH=$(PPE42_GCC_BIN) OCC_OP_BUILD=1 CROSS_PREFIX=$(OCC_TARGET_CROSS) LD_LIBRARY_PATH=$(HOST_DIR)/usr/lib GPE1_BIN_IMAGE_PATH=$(STAGING_DIR)/hostboot_binaries/ OPOCC_GPU_SUPPORT=1 all; \
PATH="$(@D)/.hostcc:$$PATH" make PPE_TOOL_PATH=$(PPE42_GCC_BIN) OCC_OP_BUILD=1 CROSS_PREFIX=$(OCC_TARGET_CROSS) LD_LIBRARY_PATH=$(HOST_DIR)/usr/lib GPE1_BIN_IMAGE_PATH=$(STAGING_DIR)/hostboot_binaries/ OPOCC_GPU_SUPPORT=1 all; \
else \
cd $(@D)/src && \
make PPE_TOOL_PATH=$(PPE42_GCC_BIN) OCC_OP_BUILD=1 CROSS_PREFIX=$(OCC_TARGET_CROSS) LD_LIBRARY_PATH=$(HOST_DIR)/usr/lib all; \
PATH="$(@D)/.hostcc:$$PATH" make PPE_TOOL_PATH=$(PPE42_GCC_BIN) OCC_OP_BUILD=1 CROSS_PREFIX=$(OCC_TARGET_CROSS) LD_LIBRARY_PATH=$(HOST_DIR)/usr/lib all; \
fi;
endef
OCC_BUILD_CMDS ?= $(OCC_BUILD_CMDS_P9)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
openpower-pnor: use python3 to run sbeOpDistribute.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upstreamed at open-power/pnor#162


python2 is unavailable on modern host distros; sbeOpDistribute.py is
python3-compatible, so invoke it with python3 during image assembly.

Signed-off-by: Trung Le <trung.le@ruby-journal.com>

--- a/update_image.pl
+++ b/update_image.pl
@@ -278,7 +278,7 @@
if ($release eq "p9") {
my $hw_ref_image = $wink_binary_filename;
$hw_ref_image =~ s/.hdr.bin.ecc//;
- run_command("python2 $sbe_binary_dir/sbeOpDistribute.py --install --buildSbePart $hb_image_dir/buildSbePart.pl --hw_ref_image $hcode_dir/$hw_ref_image.bin --sbe_binary_filename $sbe_binary_filename --scratch_dir $scratch_dir --sbe_binary_dir $sbe_binary_dir");
+ run_command("python3 $sbe_binary_dir/sbeOpDistribute.py --install --buildSbePart $hb_image_dir/buildSbePart.pl --hw_ref_image $hcode_dir/$hw_ref_image.bin --sbe_binary_filename $sbe_binary_filename --scratch_dir $scratch_dir --sbe_binary_dir $sbe_binary_dir");
}
else {
run_command("cp $hb_binary_dir/$sbe_binary_filename $scratch_dir/");
60 changes: 60 additions & 0 deletions openpower/package/sbe/0001-sbe-use-python3-for-build-scripts.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
sbe: use python3 for build scripts

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upstreamed at open-power/sbe#23


GCC/host distros no longer ship python2. The SBE build invokes python2
for buildInfo.py / securityRegListGen.py and via #!/usr/bin/python2
shebangs; these scripts are python3-compatible, so call python3.

Signed-off-by: Trung Le <trung.le@ruby-journal.com>

--- a/src/build/Makefile
+++ b/src/build/Makefile
@@ -244,7 +244,7 @@

# Create build Info file
buildInfo:
- python2 buildInfo.py $(GENFILES_DIR)
+ python3 buildInfo.py $(GENFILES_DIR)

buildtag:
./updateBuildTag.py $(P9_XIP_TOOL) $(IMG_DIR) $(IMAGE_NAME)
@@ -321,7 +321,7 @@

# generate whitelist and blacklist security algorithm
security: $(OBJDIR)
- python2 $(SECURITY_SRC_DIR)/securityRegListGen.py -f $(SECURITY_LIST) -o $(GENFILES_DIR)
+ python3 $(SECURITY_SRC_DIR)/securityRegListGen.py -f $(SECURITY_LIST) -o $(GENFILES_DIR)

# Build hwp_error_info.H. If the script fails then print the contents of
# the header and then delete whatever garbage the script left to force it to
--- a/src/build/buildInfo.py
+++ b/src/build/buildInfo.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
--- a/src/build/parsAndCutElf.py
+++ b/src/build/parsAndCutElf.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
--- a/src/build/updateBuildTag.py
+++ b/src/build/updateBuildTag.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
--- a/src/boot/sbeCompression.py
+++ b/src/boot/sbeCompression.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
2 changes: 1 addition & 1 deletion openpower/package/sbe/sbe.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ endef

define SBE_INSTALL_IMAGES_CMDS
$(INSTALL) -D $(@D)/images/p9_ipl_build $(HOST_DIR)/usr/bin/
python2 $(@D)/src/build/sbeOpDistribute.py --sbe_binary_dir=$(STAGING_DIR)/sbe_binaries --img_dir=$(@D)/images --sbe_binary_filename $(BR2_HOSTBOOT_BINARY_SBE_FILENAME)
python3 $(@D)/src/build/sbeOpDistribute.py --sbe_binary_dir=$(STAGING_DIR)/sbe_binaries --img_dir=$(@D)/images --sbe_binary_filename $(BR2_HOSTBOOT_BINARY_SBE_FILENAME)
cp $(@D)/src/build/sbeOpDistribute.py $(STAGING_DIR)/sbe_binaries/
endef

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
skiboot: link final elf with -z notext for newer binutils

skiboot is a self-relocating PIE and processes its own relocations at
boot, so it legitimately contains text relocations. binutils >= 2.39
promotes "read-only segment has dynamic relocations" from a warning to a
hard error by default (e.g. binutils 2.46 on Fedora 44 / Ubuntu 26.04,
2.44 on Debian 13), breaking the final link. Pass -z notext to allow it.

Upstream: https://github.com/open-power/skiboot (Makefile.main)
Signed-off-by: Trung Le <trung.le@ruby-journal.com>

diff --git a/Makefile.main b/Makefile.main
index a06d79fe..22a9cdee 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -197,6 +197,10 @@ LDFLAGS_FINAL = -m elf64lppc --no-multi-toc -N --build-id=none --whole-archive
LDFLAGS_FINAL += -static -nostdlib -pie -Ttext-segment=$(LD_TEXT) --oformat=elf64-powerpc
LDFLAGS_FINAL += --orphan-handling=warn
LDFLAGS_FINAL += $(call try-ldflag,$(LD),--no-warn-rwx-segments)
+# skiboot is a self-relocating PIE and processes its own relocations at boot,
+# so it legitimately has text relocations. binutils >= 2.39 turns "read-only
+# segment has dynamic relocations" into a hard error by default; allow it.
+LDFLAGS_FINAL += $(call try-ldflag,$(LD),-z notext)

LDRFLAGS=-melf64ppc
# Debug stuff