An operatable system provides the means for inspecting and operating whatever hardware happens to be available. Therefore, it is always brought to the computer rather than remaining permanently with the computer. By always requiring that separation, it is always apparent how to start over with something else or something new, for using the hardware differently.
On the other hand, a computer can be used to inspect whatever hardware it has attached, however ephemeral the connection. Therefore, a computer can be used for inspecting the hardware of another computer.
Computers are about always working on a copy, so there needs to be a second computer in order to progress beyond the first. When the second computer is stable enough, then use it to modify the first computer.
The storage of a computer is for only the computer, if there is any permanent storage at all. Any computer storage is connected to the computer, likely before turning on, and then disconnected when done.
The Raspberry Pi is a small motherboard with GPIO pins for a basic connection with external devices using wires. It boots from the SD card, and has standard ports for displays and other peripherals, such as HDMI, USB, and ethernet. It also has standard wireless hardware for WiFi and Bluetooth.
It is just a circuit board, and there is no on/off switch on it. Shutdown with a command, either with sudo halt
or sudo shutdown
, or from a menu. The red LED indicates power is on, which shares the translucent window with the green LED indicating activity. The red power LED remains lit after shutdown, any other LEDs should be off. Wait a moment just in case the SD card needs it, then the power can be turned off or unplugged.
The official operating system installer is NOOBS (new out of the box software). It has a copy of the modified Raspbian operating system from the Raspberry Pi Foundation, and offers a selection of other operating systems that it can download instead. NOOBS itself can be installed by basic copy of the files from the decompressed file to a SD card formatted as FAT. Similarly, the NOOBS lite version has only the installer without any systems.
unzip
installer.zip -d /Volumes/destination
The recommended operating system is the version of Raspbian from the Raspberry Pi Foundation, which is based on Raspbian developed by the unaffiliated raspbian.org. Raspbian is based on Debian and has the Raspberry Pi Desktop as its view manager.
Interested in using GRUB with it...
Copying actual operating systems distributed as ISO files is same as usual.
On macOS, use diskutil
list to determine the device identifier of the destination storage (f.e. volume or partition), such as "disk2s1". Then use diskutil
unmount to unmount the partition, or unmountDisk to unmount that disk. Use dd
as usual when copying an ISO file (input file) to the destination storage (output file), then use diskutil
eject before physically removing the storage.
diskutil
list
/dev/disk0 (internal, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *500.3 GB disk0 1: EFI EFI 209.7 MB disk0s1 2: Apple_APFS Container disk1 500.1 GB disk0s2 /dev/disk1 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +500.1 GB disk1 Physical Store disk0s2 1: APFS Volume Mac OS - Data 26.6 GB disk1s1 2: APFS Volume Preboot 81.7 MB disk1s2 3: APFS Volume Recovery 528.5 MB disk1s3 4: APFS Volume VM 2.1 GB disk1s4 5: APFS Volume Mac OS 10.6 GB disk1s5 /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *31.9 GB disk2 1: Windows_NTFS destination 31.9 GB disk2s1
diskutil
unmountDisk disk2
dd
\
diskutil
eject \
Send the INFO signal to the dd
process to get a progress report when taking a long time. (Yet to have that actually work on Catatonia... Seems ignored.)
ps
-o pid,command
PID COMMAND 410 -zsh 1234 dd if=system.iso of=/dev/disk2
kill
-s INFO 1234
It is also possible to copy the image while decompressing, thereby avoiding saving files to the host filesystem (and potential corruption of the files). The images are usually compressed with ZIP, and -p extracts to pipe without messages.
unzip
-p \
dd
\
Or with a variant of GNU, use lsblk
-p to list the devices, and umount
for unmounting, and sync
before disconnecting.
The pi documention suggests using bs for setting a larger block size when writing with dd
will have it write faster, f.e. bs=1m or bs=4m. Also, sudo
might be needed.
Keep in mind macOS will pollute any partition it can read/write with a ".Spotlight-V100/" directory; in this case the NTFS or FAT partitions. There seems to be no interference from that when booting the Raspberry Pi, and afterwards that can be removed easily with sudo rm
-rf. Alternatively, there is no such pollution when using the terminal in recovery mode for a Mac by booting with CommandR.
Default view manager is the Raspberry Pi Desktop, with overlapping views.
The typical half dozen alternate views with F1 to F6 are available by using the Control Alt modifier keys, f.e. ControlAltF2. Default view for view manager is ControlAltF7.
When the Raspbian Lite disk image has been copied to the disk with nothing else, then there is a message at the first-time boot about resizing the partition and rebooting five seconds later.
No view management. Default login is "pi" with "raspberry".
On Debian systems, the keyboard is defined system-wide in "/etc/default/keyboard" and personally in "~/.keyboard". Typically just two variables (one per line): XKBMODEL, XKBLAYOUT. The list of models and layouts are in "/usr/share/X11/xkb/rules/xorg.lst". The manual page for "keyboard" gives more details.
cat
/etc/default/keyboard
Activate the changes by rebooting.
sudo reboot
Or activate the changes for X by using udevadm
.
sudo udevadm trigger
\
Or activate the changes for the console by using setupcon
, perhaps with -k (or --keyboard-only) rather than font and terminals, too.
setupcon
The system-wide console settings are in "/etc/default/console-setup", though it is recommended in the man page to keep keyboard settings in "/etc/default/keyboard". Personal settings are in "~/.console-setup". Specify variants by appending a period "." and name, f.e. "~/.console-setup.another". One variable defined per line in the file. Use setupcon
to activate the changes, or reboot.
By default, ACTIVE_CONSOLES is set to "/dev/tty[1-6]", which gives the typical half dozen alternate views. Contrasted with Raspbian, Raspbian Lite uses AltF1 to AltF6. Default view is AltF1. Optionally, use setupcon
-t (or --terminal-only) to activate the changes for only the terminals.
Available font faces and sizes depend on the CODESET, which itself depends on the CHARMAP. The charmap likely matches the locale, which system-wide has been "UTF-8". The system-wide codeset is typically set to "guess", which for English results in "Lat15". The man page for "console-setup" details the FONTFACE and FONTSIZE options available for each codeset. Optionally, use setupcon
-f (or --font-only) to activate changes for only the font.
Change password with passwd
.
Use update-locale
to modify the setting in "/etc/default/locale". Be mindful of the underscore "_" (separates language and its variant) and the period "." (appends the format).
sudo update-locale
LANG=en_US.UTF-8
Also edit "/etc/locale.gen" and choose the appropriate locale and charmap. Then use sudo locale-gen
to generate the locale files. The setupcon
command has complained about the conflicting locales when only one of these approaches has been applied.
Seems to have correct time already, probably by means of a network time server when connected to the Internet, such as with the ethernet.
The timezone is specified by the symlink "/etc/localtime" to a file in "/usr/share/zoneinfo/", which overrides the contents of the file "/etc/timezone". Changing the symlink to the correct location for the timezone is probably enough.
sudo ln
-fs \
Alternatively, remove the symlink "/etc/localtime" and replace "/etc/timezone" with the names found in "/etc/share/zoneinfo/" directories.
sudo rm
/etc/localtime
sudo echo
US/Eastern > /etc/timezone
Use apt
or apt-get
to install software. List installed software with apt
list --installed, search similarly.
ImageMagick and X are useful for modifying and viewing images, and complement emacs. Otherwise, emacs is enough when no images are involved.
An quick setup with X and whatever versions of ImageMagick and emacs they have on their servers includes first updating the list of software and upgrading the system. The mailutils seems to get installed with emacs as a dependency.
sudo apt
update
sudo apt
full-upgrade
sudo apt
install \
Start X with xinit
and a terminal view is shown by default. Exiting that terminal view (f.e. with Controld) will exit X.
xinit
Without a view manager installed, the pointer needs to be over the terminal view in order for the keyboard to work. Start emacs and it appears on top of the terminal. Use -fs for fullscreen.
emacs
-fs
Or, start X with emacs (full path required) instead of the default terminal view. In that case, exiting emacs will also exit X. Anything after a double hyphen "--" will be options for the X server, such as -nocursor for no pointer.
xinit
/usr/bin/emacs -fs -- -nocursor
The Debian accessibility documentation mentions setxkbmap
can set the numeric keypad for moving the pointer, toggled with Shiftnumlock.
setxkbmap
-option keypad:pointerkeys
Raspbian uses systemd. That is configured by editing text files in "/etc/systemd/system/", or using convenience commands like systemctl
. There are also files in "/lib/systemd/system/", for reference rather than editing.
The "/lib/systemd/system/default.target" needs to be a reference to "multi-user.target" (writing and reading) rather than to "graphical.target" (looking and pointing). Either recreate the link from the correct file to "default.target" with ln
:
sudo ln
-fs \
...or set the default with systemctl
:
sudo systemctl
set-default multi-user.target
The file "/lib/systemd/system/getty@.service" needs to be referenced as "/etc/systemd/system/getty.target.wants/getty@tty1.service". That is the default for both Raspbian and Raspbian Lite. Otherwise, create the symlink.
sudo ln
-fs \
Create or edit the configuration file "/etc/systemd/system/getty@tt1.service.d/autologin.conf". Then reboot. Simply removing this file also disables autologin.
/sbin/agetty
--autologin pi %I $TERM
Install imagemagick for modifying images in general.
For emacs, install mailutils for secure email, texinfo for making documentation with makeinfo
, xorg-dev for compiling with X (and xinit for starting X), libtiff-dev (and other image libraries, because compiling with X), Cairo and HarfBuzz for drawing fonts, gnutls for secure connections, libxml2-dev and librsvg2-dev (optional, for SVG images) for eww.
Need for git for downloading the latest emacs sources from its repository (unless a copy is already available), and autoconf for generating the configure script in the emacs source from the repository.
sudo apt
install \
Configure emacs with mailutils, and maybe --with-imagemagick if version 7 of ImageMagick is available.
./configure
--with-mailutils
Try using -nocursor when starting X, so as to eliminate the mouse cursor.
TinyCore Linux is available for the Raspberry Pi as piCore. The download directories are named as the base version number. In particular, the latest piCore (which is also the beginning for the RPi 4B) can be found in 11.x/, probably armv7 rather than armv6.
The last version tried was "piCore-11.0beta1a", which was a ZIP file containing the IMG file and its MD5 text file. Wrote the IMG to the whole disk in the SD card reader, and there was two partitions afterwards. After inserting SD card into the RPi and turning it on, boot was very quick.
Console, already logged in as "tc", which has no password (though it use to be "piCore"). Screen was drawn beyond boundaries of display, with most of the first character missing at beginning of line; easily adjusted with the buttons on the monitor. A minute or so later a message appeared stating the SSH keys were being generated; another moment later a message stated three keys were made.
Followed instructions in the readme file (from somewhere...).
Save SSH keys.
filetool.sh
-b
Backing up files to /mnt/mmcblk0p2/tce/mydata.tgz/ Done.
mount
for a list of mounted systems. The second partition is "mmcblk0p2".
sudo fdisk
-u /dev/mmcblk0
The number of cylinders for this disk is set to 328073. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS2 FDISK)
p
Disk /dev/mmcblk0: 30 GB, 31914983424 bytes, 62333952 sectors 328073 cylinders, 38 heads, 5 sectors/track Units: sectors of 1 * 512 bytes Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type /dev/mmcblk0p1 43,4,3 1023,37,5 8192 195692 187501 91.5M 6 FAT16 /dev/mmcblk0p2 1023,37,5 1023,37,5 195693 351943 156251 76.2M 83 Linux
Take note of StartLBA for second partition, then delete second partition using d
.
d
Use n
for recreating the second primary partition, likely with its former StartLBA for its first sector. Use a large enough value for the last sector of the partition, or the default value which will likely be for the remainder of disk.
n
e extended p primary partition (1-4)p
Then confirm by inspecting with p
again, then use w
for writing the results. Reboot so the kernel will know.
p
Disk /dev/mmcblk0: 30 GB, 31914983424 bytes, 62333952 sectors 328073 cylinders, 38 heads, 5 sectors/track Units: sectors of 1 * 512 bytes Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type /dev/mmcblk0p1 43,4,3 1023,37,5 8192 195692 187501 91.5M 6 FAT16 /dev/mmcblk0p2 1023,37,5 1023,37,5 195693 62333951 62333951 29.6G 83 Linux
w
The partition table has been altered. Calling ioctl() to re-read partition table fdisk: WARNING: rereading partition table failed, kernel still uses old table: Device or resource busy
sudo reboot
After restarting, expand the file system for the second partition. List available partitions with fdisk
-l.
sudo resize2fs
/dev/mmcblk0p2
resize2fs 1.45.4 (23-Sep-2019) Filesystem at /dev/mmcblk0p2 is mounted on /mnt/mmcblk0p2; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 238 The filesystem on /dev/mmcblk0p2 is now 31069128 (1k) blocks long.
fdisk
-l
Disk /dev/mmcblk0: 30 GB, 31914983424 bytes, 62333952 sectors 328073 cylinders, 38 heads, 5 sectors/track Units: sectors of 1 * 512 bytes Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type /dev/mmcblk0p1 43,4,3 1023,37,5 8192 195692 187501 91.5M 6 FAT16 /dev/mmcblk0p2 1023,37,5 1023,37,5 195693 62333951 62333951 29.6G 83 Linux
Adjust the overscan of the screen, when the monitor is without buttons for that. Might be possible to do this earlier. Must mount the boot directory because it is automatically unmounted after boot. Edit "config.txt" by uncommenting the "overscan" values for top, right, bottom, and left. Unfortunately only vi
is available (which is actually busybox
): arrow keys to move cursor; i to edit text; Esc to stop editing; :w to write changes; :q to quit. Reboot.
sudo mount
/dev/mmcblkp1 /mnt/mmcblkp1
sudo vi
/mnt/mmcblkp1/config.txt
sudo reboot
Unmount partitions with umount
and either the device name or the directory name, both of which are available in the listing from mount
.
sudo umount
/mnt/mmcblk0p1
Chapter 10 of the "Into the Core" book details a few bootcodes for TinyCore. Bootcodes can be added to the "cmdline3.txt" file (for the RPi 4B) on the boot partition. They can be entered on the cmdline before booting (somehow pause it?), too.
Using pause will wait for a key press, likely the Return key. Perhaps this would help get to the boot prompt? Or maybe it pauses after finishing booting?
Other Linux distributions usually have half a dozen consoles available with the F1–F6 keys. TinyCore has only one; the others can be activated with the multivt bootcode.
Use tce
as the package manager for TinyCore extensions. Ethernet is automatically configured and working after plugging in the cord. Search returns results. Choose number to see its info (About), then q to get more options, such as l to see the list of search results again.
Use tce-load
-w for downloading a known extension, or with -i for installing an already available extension. Using -wi will do both, because it is available for installing after downloading.
It is important to be able to create extensions for a custom system because the system is restored at every boot by installing the extensions.
Seems like it is fine to delete the "tce" directory and recreate it; that simply starts over from scratch with nothing extra installed. However, there usually is three packages, including ssh and mc, so they will be gone, too.
Consider installing the GNU "coreutils" so as to bypass the busybox utilities.
There is a "pkg-config" extension. Install at least the following extensions: gcc, binutils-dev (has as
), glibc_base-dev, linux-4.19.y_api_headers, make, libarchive (for bsdtar
; where is GNU tar?). Suspect groff.tcz would have man
, however, that was unavailable for piCore.
Need squashfs-tools for mksquashfs
for making Tiny Core extensions (.tcz), however, the squashfs-tools.tcz extension seems unavailable for piCore. The zlib library is required for building squashfs-tools. Keep in mind, the squashfs-tools distributed by Tiny Core has custom defaults: -b 4k -no-xattrs.
Untar zlib and cd
into its source directory. Very basic configure, with basic build. Install system-wide, because squashfs-tools is unavailable for packaging.
./configure
make
make
check
sudo make
install
Uncertain of a source for official releases. Probably download a copy of the master branch, which might have untested code.
Untar or decompress squashfs-tools and cd
into its source directory. There was no configure, and no check.
Some options for make
need to be adjusted in the "Makefile" itself. Consider commenting out the "XATTR_DEFAULT = 1" so there will be no need to use -no-xattrs. Need to edit the "INSTALL_DIR = /usr/local/bin" value in order to specify the temporary install directory for creating an extension afterwards.
make
make
check
sudo make
install
Now Tiny Core extensions can be made, but remember to use the additional options: -b 4k -no-xattrs. In general, install into a temporary directory, then use mksquashfs
.
For example, package zlib. Start in the zlib source directory.
sudo make
DESTDIR=/tmp/zlib-install install
cd
/tmp
mksquashfs
-b 4k -no-xattrs zlib-install zlib.tcz
Install an extension by copying it to the tce directory and adding its name to the "onboot.lst" file.
mv
zlib.tcz /etc/sysconfig/tcedir/optional
echo
zlib.tcz >> /etc/sysconfig/tcedir/onboot.lst
First compile texinfo for makeinfo
in order to make the documentation for emacs when it is compiled. In addition to the instructions in prequisites for everything for texinfo, it needs perl installed. Package it as an extension with mksquashfs
, remembering to use -no-xattrs if needed.
tce-load
-wi perl5.tcz
./configure
make
make
check
sudo make
DESTDIR=/tmp/texinfo-install install
cd
/tmp
mksquashfs
texinfo-install texinfo.tcz -b 4k
mv
texinfo.tcz /etc/sysconfig/tcedir/optional
echo
texinfo.tcz >> /etc/sysconfig/tcedir/onboot.lst
libunistring (0.9.10 and libunistring-dev), and readline (8.0 and readline-dev) were available from tce. gmp was already installed. nettle (3.5.1 and nettle-dev (has .pc files for pkg-config)) was available from tce.
gnutls was 3.6.10, so build 3.6.11.1 instead, which needs pkg-config (0.29.2 available from tce). Seems to have gotten past all the tests. Created an extension from it, installed it, and rebooted.
./configure
\
make
make
check
sudo make
DESTDIR=/tmp/gnutls-install install
cd
/tmp
mksquashfs
gnutls-install gnutls.tcz -b 4k
mv
gnutls.tcz /etc/sysconfig/tcedir/optional
echo
gnutls.tcz >> /etc/sysconfig/tcedir/onboot.lst
Compile mailutils (3.8). Three tests failed, though all tests were completed. Installing anyway.
./configure
\
make
make
check
sudo make
DESTDIR=/tmp/mailutils-install install
cd
/tmp
mksquashfs
mailutils-install mailutils.tcz -b 4k
mv
mailutils.tcz /etc/sysconfig/tcedir/optional
echo
mailutils.tcz >> /etc/sysconfig/tcedir/onboot.lst
Compile autoconf. It needs m4, which version 1.4.18 is available with tce
.
tce-load
-wi m4.tcz
./configure
make
make
check
sudo make
DESTDIR=/tmp/autoconf-install install
cd
/tmp
mksquashfs
autoconf-install autoconf.tcz -b 4k
mv
autoconf.tcz /etc/sysconfig/tcedir/optional
echo
autoconf.tcz >> /etc/sysconfig/tcedir/onboot.lst
It turns out git is used in autogen.sh scripts, and git needs the files in openssl-dev.tcz extension. Making git complains about not having msgfmt
, which is available from gettext.tcz extension.
Compiling git immediately from its source means skipping configure, as it is already ready to make. However, a make
distclean will require making the configure again (make
configure) and using it before trying to make again. Install within "optional/" without adding it to the "onboot.lst".
tce-load
-wi openssl-dev.tcz gettext.tcz
make
distclean
make
configure
./configure
--without-tcltk
make
sudo make
DESTDIR=/tmp/git-install install
cd
/tmp
mksquashfs
git-install git.tcz -b 4k
mv
git.tcz /etc/sysconfig/tcedir/optional
Need an X environment of sorts, even if only for an alternate HTML viewer, t.i. an additional program installed after emacs. Install Xlibs with tce
; it provides startx
. Lots of dependencies, some already installed. However, probably also need libX11-dev for the emacs configure script to notice X.
Unfortunately, xf86-input-evdev is one of the dependencies and unavailable. Compile and install that before attempting to install the X extensions.
[So far, compiling has failed. Or maybe it was configuring it that failed. Abandoning an X environment for now. Will test out emacs in terminal with piCore, and use Raspbian Lite for X.]
Install the extensions for the X environment.
tce-load
-wi Xlibs.tcz libX11-dev.tcz
Compile emacs. Need to generate the configure script first.
./autogen.sh
./configure
make
make
check
sudo make
DESTDIR=/tmp/emacs-install install
cd
/tmp
mksquashfs
emacs-install emacs.tcz -b 4k
mv
emacs.tcz /etc/sysconfig/tcedir/optional
echo
emacs.tcz >> /etc/sysconfig/tcedir/onboot.lst
Actually...how about going with just the terminal version? Try that out. Can leave out a lot of the extensions, so start fresh.
Ultibo is an approach to creating a kernel from scratch, hence, there is no operating system. Must use Pascal as the programming language, and seems to depend on Lazarus as an IDE for it. Unfortunately, provides a customized version of Lazarus for the MS Windows operating system. Even if the source is available, what needs to be changed before compiling?
Very basic approach. Threads, but no processes. No separation between kernel space and user space. No restrictions, all the hardware is bare bones and available. Sounds great so far, everything that was desired. But Pascal? And an IDE, that is also custom build?
Would like to use emacs for programming. There is likely a Pascal mode, if desired. Would need a Pascal compiler. If that can be set up on one RaspberryPi, then a second RaspberryPI could be used for development with Ultibo. Just a matter of what's on the first: Raspbian Lite with emacs and X, or piCore with just emacs? Hmm, maybe swap back and forth from different SD cards for the first, and at least a third SD card for the second RaspberryPi for development.
Also consider PicoLisp. Track down the website. Is supposedly available with apt
, so might be able to install from Raspberry Lite.