Skip to content

Instantly share code, notes, and snippets.

@cyring
Created March 10, 2025 18:03
Show Gist options
  • Save cyring/e077025f36391f7a52f753aa0fa33aeb to your computer and use it in GitHub Desktop.
Save cyring/e077025f36391f7a52f753aa0fa33aeb to your computer and use it in GitHub Desktop.
POWER10
IBM POWER10 Functional Simulator
@cyring
Copy link
Author

cyring commented Mar 10, 2025

Starting

  • See Installing and Invoking the Simulator at [4]
cd /opt/ibm/systemsim-p10-1.2-4/images/
wget https://ftp2.osuosl.org/pub/ppc64el/systemsim/p10/vmlinux
wget https://ftp2.osuosl.org/pub/ppc64el/systemsim/p10/skiboot.lid
wget https://ftp2.osuosl.org/pub/ppc64el/systemsim/p10/ubuntu2004-at15.img.gz
gunzip ubuntu2004-at15.img.gz
ln -s ubuntu2004-at15.img disk.img
cd -

systemsim -N 4 -f /opt/ibm/systemsim-p10-1.2-4/run/p10/linux/boot-linux-ubuntu-p10.tcl 

@cyring
Copy link
Author

cyring commented Mar 10, 2025

2025-03-11-000336_804x484_scrot

@cyring
Copy link
Author

cyring commented Mar 10, 2025

2025-03-11-005825_724x544_scrot

@cyring
Copy link
Author

cyring commented Mar 11, 2025

CoreFreq

  • No operational network yet in the above simulation. To install CoreFreq and its kernel prerequisites, we will make them manually.

Prepare

  • Mount the supplied Ubuntu disk image to prepare the on-going kernel headers and copy the CoreFreq source codes; in particular the new branch ppc64le

Step 1

sudo losetup -f /opt/ibm/systemsim-p10-1.2-4/images/ubuntu2004-at15.img
sudo mount /dev/loop0 /mnt
cd /mnt/usr/src
sudo git clone -b linux-5.14.y https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
sudo mv -v linux linux-5.14.y
cd -
cd /mnt/home/mambo
mkdir src
cd src
git clone [email protected]:cyring/CoreFreq.git
cd
sudo umount  /mnt
sudo losetup -D

Step 2

ssh -Y root@localhost

PATH=$PATH:/opt/ibm/systemsim-p10-1.2-4/bin
systemsim -f /opt/ibm/systemsim-p10-1.2-4/run/p10/linux/boot-linux-ubuntu-p10.tcl 

Step 3

## Synchronize date and time with the host
timedatectl set-timezone Universal
date +%Y%m%d -s "20250312"
date +%T -s "07:04:30"

## Prepare the Linux kernel source code
cd /lib/modules
mkdir $(uname -r)
cd $(uname -r)
ln -s /usr/src/linux-5.14.y build
cd build
## find . -type f -exec touch {} + ## Optionally fix files timestamp vs host clock
zcat /proc/config.gz > .config
make prepare
make -j7 modules
make install
make modules_install
make headers_install
cd
ls -l /boot/{vmlinux,initrd.img}
shutdown -h now

Step 4

  • Extract and copy the following kernel file to /opt/ibm/systemsim-p10-1.2-4/images/ using losetup mount as described in Step 1
/boot/initrd.img -> initrd.img-5.14.21
/boot/vmlinux -> vmlinux-5.14.21

Build

  • Boot simulator again as Step 2
  • Don't forget to set date and time in the VM as Step 3
su mambo
cd ~/src/CoreFreq
make clean
make -j
  CLEAN [M] /home/mambo/src/CoreFreq/build
  CLEAN [build/corefreqd]
  CLEAN [build/corefreq-cli]
  CLEAN [build/module/corefreqk.c]
  CLEAN [build/Makefile]
  RMDIR [build/module]
  RMDIR [build]
  CC [build/corefreqd.o]
  CC [build/corefreqm.o]
  CC [build/corefreq-cli.o]
  CC [build/corefreq-ui.o]
  CC [build/corefreq-cli-rsc.o]
  CC [build/corefreq-cli-json.o]
  CC [build/corefreq-cli-extra.o]
  LD [build/corefreqd]
  LD [build/corefreq-cli]
  CC [M]  /home/mambo/src/CoreFreq/build/module/corefreqk.o
  LD [M]  /home/mambo/src/CoreFreq/build/corefreqk.o
  MODPOST /home/mambo/src/CoreFreq/build/Module.symvers
  CC [M]  /home/mambo/src/CoreFreq/build/corefreqk.mod.o
  LD [M]  /home/mambo/src/CoreFreq/build/corefreqk.ko

@cyring
Copy link
Author

cyring commented Mar 12, 2025

Debian

  • Download the Debian virtual machine, in qcow2 format: 64-bit Little Endian PowerPC (qcow2)
  • Install QEMU for PowerPC
  • Start the virtual machine with the qcow image
pacman -S qemu-system-ppc

qemu-system-ppc64 -nographic -smp 6 -m 3G debian-12-nocloud-ppc64el.qcow2
  • Once in the VM, create a privileged user account
useradd -m nickname
passwd nickname
nano /etc/sudoers.d/01_first
nickname ALL=(ALL) ALL
  • Install the kernel development packages
sudo apt-get update
apt-cache search linux-headers-$(uname -r)
sudo apt install linux-headers-6.1.0-31-powerpc64le
sudo apt install make
sudo apt install gcc
sudo apt install ssh
sudo apt install git

CoreFreq

  • Build and Run CoreFreq, alpha preview version for PowerPC
cd
mkdir src
cd src
git clone [email protected]:cyring/CoreFreq.git
make -j

sudo sync; sudo insmod build/corefreqk.ko 
sudo sync; sudo build/corefreqd -q &
./build/corefreq-cli 

jobs
kill %1
sudo rmmod corefreqk

2025-03-12-181149_642x410_scrot
2025-03-12-181107_642x359_scrot
2025-03-12-181119_642x359_scrot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment