Skip to content

Instantly share code, notes, and snippets.

@masterzorag
Last active November 8, 2018 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masterzorag/3722d3934a6a04afd38c42e631da4fa9 to your computer and use it in GitHub Desktop.
Save masterzorag/3722d3934a6a04afd38c42e631da4fa9 to your computer and use it in GitHub Desktop.
notes about bootstrapping a Fedora 29 base install

Fedora 29 base install note

0. preamble to test on ps4

  • wired (NOT wireless) ps4 connection to net
  • those files, pinned in #ps4-linux Discord
    • 7e492752a989751b3f3494d24e9e7b28 PS4-4.55-Linux-Loader.bin
    • 5c0b890c30d3b0ce7d81097a9b2c7080 initramfs.cpio.gz
      https://github.com/slashbeast/better-initramfs#parameters
    • a custom cmdline:
      • to pass net parameters to use (dropbear) sshd from initramfs
      • to feed destination rootfs on boot, via partition label

1. manual install

  • windows is not needed
  • dnf will be used: boot Fedora x86_64 in pc/virtualbox/ps4, anywhere it's fine
  • plug your usb and take note about assigned sdX naming
lsblk -f
(from now on, entire target disc will be sdb)

1.0 optional, partition disc

  • whole usb used here, by splitting into just two partitions
parted -a optimal /dev/sdb

(parted) mklabel msdos
(parted) p free
Model: SanDisk Cruzer Edge (scsi)
Disk /dev/sdb: 8003MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start  End     Size    Type  File system  Flags
        1024B  8003MB  8003MB        Free Space

(parted) mkpart pri
File system type?  [ext2]? 
Start? 0%                                                                 
End? 512M
(parted) mkpart pri                                                     
File system type?  [ext2]?                                                
Start? 512M                                                               
End? 100%

(parted) q                                                                
Information: You may need to update /etc/fstab.

1.1 apply filesystems (vfat and ext4)

[root@os4 ~]# mkfs.vfat -f 2 -n ps4boot /dev/sdb1 
mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows

[root@os4 ~]# mkfs.ext4 -L ps4linux /dev/sdb2
mke2fs 1.44.3 (10-July-2018)
Creating filesystem with 1828864 4k blocks and 457856 inodes
Filesystem UUID: 31239142-214f-45dd-b070-7c9d1d1f4f45
...
Writing superblocks and filesystem accounting information: done 
  • check result
sdb 
├─sdb1 vfat   ps4boot                 B83A-37AE                            
└─sdb2 ext4   ps4linux                31239142-214f-45dd-b070-7c9d1d1f4f45 

2 "febootstrap"

2.0 mount

  • mount rootfs destination partition
[root@os4 ~]# mount /dev/sdb2 /mnt/usb/

2.1 base Fedora install

  • dnf comes in handy
[root@os4 ~]# dnf --releasever=29 --installroot=/mnt/usb groupinstall core
...
Total download size: 253 M
Installed size: 1.0 G
Is this ok [y/N]: y
...
Complete!

2.2 setup and chroot into

[root@os4 ~]# cp /etc/resolv.conf /mnt/usb/etc/
[root@os4 ~]# mount -t sysfs none /mnt/usb/sys
[root@os4 ~]# mount -t proc none /mnt/usb/proc
[root@os4 ~]# mount -o bind /dev /mnt/usb/dev
[root@os4 ~]# chroot /mnt/usb /bin/bash

2.3 into chroot

  • final adjustments
passwd
dnf install nano ntpdate nfs-utils
  • add your rootfs mount point, by UUID
[root@ps4 ~]# nano /etc/fstab 
UUID=31239142-214f-45dd-b070-7c9d1d1f4f45  /                       ext4    defaults        1 1
  • disable selinux
nano /etc/selinux/config

2.4 exit and cleanup

exit
umount /mnt/usb/sys
umount /mnt/usb/proc
umount /mnt/usb/dev
umount /mnt/usb

3. prepare ps4boot partition

  • copy needed files into first (vfat) partition
  • adjust cmdline by appending:
    root=LABEL=ps4linux
    will automount newroot by label;
    sshd sshd_wait=10 sshd_port=2020 binit_net_if=eth0 binit_net_addr=10.0.0.24/24 binit_net_gw=10.0.0.2
    will setup remote ssh via autorized_keys to debug headless;

4. boot ps4linux

  • bzImage + initramfs.cpio.gz will be readed from first vfat partition
  • custom cmdline will let change rootfs via LABEL, targeting different partitions

5. customizations

5.1 remote access

  • to remotely access via ssh, you need to place your client public key into authorized_keys file on root of initramfs
  • extract initramfs
mkdir test && cd test
zcat initramfs.cpio.gz | cpio -idmv
  • edit content
  • rebuild initramfs
find . | cpio --quiet -H newc -o | gzip -9 > initramfs.cpio.gz

5.2 chroot

  • we can also repeat passes 2.0, 2.2, 2.4 to chroot into, edit/work, and exit
@masterzorag
Copy link
Author

a

@masterzorag
Copy link
Author

a

@masterzorag
Copy link
Author

after mounting my rootfs partition to /newroot, resume-boot bring up final distro, and we can grow up...
a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment