# Installing PsychOS ## From OpenOS ### Requirements In general: - oppm - mtar For installing to an unmanaged drive or tape - slicer - partman - rtfs - boopu There are two easy methods to get these packages. 1. With oppm, if available, you can run `oppm install mtar partman rtfs boopu`. 2. You can use the `obootstrap.lua` script to set up a temporary environment for installing PsychOS. This can even be used from the OpenOS installer disk. ``` # wget https://git.shadowkat.net/izaya/OC-PsychOS2/raw/branch/master/obootstrap.lua /tmp/obootstrap.lua # /tmp/obootstrap.lua ``` ### Preparing the target disk #### Managed filesystem Preparing a managed filesystem is extremely simple: attach it to your computer, and make sure there's nothing that you want to keep in the following locations on the filesystem: - init.lua - lib/ - service/ - doc/ - pkg/ - cfg/ #### Unmanaged drive or tape ##### Creating partitions First, you'll need to find out how many sectors your target device has. `slicer show` will show you something like this: ``` # slicer 9f7 show Drive 9f755736 - 1024KiB, 2048 sectors: # Name Type Start Len End ``` The usable space on the disk is going to be two sectors less than the total size - sectors 2 through 2047, in this case, as you will want to leave space for the OSDI partition table at the start, and the MTPT partition table at the end. First, we'll create the boot partition. 64KiB is the recommended size, though 48KiB may be enough. OC disks use 512 byte sectors, so that will work out to 128 sectors. ``` # slicer 9f7 add init.lua boot 2 128 Drive 9f755736 - 1024KiB, 2048 sectors: # Name Type Start Len End 1: 9f755736 mtpt 0 0 -1 2: init.lua boot 2 128 129 ``` Next, we need to create an rtfs partition, for the boot filesystem. This can use the rest of the space on the disk, but should be named `-boot`. ``` # slicer 9f7 add ffa5c282-boot rtfs 130 1918 Drive 9f755736 - 1024KiB, 2048 sectors: # Name Type Start Len End 1: 9f755736 mtpt 0 0 -1 2: init.lua boot 2 128 129 3: ffa5c282-boot rtfs 130 1918 2047 ``` Once you're all done, you can restart partman and it should recognise the new partitions. ``` # rc partman restart # components part partition 9f755736-a739-4f45-8c5c-35a66a7f5dbe/2 ``` ##### Formatting the filesystem Next, we'll use the mkfs.rtfs utility to format the filesystem partition we just created. Do note that the order of components is not fixed, so using a shortened version can result in unreliable behavior, like, for example, formatting the boot partition. ``` # mkfs.rtfs 9f755736-a739-4f45-8c5c-35a66a7f5dbe/2 ffa5c282-boot 9f755736-a739-4f45-8c5c-35a66a7f5dbe/2 ``` To make OpenOS mount the filesystem, the simplest way is to restart partman again, as described in the previous section.