# RHCOS 4.16 Boot Experiment on IBM LinuxONE LPAR

This document provides instructions for booting Red Hat CoreOS (RHCOS) 4.16 on an IBM LinuxONE or IBM Z LPAR with Fibre Channel (FCP) storage.

## Prerequisites

- Access to HMC (Hardware Management Console) for the LPAR
- RHCOS 4.16 ISO available (`rhcos-416.94.202410211619-0-live.s390x.iso`)
- HTTP server available on the network to host files
- FCP adapter configured and zoned to storage
- Network configuration details (IP, gateway, subnet, etc.)

## Step 1: Extract and Prepare Boot Files

First, mount the RHCOS ISO and extract necessary files:

```bash
# Mount the ISO
mkdir -p ~/mnt/rhcos
sudo mount -o loop ./rhcos/rhcos-416.94.202410211619-0-live.s390x.iso ~/mnt/rhcos

# Create a directory for the extracted files
mkdir -p ~/boot-rhcos
cp -r ~/mnt/rhcos/* ~/boot-rhcos/
```

## Step 2: Create Boot Files

### Create generic.ins file

This file already exists in the ISO, but verify its contents match the following:

```
images/kernel.img 0x00000000
images/initrd.img 0x02000000
images/genericdvd.prm 0x00010480
images/initrd.addrsize 0x00010408
```

If you need to modify it, create a custom INS file:

```bash
cat > ~/boot-rhcos/custom.ins << 'EOF'
images/pxeboot/kernel.img 0x00000000
images/pxeboot/initrd.img 0x02000000
images/custom.prm 0x00010480
images/initrd.addrsize 0x00010408
EOF
```

### Create custom.prm file

Create a custom parameter file with the appropriate settings for your environment:

```bash
cat > ~/boot-rhcos/images/custom.prm << 'EOF'
rd.neednet=1 console=ttysclp0 coreos.inst.install_dev=sda 
coreos.live.rootfs_url=http://YOUR_HTTP_SERVER/rhcos-416.94.202410211619-0-live-rootfs.s390x.img 
coreos.inst.ignition_url=http://YOUR_HTTP_SERVER/ignition/worker.ign 
ip=YOUR_IP::YOUR_GATEWAY:YOUR_NETMASK:YOUR_HOSTNAME:YOUR_INTERFACE:none
nameserver=YOUR_DNS 
cio_ignore=all,!condev 
zfcp.allow_lun_scan=0 
rd.zfcp=0.0.YOUR_FCP_DEV,0xYOUR_WWPN,0xYOUR_LUN
EOF
```

Replace the placeholders:
- `YOUR_HTTP_SERVER` - IP address of your HTTP server
- `YOUR_IP`, `YOUR_GATEWAY`, `YOUR_NETMASK`, `YOUR_HOSTNAME`, `YOUR_INTERFACE` - Your network configuration
- `YOUR_DNS` - Your DNS server IP
- `YOUR_FCP_DEV` - FCP device number (e.g., 4000)
- `YOUR_WWPN` - World Wide Port Name of your storage (e.g., 5005076300C213E9)
- `YOUR_LUN` - Logical Unit Number of your storage (e.g., 5022000000000000)

## Step 3: Host Required Files on HTTP Server

The RHCOS installer needs to download the rootfs and ignition config:

```bash
# Copy rootfs image to HTTP server
# You might need to extract this from the ISO or download it separately
scp ~/mnt/rhcos/images/pxeboot/rootfs.img user@http-server:/var/www/html/rhcos-416.94.202410211619-0-live-rootfs.s390x.img

# Copy ignition config to HTTP server (you need to create this separately for your OpenShift cluster)
scp worker.ign user@http-server:/var/www/html/ignition/worker.ign
```

## Step 4: FTP Boot Files to the LPAR

You need to make the boot files available to the LPAR, typically through FTP:

```bash
# Start FTP server if not already running
sudo systemctl start vsftpd

# Make sure files are in an accessible location
mkdir -p /var/ftp/pub/rhcos-boot
cp -r ~/boot-rhcos/* /var/ftp/pub/rhcos-boot/
chmod -R 755 /var/ftp/pub/rhcos-boot/
```

## Step 5: Boot the LPAR

From the HMC:

1. Select your LPAR
2. Select "Load" from the menu
3. Choose "FTP" as the source
4. Enter your FTP server details:
   - Host: Your FTP server IP
   - User/Password: FTP credentials
   - File location: `/pub/rhcos-boot/custom.ins` (or `generic.ins` if unchanged)
5. Click "OK" to start the boot process

## Step 6: Monitor Installation

Once booted, you can monitor the installation by:

1. Connecting to the LPAR console through the HMC
2. The installer should download the rootfs image and ignition config
3. It will then install RHCOS to the specified disk
4. If using an OpenShift ignition config, the node should automatically join your cluster

## Alternative Boot Method: Direct Console Input

As an alternative to creating files, you can input boot parameters directly at the console:

1. From the "Operating System Messages" console in HMC
2. Enter the following commands line by line:

```
ro ramdisk_size=40000 cio_ignore=all,!condev
rd.neednet=1 console=ttysclp0 coreos.inst.install_dev=sda
coreos.live.rootfs_url=http://YOUR_HTTP_SERVER/rhcos-416.94.202410211619-0-live-rootfs.s390x.img
coreos.inst.ignition_url=http://YOUR_HTTP_SERVER/ignition/worker.ign
ip=YOUR_IP::YOUR_GATEWAY:YOUR_NETMASK:YOUR_HOSTNAME:YOUR_INTERFACE:none
nameserver=YOUR_DNS
zfcp.allow_lun_scan=0
rd.zfcp=0.0.YOUR_FCP_DEV,0xYOUR_WWPN,0xYOUR_LUN
generic.ins
.
```

Replace the placeholders with your environment-specific values.

## Troubleshooting

- If the boot fails, check console output for error messages
- Verify network connectivity from the LPAR to your HTTP server
- Ensure FCP devices are properly configured and visible
- Check that storage LUNs are accessible
- Verify the Ignition config is valid

## References

- [Red Hat Documentation: Boot Parameters](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/automatically_installing_rhel/preparing-a-rhel-installation-on-64-bit-ibm-z_rhel-installer#customizing-boot-parameters_preparing-a-rhel-installation-on-64-bit-ibm-z)
- [Installing Red Hat OpenShift with LPAR on IBM Z](https://community.ibm.com/community/user/ibmz-and-linuxone/blogs/gerald-hosch1/2024/07/26/installing-red-hat-openshift-with-lpar-on-ibm-z?communityKey=fd56de68-d38b-499b-a1f4-51010f4eee66)
- [Installing OCP in a Mainframe Z Series](https://www.redhat.com/en/blog/installing-ocp-in-a-mainframe-z-series)
