Changes

Jump to: navigation, search

Funtoo Linux Installation on RPI

3,332 bytes added, 2 months ago
Configure the Boot Parameters
This is an extension and amplification of [[Funtoo_Linux_Installation_on_ARM]]. It attempts to systematize and automate as much as possible of steps required to get Funtoo running on the 32 bit ARM Raspberry Pi device.
This is an update of [[Crossdev_Automation]], reflecting the changes needed to accomodate the new kits structure of Funtoo, and to clean up the scripting used for automation. The document will remain available for reference purposes.  
== Installation Overview ==
# [[#Install Binary Kernel, Modules and dtbs]]
# [[#Cross-compile Kernel, Modules and dtbs from Source]]
# [[#Use QEMUTo chroot]]
# [[#Partition and Format an SDCard]]
# [[#Deploy Installation to SDCard]]
# [[#Transfer the SDCard to the Raspberry Pi and RebootBoot]]
# [[#Enjoy!]]
== Get the Bash Script (Or Not) ===== If You Want to Try the Script ===Development code to automate completely the process of installing is available on [https://github.com/d4g33z/sysroot.git github]. The structure of the file {{c|sysroot.sh}} should roughly correspond to the information contained here in this document. The script contains enough functionality to:* get the latest stage3 tarball and verify its integrity* install necessary open and closed source firmware* configure the system: ** modify fstab to make a simple partition structure (no swap)** set a root password interactively** add appropriate services to default run level** set up the software clock** link to accelerated video libraries** set boot parameters* install a kernel ** rpi binary kernel, dtbs, and modules** OR cross compile a kernel, modules and dtbs from source* install QEMU and use binary translation to allow the use of chroot for further tweaking* partition and format an sdcard* copy the bootable configured stage3 to the sdcard
Development code The script is available designed to used on [https://github.com/d4g33z/sysroot.git github]. The structure of a machine that mounts the file {{c|sysroot.sh}} should roughly correspond to sdcard that will be used on the information contained herepi.
Too use the basic install functionality of the script, edit the {{c|config}} file (pay attention to the {{c|SDCARD_DEV}} variable) and then
{{console|body=
###i## source sysroot.sh && sysroot_install
}}
Read the questions carefully and answer yes or no.
 
=== If You Want to Do it Yourself ===
Read the document here and follow the steps, referring {{c|sysroot.sh}} to reassure yourself of the correctness of the installer script.
== Create Your Installation Settings ==
SYSROOT_WORK=/mnt/shared/sysroots
STAGE3_URL=httphttps://ftpbuild.osuoslfuntoo.org/pub/funtoo/funtoo1.3-release-currentstd/arm-32bit/raspi3/2019-01-25/stage3-latestraspi3-1.3-release-std-2019-01-25.tar.xz
CHOST=armv7a-hardfloat-linux-gnueabi
CFLAGS="-O2 -pipe -march=armv7-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard"
INSTALL_VARS=(KERNEL_WORK RPI_KERN_BRANCH SYSROOT_WORK STAGE3_URL CHOST CFLAGS SDCARD_DEV)
}}
 
 
== Install the Stage 3 Tarball ==
Download the current Funtoo stage 3 build appropriate for your Raspberry Pi device. Check the [[Subarches#arm32Raspberry_Pi_(Version_3)]] page, to see the version available for versions 1,2 and 3 of the Pi. Here we download the version for version 3 by setting the STAGE_URL variable in our configuration file.
We need to save the archive to {{c|$STAGE3_ARCHIVE}} and unpack it to {{c|$SYSROOT}}. Back up or remove any previous work in that local.
###i## git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree ${KERNEL_WORK}/firmware-nonfree
###i## git --git-dir=${KERNEL_WORK}/firmware-nonfree/.git --work-tree=${KERNEL_WORK}/firmware-nonfree pull origin
###i## mkdir -p ${SYSROOT}/lib/firmware/brcm###i## cp -r ${KERNEL_WORK}/firmware-nonfree/brcm/brcmfmac43430-sdio.{bin,txt} ${SYSROOT}/lib/firmware/brcm
}}
==== Set Up Mount Points ====
Alter {{c|$SYSROOT/etc/fstab}} as follows. We remove the swap (for now), and alter the storage device name and parition partition file types. We also remove the {{c|/dev/cdrom}} device. {{warning|No swap is configured. If you need to control out of memory conditions (e.g. when compiling chromium) you need to configure a swap parition or use {{Package|sys-block/zram-init}}. A partition must also be created and formatted on the device (probably on the sd card, but usb block memory devices can be used if necessary). }}
{{file|name=$SYSROOT/etc/fstab|body=
==== Set Up Root Password ====
Here we interactively add a root password to log in with to {{c|$XC_STAGE3SSYSROOT/etc/shadow.{{warning|Occasionally this fails due to an unescaped sed control character in the password hash. Just try it until it works, or run the password generation separately from the shadow file editing, or actually fix it.}}.
{{console|body=
###i## sed -i "s/{{!}}root\:\*/{{!}}root\:`(openssl passwd -1)`/{{!}}" $SYSROOT/etc/shadow
}}
 
==== Set Up Networking ====
We add dhcpcd as a default runlevel service.
Let's set up the software clock. This is Raspberry Pi specific, and due to its lack of a stock RTC chipset. This has ramifications for maintaining the correct time via a pacakge like {{Package|net-misc/openntpd}}.
{{console|body=
###i## ln rc-sf /etc/init.d/update add swclock ${SYSROOT}/etc/runlevels/boot###i## rm ${SYSROOT}/etc/runlevels/rc-update del hwclock boot/hwclock
###i## mkdir -p ${SYSROOT}/lib/rc/cache
###i## touch ${SYSROOT}/lib/rc/cache/shutdowntime
}}
 
==== Disable Serial Console Access ====
Let's prevent serial consoles from spawning. If you have a need for this, you'll be able to set it up yourself.
}}
If {{c|/var/log/Xorg.0.log}} is flooded with messages of the following type:
(EE) modeset(0): Failed to get GBM bo for flip to new front.
(EE) modeset(0): present flip failed
the workaround is to disable the {{c|PageFlip}} parameter for the {{c|modesetting}} driver.
 
To do this, as a root user create a file 20-displaylink.conf under /usr/share/X11/xorg.conf.d/ with the following content:
{{file|name=$SYSROOT/usr/share/X11/xorg.conf.d/20-displaylink.conf|body=
 
Section "Device"
Identifier "DisplayLink"
Driver "modesetting"
Option "PageFlip" "false"
EndSection
}}
==== Configure the Boot Parameters ====
{{console|body=
###i## cat > ${SYSROOT}/boot/cmdline.txt << EOF
\##i## dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait\##i## EOF
}}
 
== Install Binary Kernel, Modules and dtbs ==
{{console|body=
}}
== Use QEMU To chroot =={{Package|app-emulation/qemu}} relies upon KVM and the associated kernel module, called either {{c|kvm_intel}} or {{c|kvm_amd}}, depending on the architecture the kernel is running on. Please see [[KVM]] to find out how to get these kernel modules loaded and virtualization working.
=== Install a QEMU Chroot ===
{{Packageconsole|body=###i## echo "app-emulation/qemustatic-user" > /etc/portage/package.use/qemu###i## echo "dev-libs/libpcre static-libs" >> /etc/portage/package.use/qemu###i## echo "sys-apps/attr static-libs" >> /etc/portage/package.use/qemu###i## echo "dev-libs/glib static-libs" >> /etc/portage/package.use/qemu###i## echo "sys-libs/zlib static-libs" >> /etc/portage/package.use/qemu###i## echo "QEMU_SOFTMMU_TARGETS=\"arm\"" >> /etc/portage/make.conf###i## echo "QEMU_SOFTMMU_TARGETS=\"\${QEMU_SOFTMMU_TARGETS}arm\"" >> /etc/portage/make.conf###i## echo 'QEMU_USER_TARGETS="arm"' >> /etc/portage/make.conf###i## echo 'QEMU_USER_TARGETS="${QEMU_USER_TARGETS} relies upon KVM and the associated kernel module, called either arm"' >> /etc/portage/make.conf###i## emerge -q app-emulation/qemu###i## quickpkg app-emulation/qemu###i## ROOT=${{c|kvm_intelSYSROOT}/ emerge -q --usepkgonly --oneshot --nodeps qemu} or {{c|kvm_amd}}, depending on the architecture the kernel is running on. Please
=== Example: Chroot with ARM Emulation===
{{console|body=
###i## source sysroot.sh && sysroot_chroot $SYSROOT_WORK/$CHOST
NOTE: Meta-repo has not yet been cloned, so no kit information is available. Type ego sync to perform an initial
clone of meta-repo.
(chroot) ###i## ego sync
(chroot) ###i## exit
}}
 === Example: Install Run a Shell Script in the ARM Chroot ==={{cconsole|distcc}} with a Script body=###i## cat > /tmp/shell_test.sh << EOF##i## #!/bin/sh##i## ego profile##i## EOF###i## . sysroot.sh && sysroot_run_in_chroot $SYSROOT_WORK/$CHOST /tmp/shell_test.sh=== Enabled Profiles: ===  arch: arm-32bit build: current subarch: raspi3 flavor: core mix-ins: (not set)  === Python kit: ===  branch: 3.4-prime === All inherited flavor from core flavor: ===  minimal (from core flavor)}}
== Partition and Format an SDCard ==
== Deploy Installation to SDCard ==
{{console|body=
###i## mkdir -p /mnt/funtoorpi###i## mount ${SDCARD}2 /mnt/funtoorpi###i## mkdir -p /mnt/funtoorpi/boot###i## mount ${SDCARD}1 /mnt/funtoorpi/boot
###i## rsync --archive \
##i## --verbose \
##i## --progress \
##i## --exclude "var/git/*" \
##i## ${SYSROOT}/{boot,bin,etc,home,lib,mnt,opt,root,run,sbin,srv,tmp,usr,var,dev,proc,sys} \##i## /mnt/funtoo/rpi
###i## umount /mnt/rpi/boot
###i## umount /mnt/rpi
}}
== Transfer the SDCard to the Raspberry Pi and Reboot Boot==
== Enjoy! ==
Bureaucrats, Administrators, wiki-admins, wiki-staff
6,213
edits

Navigation menu