From: Richard W.M. Jones Date: Sat, 6 Aug 2016 06:51:10 +0000 (+0100) Subject: Add /init script to the stage3 disk. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=2222e64625020ecffca52928660e94afde4426c3;p=fedora-riscv.git Add /init script to the stage3 disk. --- diff --git a/Makefile b/Makefile index 96da1ca..2cc075c 100644 --- a/Makefile +++ b/Makefile @@ -237,6 +237,7 @@ stage3: stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux \ stage3-chroot/etc/fedora-release \ stage3-chroot/lib64/libc.so.6 \ stage3-chroot/bin/bash \ + stage3-chroot/init \ stage3-disk.img stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux: @@ -251,11 +252,13 @@ stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux: git fetch riscv && \ git checkout -f linux-4.1.y-riscv && \ make mrproper && \ - make ARCH=riscv defconfig && \ - make ARCH=riscv \ - CONFIG_CROSS_COMPILE=riscv64-unknown-elf- \ - CONFIG_CMDLINE="root=/dev/htifblk0 init=/bin/bash" \ - vmlinux + make ARCH=riscv defconfig + echo CONFIG_CMDLINE=\"root=/dev/htifblk0 init=/init\" >> stage3-kernel/linux-$(KERNEL_VERSION)/.config + echo CONFIG_CROSS_COMPILE=riscv64-unknown-elf- >> stage3-kernel/linux-$(KERNEL_VERSION)/.config + cd stage3-kernel/linux-$(KERNEL_VERSION) && \ + make ARCH=riscv olddefconfig + cd stage3-kernel/linux-$(KERNEL_VERSION) && \ + make ARCH=riscv vmlinux ls -l $@ # Build an original (x86-64) chroot using supermin. We then aim to @@ -305,6 +308,10 @@ bash-$(BASH_VERSION).tar.gz: wget -O $@-t ftp://ftp.gnu.org/gnu/bash/bash-$(BASH_VERSION).tar.gz mv $@-t $@ +# Create an /init script. +stage3-chroot/init: init.sh + install -m 0755 $^ $@ + # Create the stage3 disk image. # Note `-s +...' adds spare space to the disk image. stage3-disk.img: stage3-chroot diff --git a/init.sh b/init.sh new file mode 100755 index 0000000..f619f30 --- /dev/null +++ b/init.sh @@ -0,0 +1,17 @@ +#!/bin/bash - +# Init script installed in stage3 disk image. + +echo +echo "Welcome to the Fedora/RISC-V stage3 disk image" +echo "https://fedoraproject.org/wiki/Architectures/RISC-V" +echo + +PS1='stage3:\w\$ ' +export PS1 + +# Run bash. +bash -i + +# Sync disks and shut down. +sync +poweroff