Dev/Embedded/Rootfs/Devuan/FromScratch: Difference between revisions

From Embeded Linux (and more) Wiki by Nathael
< Dev‎ | Embedded‎ | Rootfs
Jump to navigation Jump to search
Line 10: Line 10:


=== Part 2 : on the target ===
=== Part 2 : on the target ===
==== Init= kernel parameter ====
==== Solution 1 : "init=" kernel parameter ====
Add "init=/bin/bash" to your kernel command line (in the bootloader configuration), to get something like this (modify and/or add any required option according to your system) :
Add "init=/bin/bash" to your kernel command line (in the bootloader configuration), to get something like this (modify and/or add any required option according to your system) :
  console=ttyS0,115200n8 root=/dev/mmcblk0p2 rw init=/bin/bash
  console=ttyS0,115200n8 root=/dev/mmcblk0p2 rw init=/bin/bash
Line 19: Line 19:


You should then reboot the board.
You should then reboot the board.
==== Solution 2 : mount on existing system ====
If you've got a running system (any kind of Linux distribution or custom image) for your board and have a solution to mount some external device or remote filesystem on it, then you can use it to run the second stage :
mount /path/to/remote/or/external /mnt/tmp
mount -o bind /proc /mnt/tmp/proc
mount -o bind /sys /mnt/tmp/sys
mount -o bind /dev /mnt/tmp/dev
mount -o bind /dev/pts /mnt/tmp/dev/pts
chroot /mnt/tmp /bin/bash
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/debootstrap/debootstrap --second-stage
And reboot the board once the process has completed.

Revision as of 17:23, 16 October 2019

Using debootstrap

Part 1 : on any computer

Use the following debootstrap command :

debootstrap --foreign --arch=arm64 --include=vim,bsdutils,openssh-client,openssh-server --exclude=ed,nano,tasksel,tasksel-data,vim-tiny --verbose ceres rootfs/ http://fr.deb.devuan.org/merged

You can add some of these (and many more) depending on your needs :

locales,file,net-tools,ca-certificates,bzip2,devuan-keyring,debian-archive-keyring,debian-keyring,diffutils,findutils,iptables,isc-dhcp-client,netbase,ntp,openssh-sftp-server,screen,wireless-tools,minicom

Do not add udev !
It may be possible to add eudev, but somtimes the second stage fails when it is included, so it may be better to add it after the second stage successfully completed (with apt-get install).

Part 2 : on the target

Solution 1 : "init=" kernel parameter

Add "init=/bin/bash" to your kernel command line (in the bootloader configuration), to get something like this (modify and/or add any required option according to your system) :

console=ttyS0,115200n8 root=/dev/mmcblk0p2 rw init=/bin/bash

And once you get the prompt, execute the end of the installation :

export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/debootstrap/debootstrap --second-stage

You should then reboot the board.

Solution 2 : mount on existing system

If you've got a running system (any kind of Linux distribution or custom image) for your board and have a solution to mount some external device or remote filesystem on it, then you can use it to run the second stage :

mount /path/to/remote/or/external /mnt/tmp
mount -o bind /proc /mnt/tmp/proc
mount -o bind /sys /mnt/tmp/sys
mount -o bind /dev /mnt/tmp/dev
mount -o bind /dev/pts /mnt/tmp/dev/pts
chroot /mnt/tmp /bin/bash
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/debootstrap/debootstrap --second-stage

And reboot the board once the process has completed.