Cross compiler for z/oS

Go here: http://45.76.81.249/zOS

~.bashrc

export PATH=/opt/IBM/bin:$PATH
export CFLAGS="$CFLAGS -Wno-error"

Folders

mkdir PEP_ZOS
sudo mkdir -p /opt/IBM
sudo chown `whoami`:users -R /opt/IBM

Repositories

cd PEP_ZOS
git clone https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
cd linux
git checkout v5.3.12
cd ..
git clone https://github.com/leviathanch/binutils.git
cd binutils
git checkout lev/master
git clone https://github.com/leviathanch/gcc.git
cd gcc
git checkout lev/master
cd ..
got clone https://github.com/leviathanch/glibc.git
cd glibc
git checkout lev/master
cd ..

Building steps

First we need to build the binutils with patches to generate and link bytecode recognized by the z/OS environment.

cd binutils/build

../configure --prefix=/opt/IBM --program-prefix=s390x-ibm-zos-gnu- --target=s390x-ibm-zos-gnu

make -j4

make install

cd ../..

Now we need to provide the kernel headers, since this is a requirement for building gcc and glibc (even if z/OS isn't a Linux)

cd linux

make ARCH=s390 menuconfig (got to exit and save)

make ARCH=s390 INSTALL_HDR_PATH=/opt/IBM/s390x-ibm-zos-gnu headers_install

cd ..

Now we build the first stage of the gcc bootstrap phase

cd gcc/build

../configure --prefix=/opt/IBM --program-prefix=s390x-ibm-zos-gnu- --target=s390x-ibm-zos-gnu --disable-multilib --enable-languages=c,c++ --disable-shared --disable-checking

make -j4 all-gcc

make install-gcc

cd ../..

Now we build the GLIBC on which the rest of GCC depends

cd glibc/build

export CFLAGS="-Wno-error -I/opt/IBM/include -L/opt/IBM/lib64/gcc/s390x-ibm-zos-gnu/8.3.1 -I/opt/IBM/lib64/gcc/s390x-ibm-zos-gnu/8.3.1/include -static -fsplit-stack -O3 -fexec-charset=IBM-1047"

../configure --prefix=/opt/IBM/s390x-ibm-zos-gnu --host=s390x-ibm-zos-gnu --target=s390x-ibm-zos-gnu --build=s390x-ibm-zos-gnu --disable-multilib --with-headers=/opt/IBM/s390x-ibm-zos-gnu/include --disable-shared --disable-nscd

make install-bootstrap-headers=yes install-headers

make -j4 csu/subdir_lib

install csu/*.o /opt/IBM/s390x-ibm-zos-gnu/lib/

touch /opt/IBM/s390x-ibm-zos-gnu/include/gnu/stubs.h

s390x-ibm-zos-gnu-gcc -nostdlib -nostartfiles -shared -x c /dev/null -o /opt/IBM/s390x-ibm-zos-gnu/lib/libc.so

cd ../..

Now we've got to build libgcc

cd gcc/build

make -j4 all-target-libgcc

make install-target-libgcc

cd ../..

Now we've got to finalize the GLIBC build

cd glibc/build

make -j4

make install

cd ../..

Adding DASD storage in Hercules+z/OS

So given you've got your nice z/OS copy from a special bay of pirates and you now wanna get cracking.
The only problem is: The storage is way too small.
The Hercules doc does here a good job in emulating not only the IBM mainframe but also the uselessness of IBM documentations.
Here a quick and dirty guide on how to initialize a new DASD device from the UNIX shell, so that you don't have to fight with the base system and so.

First you've got to go to your images folder and create an image.
In my case it's located in the DASD subfolder called GNU.

The following command should give you around 6GB of storage (8000 cylinders)

dasdinit -z LOCAL.CCKD 3390-3 LOCAL 8000

Next we have to add it into our hercules.cnf which should look somehow like that.
Make sure the address (0AB5) doesn't collide with already existing DASD lines.

0AB5    3390 $(DASD)/GNU/LOCAL.CCKD

Next we start up the mainframe (https://blog.the-leviathan.ch/?p=1361) and go into the x3270 command shell (not the one with the ncurses like selection menu)

Here we first bring the DASD offline with

V 0AB5,OFFLINE

Now we go into the telnet session and create a file, let's say script.txt with the following content

//ICKDSF01 JOB  (FB3),'INIT 3390 DASD',CLASS=A,MSGCLASS=H,
//             NOTIFY=&SYSUID,MSGLEVEL=(1,1)
//* 3380/3390 INITIALIZE VOLUME
//*
//*   VARY DEVICE ONLINE/OFFLINE AT LEAST ONCE BEFORE RUNNING
//*       THIS JOB, OR I/O ERROR WILL OCCUR AND NOT INITIALIZE
//*
//*   CHANGE
//*     VVVV - TO CUA ADDRESS OF DASD
//*   NEWNNN - TO NEW DASD VOLID
//*
//*   THEN PLACE A VVDS AT CYL 0 TRK 10-14 WITH JOB IDCDEFVV
//*
//STEP01  EXEC PGM=ICKDSF,REGION=8M
//SYSPRINT  DD SYSOUT=*
//SYSIN     DD *
 INIT -
      MAP /* MAP DEFECTS */ -
      UNIT(0AB5) /* ADDRESS */ -
      NOCHECK -
      CONTINUE -
      NOVERIFY /* DO NOT CHECK VOLID */ -
      VTOC(0,1,450) /* 8000 CYL VTOC */ -
      INDEX(30,1,90) /* 8000 CYL INDEX */ -
      OWNERID('IBMUSER') -
      VOLID(LOCAL) /*  NEW VOLID  */
//*
//
//*

And now comes they key part no one tells you about:
In your UNIX shell on Telnet you just pipe the content of this textfile to the z/OS command "submit"

IBMUSER:/u/ibmuser: >submit script.txt
JOB JOB02860 submitted from path 'script.txt'

In case you get something like the message below, you can reply by using the REPLY command and the number with the asterisk.

Now we wait for a few minutes and after that we go back into our x3270 shell and bring the DASD back online with (Oh wonder)

V 0AB5,ONLINE

Now we can define an aggregate from this volume with zfsadm and format it.

IBMUSER:/u/ibmuser: >zfsadm define -aggregate PEP.LOCAL -volume LOCAL -cyl 8000
IOEZ00248I VSAM linear dataset PEP.LOCAL successfully created.

IBMUSER:/u/ibmuser: >zfsadm format PEP.LOCAL
IOEZ00552I Multi-file system aggregates are restricted and support will be removed; plan to migrate.
Done.  PEP.LOCAL is now a zFS aggregate.

IBMUSER:/u/ibmuser: >zfsadm attach PEP.LOCAL
IOEZ00552I Multi-file system aggregates are restricted and support will be removed; plan to migrate.
IOEZ00117I Aggregate PEP.LOCAL attached successfully

IBMUSER:/u/ibmuser: >zfsadm create -filesystem PEP.LOCAL -aggregate PEP.LOCAL -size 6291456
IOEZ00099I File system PEP.LOCAL created successfully

For mounting it temporaraly you can execute the following command:

IBMUSER:/u/ibmuser: >/usr/sbin/mount -f PEP.LOCAL -t ZFS -o 'AGGRFULL(90,5)' /usr/local
IBMUSER:/u/ibmuser: >

OR

tso -t "MOUNT FILESYSTEM(PEP.LOCAL) TYPE(ZFS) MOUNTPOINT('/usr/local') MODE(RDWR)"

If you wanna add it to the auto mounted folders you've got to edit the mounting table in TSO. Just follow the white rabbit in the following screenies down the rabbit hole.

Now we add the TSO command from above here in the table at the end of the other mount directives.

In order to get some more newlines you go to the beginning of the number of the empty line and over type the first digit with R (for repeat) and then press enter.

Type "save" in the command field and then the command "end" (you get there by navigating there with the tab key), and as many ends as needed to come back to the top view.

Booting z/OS 1.1 on Hercules

So assuming you got your z/OS 1.1 DASD files from a special bay of pirates (Magnet link) and you now totally wanna try out this "cool software", those bankers are using.
First: Bankers aren't cool. Drugs, especially Cocaine aren't cool and hookers aren't that expensive either, you can afford them with more productive jobs as well.
Second: IBM products aren't cool either.

Now that that's said.
Check out this link for setting up the networking for your virtual main frame under Hercules: http://modernhackers.com/install-ibm-z-os-mainframe-under-gns3

First you might wanna arrange your windows like this with two open x3270 terminal connecting to your Hercules interface like shown in the pic here.

After you have this. You enter "ipl a80" in the Hercules interface and you will see after a moment in one of the two x3270 windows, how the system starts booting.

When it's done booting it will look like that.
The second window now provides you with a management interface.

One of those x3270 windows is a shell the other one is the configuration management tool from z/OS.

You can switch forth and back, using ESC in the Hercules terminal (the very left one) in order to either have a Hercules shell or have an overview of the CPU usage.

Now you can type in the right upper shell:
STOP TCPIP
START TCPIP
STOP OMVS
START OMVS

After that you should be able to connect to your z/OS using telnet on port 1023.

When you wanna shut down your system, as usual with IBM, it's not so simple.

First you go into the x3270 window and type "S SHUTSYS" and press enter.

You wait until it looks like that and then type "Z EOD" and then press enter.

It will write out the logs for a while and then will tell you, that it's done.
At that point where it looks as following you can go to the Hercules terminal and enter quit in order to terminate the emulator.

Here I typed another time "Z EOD", just to make sure it's done writing everything down, because z/OS (like AIX as well) are absolutely pussies, when it comes to corrupted file systems.

They'll tell you "high availability... blah blah". BS.

Workaround: nouveau-dri KDE plasma crash

If you had the issue already that basically everything in your KDE environment stops working all the sudden after a dist-upgrade and you end up on a black screen instead of the plasmashell after login, then you can try this.

It solved this issue for me.

Add this line into your .bashrc

export MESA_GL_VERSION_OVERRIDE=2.1

At the next login the desktop should appear again.

The problem seems to be that older nVidia cards have some buggy execution of some of the more modern OpenGL 3.1 commands, so forcing it to be using OpenGL 2.1 is safer.

PandaBoard-ES with upstream u-boot + kernel (take 1)

Hi
A friend of mine asked me whether I could buy for him a pandaboard from the factory in Shenzhen directly and set it up with a Linux for him. Here are the steps I went through to get it running.

Insert the SD card for the boot media (we assume it's /dev/sdX) and then do the following.
Zero the beginning of the SD card:

dd if=/dev/zero of=/dev/sdX bs=1M count=8

Start fdisk to partition the SD card:

fdisk /dev/sdX

At the fdisk prompt, delete old partitions and create a new one:
Type o. This will clear out any partitions on the drive.
Type p to list partitions. There should be no partitions left.
Now type n, then p for primary, 1 for the first partition on the drive, 2048 for the first sector, and then press ENTER to accept the default last sector.
Write the partition table and exit by typing w.

Create and mount the ext4 filesystem:

mkfs.ext4 /dev/sdX1
mount /dev/sdX1 /mnt

Download and extract the root filesystem:

wget http://archlinuxarm.org/os/ArchLinuxARM-armv7-latest.tar.gz
bsdtar -xpf ArchLinuxARM-armv7-latest.tar.gz -C /mnt
sync

If you don't have yet installed a cross compiler for ARM, you should do so, for instance with

zypper in cross-arm-linux-gnueabi-gcc

then clone and compile your u(nified)-boot(loader):

git clone git://git.denx.de/u-boot.git
cd u-boot
export CROSS_COMPILE=arm-linux-gnueabi-
make omap4_panda_config
make

Then write your boot loader to the SD card:

dd if=MLO of=/dev/sdX count=1 seek=1 conv=notrunc bs=128k
dd if=u-boot.img of=/dev/sdX count=2 seek=1 conv=notrunc bs=384k

 

Dragoncore/Loongson/龙芯 (step one)

Hi folks
I'm now living in China.
Here are some pictures of my first run of the 龙芯芯片.
Although the lab is still a total mess/battle zone is started working on the FOSS tablet project already.
As you can see the board I got from 龙芯 does power up and loads the PROM.
Next step is to compile a vmlinux for 2H in order to test the system.
IMG_20151108_014651 IMG_20151108_014641 IMG_20151108_014350 IMG_20151108_014342 IMG_20151108_004149

"Money printer"

Hi
I'm working on a python script which uses a cascaded triangular arbitrash in order to multiply money.
But so far the calculations seem to be all unsatisfying.
screeny17
What I'm doing so far is fetching and filtering and interpolating the values in order to estimate the trade development:

#!/usr/bin/python
import sys
import os
import copy
import math

# delays:
from time import sleep

# web api
from Cryptsy import Api

#plotting the stuff
import matplotlib
matplotlib.use("TkAgg")
from matplotlib.pyplot import plot
from matplotlib.pyplot import figure
from matplotlib.pyplot import close
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from IPython import display

#numpy stuff:
from numpy import delete
from numpy import array
from numpy import linspace
from numpy import polyfit
from numpy import poly1d
from numpy import newaxis
from numpy import ones

#scipy stuff
from scipy.signal import wiener
from scipy.optimize import curve_fit
from scipy.ndimage.filters import convolve1d
from scipy.interpolate import interp1d
from scipy.interpolate import InterpolatedUnivariateSpline
from scipy.signal import wiener
from scipy.signal import gaussian
from scipy.signal import savgol_filter

#sklearn
from sklearn.gaussian_process import GaussianProcess
from sklearn.linear_model import LinearRegression
from sklearn.isotonic import IsotonicRegression
from sklearn.cross_validation import cross_val_predict
from sklearn.preprocessing import PolynomialFeatures
from sklearn.pipeline import Pipeline
from sklearn.utils import check_random_state

#pyqt fit
from pyqt_fit import npr_methods
import pyqt_fit.nonparam_regression as smooth

...

	x = linspace(1, len(price_array), len(price_array))
	y = array(price_array)
	filtered_y = savgol_filter(y, window_length, savgol_filter_polyorder)

	k0 = smooth.NonParamRegression(x, filtered_y, method=npr_methods.LocalPolynomialKernel(q=gauss_poly_deg))
	k0.fit()
	z = k0(x)

	avg_diff_number=len(x)/4

	new_x=x[len(x)-avg_diff_number-1:]
	new_z=z[len(z)-avg_diff_number-1:]
	clf = LinearRegression()
	clf.fit(new_x[:,newaxis],new_z)
	tangent=clf.predict(new_x[:,newaxis])

	num_different=(tangent[-1]-tangent[0])/(new_x[-1]-new_x[0])

If someone has a better idea: Please say so!

Mein potentielles schlechte Laune Ablassventil