Merge pull request #1 from MartijnBraam/master

Fix build, cleanup and nice branding
This commit is contained in:
Asriel Dreemurr 2020-03-17 01:29:48 +07:00 committed by GitHub
commit f6e34e5f67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 122 additions and 100 deletions

13
.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
/Image.gz
/fat.img
/jumpdrive.img
/jumpdrive.img.xz
/u-boot-sunxi-with-spl.bin
/*.apk
/initramfs.gz
/initramfs.cpio
/initramfs/bin/busybox
/initramfs/splash.ppm.gz
/build
/boot.scr
/*.dtb

74
Makefile Normal file
View File

@ -0,0 +1,74 @@
CROSS_FLAGS = ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
all: jumpdrive.img.xz
jumpdrive.img.xz: jumpdrive.img
xz -c jumpdrive.img > jumpdrive.img.xz
initramfs/bin/busybox: src/busybox src/busybox_config
mkdir -p build/busybox
cp src/busybox_config build/busybox/.config
make -C src/busybox O=../../build/busybox $(CROSS_FLAGS)
cp build/busybox/busybox initramfs/bin/busybox
initramfs/splash.ppm.gz: splash/jumpdrive.ppm
gzip < splash/jumpdrive.ppm > initramfs/splash.ppm.gz
initramfs.cpio: initramfs/bin/busybox initramfs/init initramfs/init_functions.sh initramfs/splash.ppm.gz
cd initramfs; find . | cpio -H newc -o > ../initramfs.cpio
initramfs.gz: initramfs.cpio
gzip < initramfs.cpio > initramfs.gz
Image.gz: src/linux_config
mkdir -p build/linux
cp src/linux_config build/linux/.config
make -C src/linux O=../../build/linux $(CROSS_FLAGS) olddefconfig
make -C src/linux O=../../build/linux $(CROSS_FLAGS)
cp build/linux/arch/arm64/boot/Image.gz Image.gz
cp build/linux/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtb sun50i-a64-pinephone.dtb
jumpdrive.img: fat.img u-boot-sunxi-with-spl.bin
rm -f jumpdrive.img
truncate --size 50M jumpdrive.img
parted -s jumpdrive.img mktable msdos
parted -s jumpdrive.img mkpart primary fat32 2048s 100%
parted -s jumpdrive.img set 1 boot on
dd if=u-boot-sunxi-with-spl.bin of=jumpdrive.img bs=8k seek=1
dd if=fat.img of=jumpdrive.img seek=1024 bs=1k
boot.scr: src/boot.txt
mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d src/boot.txt boot.scr
u-boot-sunxi-with-spl.bin:
wget http://dl-cdn.alpinelinux.org/alpine/edge/main/aarch64/u-boot-pine64-2020.01-r0.apk
tar -xvf u-boot-pine64-2020.01-r0.apk usr/share/u-boot/pine64-lts/u-boot-sunxi-with-spl.bin --strip-components 4
fat.img: initramfs.gz Image.gz boot.scr
rm -f fat.img
truncate --size 40M fat.img
mkfs.fat -F32 fat.img
mcopy -i fat.img Image.gz ::Image.gz
mcopy -i fat.img sun50i-a64-pinephone.dtb ::sun50i-a64-pinephone.dtb
mcopy -i fat.img initramfs.gz ::initramfs.gz
mcopy -i fat.img boot.scr ::boot.scr
.PHONY: clean
clean:
rm -rf build
rm -f initramfs/bin/busybox
rm -f fat.img
rm -f jumpdrive.img
rm -f jumpdrive.img.xz
rm -f *.dtb
rm -f u-boot-pine64-2020.01-r0.apk
rm -f u-boot-sunxi-with-spl.bin
rm -f initramfs/splash.ppm.gz
rm -f initramfs/bin/busybox
rm -f initramfs.cpio
rm -f initramfs.gz
rm -f Image.gz
rm -f boot.scr

View File

@ -6,9 +6,16 @@ You can use this to flash a image **directly to eMMC**, troubleshooting a broken
## This project is built on:
- [Busybox](https://busybox.net) - which is [GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html).
- [postmarketOS](https://postmarketos.org) scripts - which is [GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html).
- [Pine64's kernel fork](https://gitlab.com/pine64-org/linux) - which is [GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html).
- [U-Boot](https://github.com/u-boot/u-boot) - which has [multiple licenses](https://github.com/u-boot/u-boot/tree/master/Licenses)
## Support
- Discord: https://discord.gg/AvtdRJ3
- Matrix: #danctnix-portingv2:matrix.org
## Building
Run `make` inside this directory and it will build jumpdrive.img.xz that can be flashed to SD.
The dependencies are:
- aarch64-linux-gnu- toolchain
- u-boot tools
- mtools

View File

@ -1,64 +0,0 @@
#!/bin/sh
# EDIT THIS:
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
IMAGE_NAME="pinephone-sdrescue.img"
# Cleanup first
rm -rf src/busybox/out
rm -rf src/linux/out
rm -rf usr
# Build Busybox
cd src/busybox
mkdir out
cp ../busybox_config out/.config
make O=out -j$(nproc --all)
cd ../..
# Build Linux Kernel
cd src/linux
mkdir out
patch -p1 -N < ../linux-disable_sysrq-msgs.diff || true
cp ../linux_config out/.config
make O=out -j$(nproc --all)
cd ../..
# Make initramfs
sudo cp -v src/busybox/out/busybox initramfs/bin/
cd initramfs
find . | cpio -H newc -o > ../initramfs.cpio
cd ..
cat initramfs.cpio | gzip > recovery.gz
# Create image
truncate --size 50M $IMAGE_NAME
cat << EOF | fdisk pinephone-sdrescue.img
o
n
p
1
2048
102399
w
EOF
LOOP_DEVICE=$(losetup -f)
sudo losetup -P $LOOP_DEVICE $IMAGE_NAME
sudo mkfs.fat -F32 ${LOOP_DEVICE}p1
mkdir mount
sudo mount ${LOOP_DEVICE}p1 mount
sudo cp -v src/linux/out/arch/arm64/boot/Image.gz mount
sudo cp -v src/linux/out/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtb mount
sudo cp -v recovery.gz mount
sudo mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d src/boot.txt mount/boot.scr
sudo umount mount
rm -rf mount
wget http://dl-cdn.alpinelinux.org/alpine/edge/main/aarch64/u-boot-pine64-2020.01-r0.apk
tar xvf u-boot-pine64-2020.01-r0.apk
sudo dd if=usr/share/u-boot/pine64-lts/u-boot-sunxi-with-spl.bin of=${LOOP_DEVICE} bs=8k seek=1
sudo losetup -d $LOOP_DEVICE

View File

@ -1,15 +1,25 @@
#!/bin/sh
## Init script for JumpDrive
## Copyright (C) 2020 - postmarketOS
## Copyright (C) 2020 - Danctl12 <danct12@disroot.org>
################################################
# Copyright (c) 2020 - Dreemurrs Embedded Labs #
################################################
echo "Welcome to JumpDrive"
. /init_functions.sh
# Environment variables that we want:
IP=172.16.42.1
# Create all the symlinks to /bin/busybox
mkdir -p /usr/bin
mkdir -p /sbin
mkdir -p /usr/sbin
echo "Installing Busybox..." && /bin/busybox --install -s
# Mount things needed by this script
mkdir /proc
mkdir /sys
mkdir /etc
mount -t proc proc /proc
mount -t sysfs sysfs /sys
@ -20,11 +30,10 @@ mount -t configfs -o nodev,noexec,nosuid configfs /config
mkdir -p /dev/pts
mount -t devpts devpts /dev/pts
# LED indicator for MMC r/w access
# Amber LED indicator for MMC r/w access
echo mmc2 > /sys/class/leds/pinephone\:green\:user/trigger
echo mmc2 > /sys/class/leds/pinephone\:red\:user/trigger
# Create all the symlinks to /bin/busybox
echo "Installing Busybox..." && /bin/busybox --install -s
# Create device nodes
echo "Creating device nodes..."
@ -37,12 +46,7 @@ setup_usb_configfs
start_udhcpd
setup_telnetd
# We'll just give some new lines cuz why not.
printf "\n\n"
echo "Rescue SD has initialized!"
echo "Please connect the device to your computer."
echo
echo "* Telnet: $IP (port 23)"
gzip -c -d splash.ppm.gz > /splash.ppm
fbsplash -s /splash.ppm
loop_forever

View File

@ -8,9 +8,9 @@ setup_usb_configfs() {
fi
# Default values for USB-related deviceinfo variables
usb_idVendor="0x1F3A"
usb_idProduct="0xEFE8"
usb_serialnumber="Rescue SD Boot"
usb_idVendor="0x1209" # Generic
usb_idProduct="0x4201" # Random ID
usb_serialnumber="Jumpdrive"
usb_rndis_function="rndis.usb0"
usb_mass_storage_function="mass_storage.0"
@ -45,8 +45,7 @@ setup_usb_configfs() {
# Make sure there is a mmcblk2 (eMMC)...
if [ -z "$(ls /dev/mmcblk2)" ]; then
echo "eMMC is not found, something is horribly wrong!!"
echo "It's probably better to make Huong Tram release a new music video."
echo "/dev/mmcblk2 could not be opened, possible eMMC defect"
crash_kernel
fi
@ -61,8 +60,7 @@ setup_usb_configfs() {
# Check if there's an USB Device Controller
if [ -z "$(ls /sys/class/udc)" ]; then
echo "No USB Device Controller available, something is horribly wrong!!"
echo "Please let Danct12 know this."
echo "No USB Device Controller available"
crash_kernel
fi

BIN
splash/jumpdrive.ppm Normal file

Binary file not shown.

BIN
splash/jumpdrive.xcf Normal file

Binary file not shown.

View File

@ -2,10 +2,12 @@ setenv kernel_addr_z 0x44080000
setenv bootargs loglevel=0 silent console=tty0
gpio set 114
if load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_z} /Image.gz; then
unzip ${kernel_addr_z} ${kernel_addr_r}
if load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} /sun50i-a64-pinephone.dtb; then
if load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /recovery.gz; then
if load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /initramfs.gz; then
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
else
booti ${kernel_addr_r} - ${fdt_addr_r};

View File

@ -1,12 +0,0 @@
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 573b20551..42b040d16 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -551,7 +551,6 @@ void __handle_sysrq(int key, bool check_mask)
* should not) and is the invoked operation enabled?
*/
if (!check_mask || sysrq_on_mask(op_p->enable_mask)) {
- pr_info("%s\n", op_p->action_msg);
console_loglevel = orig_log_level;
op_p->handler(key);
} else {