Sunday, July 7, 2019

Running PDP10/KLH10 on Raspberry Pi



copied from Keith Halewood's facebook note 7/7/2019

https://www.facebook.com/notes/dec-computer-users/running-pdp10klh10-on-raspberry-pi/394084557900778/


This is a bit of a work in progress so beware the rough edges.
The PDP-10 (KLH10) distribution from github seems to have been modified to make it more general purpose so the various bits of documentation on the net seem to be a little out of date or confusing, so here’s how I got it to work so that I could install the Panda distribution of TOPS-20 onto it, along with DECnet (connection to HECnet) and TCP-IP. LAT too, was a bit of a surprise.
Firstly, the raspberry Pi. I’m running the minimal ‘buster’ version with a WIRED network. I have also used ‘apt-get install’ to install the following:

screen
bridge-utils
uml-utilities
autogen
autoconf
build-essential (if on minimalist install, such as debian, for example)
 
The Pi’s networking configuration has a fixed IP address so I’ve switched off the standard dhcp client and I rely entirely on the content of /etc/network/interfaces. For me, the contents look roughly like:

auto lo br0 tap1 tap2 tap3
iface lo inet loopback
iface eth0 inet manual
iface tap1 inet manual
pre-up ip tuntap add tap1 mode tap user simh
iface tap2 inet manual
pre-up ip tuntap add tap2 mode tap user simh
iface tap3 inet manual
pre-up ip tuntap add tap3 mode tap user simh
iface br0 inet static
bridge_ports eth0 tap1 tap2 tap3
bridge_fd 0
address 192.168.x.y
netmask 255.255.255.0
gateway 192.168.x.a

where x.y and x.a are the host addresses of your pi and default gateway. ‘simh’ is the userId of the non-privileged user under which you run your simulations. What has been set up here is a bridge device linking the real ethernet device eth0 and pseudo devices tap1, tap2, tap3 - usable by SIMH and by the PDP10 emulator.
Download and unzip the KLH10 emulator:
$ curl -L https://github.com/PDP-10/klh10/archive/master.zip > klh10-master.zip
$ unzip -o klh10-master.zip
Go into the ./klh10-master directory and edit the configure file. Find the CFLAGS setting and change the -O3 into -O2
Go back up a directory level.
Create another directory, say klh10-build and go into it and:
$ ../klh10-master/autogen.sh
Assuming you’ve installed autogen, autoconf etc., you should see a few files and directories magically appear in your current directory (klh10-build).
Type:
$ make
and watch it building the kl, ks and ks-its models in the appropriate subdirectories. You should see the compiler compiling with -O2. This is important. The -O3 optimisation seems to mess up something critical in the simulators.
Go into the bld-kl directory and you’ll see some executables like:
dpni20, dprpxx, dptm03, enaddr, kn10-kl, udlconv, uexbconv, vdkfmt, wfconv, wxtest.
Copy these to a location where you’ll be running the simulator with a configuration file and disc image file(s).
kn10-kl is the simulator executable. When running a simulation, it’ll fire up instances of dprpxx and dpni20. The dpni20 executable will need to be setuid root, ie:
# chown root:root dpni20
# chmod u+s dpni20
It’s annoying because the whole point about ‘tap’ network interfaces defined above is that a non-privileged user, ie. simh as defined above, should be able to exert full control over its side of the device.
WORK IN PROGRESS
Panda distribution of TOPS-20 , installation and configuration - see
 http://www.ldx.ca/notes/tops-20-notes.html

Talk about the workaround for the network connection and the fact it doesn’t use the tap device you want it to.... etc...
NCP might take a while to start... or not.
Using screen to let you detach the pdp10’s console...
Connections via TCP/IP, DECnet. LAT appears to work much better than DECnet’s CTERM.

--30--

Thursday, July 4, 2019

Imagemagick and command line "convert" to create pdf files



 https://itsfoss.com/convert-multiple-images-pdf-ubuntu-1304/

Command Line:

sudo apt-get install imagemagick
 
convert image1.jpg image2.png image3.bmp output.pdf
 
  
Convert tool, with gui support:

gscan2pdf


--30--

Friday, June 14, 2019

NFS file mounting and sharing notes




show remote shares on a system:

showmount -e <nas host name or ip>

Install NFS on Ubuntu (client and server)

https://vitux.com/install-nfs-server-and-client-on-ubuntu/

--30--

Thursday, June 6, 2019

mount sd card image on linux (dd)


Drivers in linux kernel when media is inserted create /dev entries for supported media organizations such as with sd creating /dev/sda1, etc. as well as the media dev entry /dev/sda.

With images, the loop mount has no support to break up the image into partitions, and require using the loop mount capability to find a supported file system by using offsets into the image.

These offsets are in byte counts, so knowledge of the blocksize of the original media is needed to calculate these offsets.

Also it was noted that some file systems don't support protections in the way linux does with access control in the file system, but just on the overall media.  Microsoft fat is the main culprit in that regard.  An option can be used to set the mounted media point properly for read access only or read/write.

https://askubuntu.com/questions/445979/how-to-mount-sd-card-image-created-with-dd

Mount with offset to partition

To avoid the need to create separate images for each partition or installing a utility like kpartx, you can mount each partition individually by specifying an offset in the mount command.
First examine the partitions in the image file and determine the offset by using fdisk:
$ fdisk -u -l rpi_image280914 

Disk rpi_image280914: 16.0 GB, 16012804096 bytes
255 heads, 63 sectors/track, 1946 cylinders, total 31275008 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000cdac7

           Device Boot      Start         End      Blocks   Id  System
rpi_image280914p1   *        2048      514047      256000    c  W95 FAT32 (LBA)
rpi_image280914p2          540672    31242239    15350784   83  Linux
Take the Start sector of the partition you want and multiply that value by the Units size. So if you want the second partition you'll get 540672 * 512 = 276824064.
Now create a folder and mount the partition:
mkdir rpi_partition2
sudo mount -o loop,offset=276824064 rpi_image280914 rpi_partition2/
Once you are done doing what you want with the partition data:
sudo umount rpi_partition2/
rm -r rpi_partition2/

https://www.daniweb.com/hardware-and-software/linux-and-unix/threads/22358/mounting-a-fat32-drive-in-linux

permissions for vfat.

2. Windows doesn't support UNIX-style permissions, and you can only apply permissions to the entire filesystem, not to individual Windows files/folders. This is done with the "umask" option of the mount command. In /etc/fstab, change the mount entry for your Windows partition to this:
/dev/hda6 /mnt/fat vfat users,defaults,umask=000 0 0
(the "users" option allows anyone to mount/unmount the drive and overrides the default , which is that only root is allowed to mount/unmount.)
- When issuing the mount command manually, the syntax is:
mount -t vfat -o umask=000 /dev/hda6 /mnt/fat

The value of the permission bits used with umask are the opposite of those used with the chmod command. For example, the following pairs are equivalent:
umask=000 and chmod 777
umask=022 and chmod 755

--30--

Wednesday, June 5, 2019

Raspberry Pi zero video notes




Mpeg video

MJPG Streamer

To run the camera stream from a USB webcam we'll make use of the package mjpg-streamer. Before we can install this we'll need to install a few dependencies first.
sudo apt-get update
sudo apt-get install libjpeg8-dev imagemagick libv4l-dev uvcdynctrl git cmake -y
After installing the dependencies, run the following commands to install mjpg-streamer.
git clone https://github.com/jacksonliam/mjpg-streamer.git
cd mjpg-streamer/mjpg-streamer-experimental
make USE_LIBV4L2=true clean all
sudo make install
sudo usermod -aG video pi
sudo modprobe bcm2835-v4l2
cd ../../
rm -rf mjpg-streamer
Start the camera livestream by running the following command.
mjpg_streamer -i 'input_uvc.so --device /dev/video0 --fps 30 --resolution VGA --quality 65' -o 'output_http.so'
If you followed all above instructions and everything went ok, you should now be able to see the stream when browsing to http://your-raspberry-pi.local:8080?action=stream. After you verified the stream is working, cancel by running ctrl+c and move on to the next section.

https://wouterdeschuyter.be/blog/how-to-create-a-15-dollar-web-controllable-camera-with-a-raspberry-pi-zero


--30--


Article

https://medium.com/@kevalpatel2106/monitor-the-core-temperature-of-your-raspberry-pi-3ddfdf82989f


#!/usr/bin/python2.7
import os
import time

def measure_temp():
        temp = os.popen("vcgencmd measure_temp").readline()
        return (temp.replace("temp=",""))

while True:
        print(measure_temp())
        time.sleep(1)


Thru a web page using python direct listening

https://raspberrypi.stackexchange.com/questions/8689/how-do-i-display-the-temperature-from-the-internal-sensor-on-a-html-page

install python-tornado

#!/usr/bin/env python

import tornado.ioloop
import tornado.web
import os

class MainHandler(tornado.web.RequestHandler):
    def getCPUtemperature( self ):
        res = os.popen('vcgencmd measure_temp').readline()
        return(res.replace("temp=","").replace("'C\n",""))

    def get(self):
        self.write( "Temperature: %s" % ( self.getCPUtemperature() ) )

application = tornado.web.Application([
    (r"/", MainHandler),
])

if __name__ == "__main__":
    application.listen(8888)
    tornado.ioloop.IOLoop.instance().start()
 

using RRD tool

http://lazydroid.com/2013/05/raspberry-pi-monitoring-cpu-temperature-with-rrdtool/

raw measurement of cpu temp
 
vcgencmd measure_temp
Monitor loop
watch -n 1 vcgencmd measure_temp


 

--30--

Saturday, June 1, 2019

notes on accessing vmware esxi remotely

Notes on monitoring ESXI 6

SSH remote access

  1. Generate public/private keys. For more information, see the OpenBSD Reference Manual section in the OpenBSD.

    Note: The preceding link was valid as of June 22, 2016. If you find the link to be broken, provide feedback on the article and a VMware employee will update the article as necessary.

    Notes:
    • These instructions generate two files in ~/.ssh: id_rsa and id_rsa.pub.
    • In ESXi 5.x, the ssh-keygen command is located at /usr/lib/vmware/openssh/bin.
       
  2. On the remote host, store the public key content, id_rsa.pubin ~/.ssh/authorized_keys.

    Notes:
     
    • For ESXi 5.x, 6.0 and 6.5, the authorized_keys is located at: /etc/ssh/keys-<username>/authorized_keys
    • More than one key can be stored in this file.
       
  3. To allow root access, change PermitRootLogin no to PermitRootLogin yes in the /etc/ssh/sshd_config file.
  4. To disable password login, ensure that the ChallengeResponseAuthentication and PasswordAuthentication are set to no.
  5. Reload the service:
     
    • For ESXi, run the command:

      /etc/init.d/SSH restart
       
    • For ESX, run the command:

      service sshd reload

https://kb.vmware.com/s/article/1002866

Accessing process information (ps command)

https://kb.vmware.com/s/article/1010993

  1. Run the minimalized ps command:
    ps -Tcjstv
    The output shows information such PID, command-line used, and state.
  2. To generate output for certain processes and maintain a title row, run this command:

    ps -Tcjstv | egrep "WID|{proc-name}"
  3. The esxcfg-info command can offer some detail on process memory and CPU and is contained in the vm-support dumps. Process information in esxcfg-info is contained in sections called Groups, but the groups can be cumbersome to sift through.
    Grep these groups for information on process memory and CPU with the command:
    esxcfg-info | egrep -A85 "Group Id" | egrep "Group Name|Group Id|Total CPU|Total Memory|Used Time|Parent Id|----Active\.\.\.\." | less
  4. To check for file-system issues, run this command:

    stat –f {filesystem}

    Note:
    This checks inode use, from which a runaway process can sometimes be determined (even if you do not know exactly what files are involved).
    To check across all filesystems, run this command:

    stat -f `df | grep -v "Filesystem" | awk '{print $6}'` | egrep "File|Inodes"
  5. To view network connection (socket) details, run this command:

    esxcli network connection list
    Note: For ESXi 5.x and later, run this command:

    esxcli network ip connection list


--30--