Made Pineloader public, clean up is still required

Signed-off-by: Danct12 <danct12@dreemurrs.local>
This commit is contained in:
Danct12 2020-05-19 01:18:07 +07:00
commit 069c00a3a0
24 changed files with 11018 additions and 0 deletions

17
.gitignore vendored Normal file
View File

@ -0,0 +1,17 @@
/*.img
/*.apk
/initramfs/bin/busybox
/initramfs-*
/build
/dtbs
/src/linux-rockchip
/src/u-boot
/src/arm-trusted-firmware
/src/kexec-tools
/src/bash
/*.scr
/*.dtb
/*.img.xz
/*.gz
/*.bin
/*.tar.bz2

339
LICENSE Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

159
Makefile Normal file
View File

@ -0,0 +1,159 @@
CROSS_FLAGS = ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
CROSS_FLAGS_BOOT = CROSS_COMPILE=aarch64-linux-gnu-
all: pine64-pinephone.img.xz pine64-pinetab.img.xz
pine64-pinephone.img: fat-pine64-pinephone.img u-boot-sunxi-with-spl.bin
rm -f $@
truncate --size 50M $@
parted -s $@ mktable msdos
parted -s $@ mkpart primary fat32 2048s 100%
parted -s $@ set 1 boot on
dd if=u-boot-sunxi-with-spl.bin of=$@ bs=8k seek=1
dd if=fat-$@ of=$@ seek=1024 bs=1k
fat-pine64-pinephone.img: initramfs-pine64-pinephone.gz kernel-sunxi.gz pine64-pinephone.scr dtbs/sunxi/sun50i-a64-pinephone-1.0.dtb
@echo "MKFS $@"
@rm -f $@
@truncate --size 40M $@
@mkfs.fat -F32 $@
@mcopy -i $@ kernel-sunxi.gz ::Image.gz
@mcopy -i $@ dtbs/sunxi/sun50i-a64-pinephone-1.0.dtb ::sun50i-a64-pinephone-1.0.dtb
@mcopy -i $@ initramfs-pine64-pinephone.gz ::initramfs.gz
@mcopy -i $@ pine64-pinephone.scr ::boot.scr
pine64-pinetab.img: fat-pine64-pinetab.img u-boot-sunxi-with-spl.bin
rm -f $@
truncate --size 50M $@
parted -s $@ mktable msdos
parted -s $@ mkpart primary fat32 2048s 100%
parted -s $@ set 1 boot on
dd if=u-boot-sunxi-with-spl.bin of=$@ bs=8k seek=1
dd if=fat-$@ of=$@ seek=1024 bs=1k
fat-pine64-pinetab.img: initramfs-pine64-pinetab.gz kernel-sunxi.gz pine64-pinetab.scr dtbs/sunxi/sun50i-a64-pinetab.dtb
@echo "MKFS $@"
@rm -f $@
@truncate --size 40M $@
@mkfs.fat -F32 $@
@mcopy -i $@ kernel-sunxi.gz ::Image.gz
@mcopy -i $@ dtbs/sunxi/sun50i-a64-pinetab.dtb ::sun50i-a64-pinetab.dtb
@mcopy -i $@ initramfs-pine64-pinetab.gz ::initramfs.gz
@mcopy -i $@ pine64-pinetab.scr ::boot.scr
%.img.xz: %.img
@echo "XZ $@"
@xz -c $< > $@
initramfs/bin/busybox: src/busybox src/busybox_config
@echo "MAKE $@"
@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/bin/bash: src/bash
@echo "MAKE $@"
@mkdir -p build/bash
@cd build/bash;\
../../src/bash/configure --host=aarch64-linux-gnu --enable-static-link --without-bash-malloc
@$(MAKE) -C build/bash
@aarch64-linux-gnu-strip build/bash/bash
@upx --best build/bash/bash
@cp build/bash/bash initramfs/bin/bash
initramfs/bin/kexec: src/kexec-tools
@echo "MAKE $@"
@mkdir -p build/kexec-tools
@cd src/kexec-tools;./bootstrap
@cd build/kexec-tools;\
LDFLAGS=-static ../../src/kexec-tools/configure --host=aarch64-linux-gnu
@$(MAKE) -C build/kexec-tools
@aarch64-linux-gnu-strip build/kexec-tools/build/sbin/kexec
@cp build/kexec-tools/build/sbin/kexec initramfs/bin/kexec
initramfs-%.cpio: initramfs/bin/busybox initramfs/bin/bash initramfs/bin/kexec initramfs/init initramfs/init_functions.sh initramfs/pineloader
@echo "CPIO $@"
@rm -rf initramfs-$*
@cp -r initramfs initramfs-$*
@cp src/info-$*.sh initramfs-$*/info.sh
@cp src/info-$*.sh initramfs-$*/info.sh
@cd initramfs-$*; find . | cpio -H newc -o > ../$@
initramfs-%.gz: initramfs-%.cpio
@echo "GZ $@"
@gzip < $< > $@
kernel-sunxi.gz dtbs/sunxi/sun50i-a64-pinephone-1.0.dtb dtbs/sunxi/sun50i-a64-pinetab.dtb &: src/linux_config_sunxi
@echo "MAKE kernel-sunxi.gz"
@mkdir -p build/linux-sunxi
@mkdir -p dtbs/sunxi
@cp src/linux_config_sunxi build/linux-sunxi/.config
@$(MAKE) -C src/linux O=../../build/linux-sunxi $(CROSS_FLAGS) olddefconfig
@$(MAKE) -C src/linux O=../../build/linux-sunxi $(CROSS_FLAGS)
@cp build/linux-sunxi/arch/arm64/boot/Image.gz kernel-sunxi.gz
@cp build/linux-sunxi/arch/arm64/boot/dts/allwinner/*.dtb dtbs/sunxi/
%.scr: src/%.txt
@echo "MKIMG $@"
@mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d $< $@
build/atf/sun50i_a64/bl31.bin: src/arm-trusted-firmware
@echo "MAKE $@"
@mkdir -p build/atf/sun50i_a64
@cd src/arm-trusted-firmware; make $(CROSS_FLAGS_BOOT) PLAT=sun50i_a64 bl31
@cp src/arm-trusted-firmware/build/sun50i_a64/release/bl31.bin "$@"
u-boot-sunxi-with-spl.bin: build/atf/sun50i_a64/bl31.bin src/u-boot
@echo "MAKE $@"
@mkdir -p build/u-boot/sun50i_a64
@BL31=../../../build/atf/sun50i_a64/bl31.bin $(MAKE) -C src/u-boot O=../../build/u-boot/sun50i_a64 $(CROSS_FLAGS_BOOT) pinephone_defconfig
@BL31=../../../build/atf/sun50i_a64/bl31.bin $(MAKE) -C src/u-boot O=../../build/u-boot/sun50i_a64 $(CROSS_FLAGS_BOOT) ARCH=arm all
@cp build/u-boot/sun50i_a64/u-boot-sunxi-with-spl.bin "$@"
src/bash:
@echo "WGET bash"
@mkdir src/bash
@wget http://git.savannah.gnu.org/cgit/bash.git/snapshot/bash-5.0.tar.gz
@tar -xvf bash-5.0.tar.gz --strip-components 1 -C src/bash
src/kexec-tools:
@echo "WGET kexec-tools"
@mkdir src/kexec-tools
@wget https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/snapshot/kexec-tools-2.0.20.tar.gz
@tar -xvf kexec-tools-2.0.20.tar.gz --strip-components 1 -C src/kexec-tools
src/arm-trusted-firmware:
@echo "WGET arm-trusted-firmware"
@mkdir src/arm-trusted-firmware
@wget https://github.com/ARM-software/arm-trusted-firmware/archive/50d8cf26dc57bb453b1a52be646140bfea4aa591.tar.gz
@tar -xvf 50d8cf26dc57bb453b1a52be646140bfea4aa591.tar.gz --strip-components 1 -C src/arm-trusted-firmware
src/u-boot:
@echo "WGET u-boot"
@mkdir src/u-boot
@wget ftp://ftp.denx.de/pub/u-boot/u-boot-2020.04.tar.bz2
@tar -xvf u-boot-2020.04.tar.bz2 --strip-components 1 -C src/u-boot
@cd src/u-boot && patch -p1 < ../u-boot-pinephone.patch
.PHONY: clean cleanfast
cleanfast:
@rm -rvf build
@rm -rvf initramfs-*/
@rm -vf *.img
@rm -vf *.img.xz
@rm -vf *.apk
@rm -vf *.bin
@rm -vf *.cpio
@rm -vf *.gz
@rm -vf *.scr
clean: cleanfast
@rm -vf kernel*.gz
@rm -vf initramfs/bin/busybox
@rm -vrf dtbs

3
README.md Normal file
View File

@ -0,0 +1,3 @@
Pineloader is a multi-bootloader written in bash and uses kexec system call.
Currently the script is quite messy, so this has to be clean up, and we'll also have to make it easier to use.

BIN
initramfs/bin/bash Executable file

Binary file not shown.

1
initramfs/bin/clear Symbolic link
View File

@ -0,0 +1 @@
busybox

BIN
initramfs/bin/kexec Executable file

Binary file not shown.

1
initramfs/bin/mkdir Symbolic link
View File

@ -0,0 +1 @@
busybox

1
initramfs/bin/mount Symbolic link
View File

@ -0,0 +1 @@
busybox

1
initramfs/bin/sh Symbolic link
View File

@ -0,0 +1 @@
busybox

66
initramfs/init Executable file
View File

@ -0,0 +1,66 @@
#!/bin/sh
## SPDX-License-Identifier: GPL-2.0-only
## Init script for PineLoader
## Copyright (C) 2020 - postmarketOS
## Copyright (C) 2020 - Dreemurrs Embedded Labs / DanctNIX
echo "Welcome to PineLoader"
. /info.sh
echo "Running on $PLATFORM"
. /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
mkdir /mnt
mkdir /plr
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mkdir /config
mount -t configfs -o nodev,noexec,nosuid configfs /config
# /dev/pts (needed for telnet)
mkdir -p /dev/pts
mount -t devpts devpts /dev/pts
# LED indicator for MMC r/w access
if [ -n "$LED" ]; then
echo $TRIGGER > /sys/class/leds/$LED/trigger
fi
# Create device nodes
echo "Creating device nodes..."
mknod /dev/null c 1 3
mknod /dev/tty c 5 0
mdev -s
# Set kmap to volume buttons and power
loadkmap < /vol.bmap
# Final steps before running the bootloader..
mount_boot_partition
# This is the reason why you should always do FDE.
# Nothing is secure, ever.
setup_usb_configfs
start_udhcpd
setup_telnetd
/pineloader
# Don't kernel panic just in case if the pineloader script crashes
loop_forever

152
initramfs/init_functions.sh Executable file
View File

@ -0,0 +1,152 @@
## SPDX-License-Identifier: GPL-2.0-only
## Init functions for PineLoader
## Copyright (C) 2020 - postmarketOS
## Copyright (C) 2020 - Dreemurrs Embedded Labs / DanctNIX
setup_usb_configfs() {
# See: https://www.kernel.org/doc/Documentation/usb/gadget_configfs.txt
CONFIGFS=/config/usb_gadget
if ! [ -e "$CONFIGFS" ]; then
fatal_error "$CONFIGFS does not exist"
fi
# Default values for USB-related deviceinfo variables
usb_idVendor="0x1209" # Generic
usb_idProduct="0x4201" # Random ID
usb_serialnumber="Pineloader"
usb_rndis_function="rndis.usb0"
usb_mass_storage_function="mass_storage.0"
echo "Setting up an USB gadget through configfs..."
# Create an usb gadet configuration
mkdir $CONFIGFS/g1 || ( fatal_error "Couldn't create $CONFIGFS/g1" )
echo "$usb_idVendor" > "$CONFIGFS/g1/idVendor"
echo "$usb_idProduct" > "$CONFIGFS/g1/idProduct"
# Create english (0x409) strings
mkdir $CONFIGFS/g1/strings/0x409 || echo " Couldn't create $CONFIGFS/g1/strings/0x409"
# shellcheck disable=SC2154
echo "Pine64" > "$CONFIGFS/g1/strings/0x409/manufacturer"
echo "$usb_serialnumber" > "$CONFIGFS/g1/strings/0x409/serialnumber"
# shellcheck disable=SC2154
echo "PinePhone" > "$CONFIGFS/g1/strings/0x409/product"
# Create rndis/mass_storage function
mkdir $CONFIGFS/g1/functions/"$usb_rndis_function" \
|| echo " Couldn't create $CONFIGFS/g1/functions/$usb_rndis_function"
mkdir $CONFIGFS/g1/functions/"$usb_mass_storage_function" \
|| echo " Couldn't create $CONFIGFS/g1/functions/$usb_mass_storage_function"
mkdir $CONFIGFS/g1/functions/"$usb_mass_storage_function/lun.1" \
|| echo " Couldn't create $CONFIGFS/g1/functions/$usb_mass_storage_function/lun.1"
# Create configuration instance for the gadget
mkdir $CONFIGFS/g1/configs/c.1 \
|| echo " Couldn't create $CONFIGFS/g1/configs/c.1"
mkdir $CONFIGFS/g1/configs/c.1/strings/0x409 \
|| echo " Couldn't create $CONFIGFS/g1/configs/c.1/strings/0x409"
echo "rndis" > $CONFIGFS/g1/configs/c.1/strings/0x409/configuration \
|| echo " Couldn't write configration name"
# Make sure the node for the eMMC exists
if [ -z "$(ls $EMMC)" ]; then
fatal_error "$EMMC could not be opened, possible eMMC defect"
fi
# Set up mass storage to internal EMMC
echo $EMMC > $CONFIGFS/g1/functions/"$usb_mass_storage_function"/lun.0/file
echo $SD > $CONFIGFS/g1/functions/"$usb_mass_storage_function"/lun.1/file
# Rename the mass storage device
echo "JumpDrive eMMC" > $CONFIGFS/g1/functions/"$usb_mass_storage_function"/lun.0/inquiry_string
echo "JumpDrive microSD" > $CONFIGFS/g1/functions/"$usb_mass_storage_function"/lun.1/inquiry_string
# Link the rndis/mass_storage instance to the configuration
ln -s $CONFIGFS/g1/functions/"$usb_rndis_function" $CONFIGFS/g1/configs/c.1 \
|| echo " Couldn't symlink $usb_rndis_function"
ln -s $CONFIGFS/g1/functions/"$usb_mass_storage_function" $CONFIGFS/g1/configs/c.1 \
|| echo " Couldn't symlink $usb_mass_storage_function"
# Check if there's an USB Device Controller
if [ -z "$(ls /sys/class/udc)" ]; then
fatal_error "No USB Device Controller available"
fi
# shellcheck disable=SC2005
echo "$(ls /sys/class/udc)" > $CONFIGFS/g1/UDC || ( fatal_error "Couldn't write to UDC" )
}
setup_telnetd() {
echo "Starting telnet daemon..."
{
echo "#!/bin/sh"
echo "echo \"Welcome to Rescue SD Shell!\""
echo "sh"
} >/telnet_connect.sh
chmod +x /telnet_connect.sh
telnetd -b "${IP}:23" -l /telnet_connect.sh
}
start_udhcpd() {
# Only run once
[ -e /etc/udhcpd.conf ] && return
# Get usb interface
INTERFACE=""
ifconfig rndis0 "$IP" 2>/dev/null && INTERFACE=rndis0
if [ -z $INTERFACE ]; then
ifconfig usb0 "$IP" 2>/dev/null && INTERFACE=usb0
fi
if [ -z $INTERFACE ]; then
ifconfig eth0 "$IP" 2>/dev/null && INTERFACE=eth0
fi
if [ -z $INTERFACE ]; then
echo "Could not find an interface to run a DHCP server on, this is not good."
echo "Interfaces:"
ip link
return
fi
echo "Network interface $INTERFACE is used"
# Create /etc/udhcpd.conf
{
echo "start 172.16.42.2"
echo "end 172.16.42.2"
echo "auto_time 0"
echo "decline_time 0"
echo "conflict_time 0"
echo "lease_file /var/udhcpd.leases"
echo "interface $INTERFACE"
echo "option subnet 255.255.255.0"
} >/etc/udhcpd.conf
echo "Started udhcpd daemon for rescue purposes"
udhcpd
}
fatal_error() {
clear
# Print the error message
echo " $1"
}
loop_forever() {
while true; do
sleep 1
done
}
mount_boot_partition() {
partition=$(findfs LABEL="PINELOADER")
if [ -z "$partition" ]; then
echo "ERROR: Bootloader partition not found! Starting Jumpdrive.."
start_jumpdrive
fi
echo "Mount boot partition ($partition)"
mount -r "$partition" /plr
}

113
initramfs/pineloader Executable file
View File

@ -0,0 +1,113 @@
#!/usr/bin/env bash
## SPDX-License-Identifier: GPL-2.0-only
## Copyright (C) 2020 - Dreemurrs Embedded Labs / DanctNIX
# Clear screen
clear
declare -A config
if [ ! -f /plr/config-plr.cfg ] ; then
echo "Pineloader config not found! Please debug the issue via telnet"
echo "$IP"
loop_forever
else
. /plr/config-plr.cfg
fi
# Renders a text based list of options that can be selected by the
# user using up, down and enter keys and returns the chosen option.
#
# Arguments : list of options, maximum of 256
# "opt1" "opt2" ...
# Return value: selected index (0 for opt1, 1 for opt2 ...)
function select_option {
# little helpers for terminal print control and key input
ESC=$( printf "\033")
cursor_blink_on() { printf "$ESC[?25h"; }
cursor_blink_off() { printf "$ESC[?25l"; }
cursor_to() { printf "$ESC[$1;${2:-1}H"; }
print_option() { printf " $1 "; }
print_selected() { printf " -> $ESC[7m $1 $ESC[27m"; }
get_cursor_row() { IFS=';' read -sdR -p $'\E[6n' ROW COL; echo ${ROW#*[}; }
key_input() { read -s -n3 key 2>/dev/null >&2
if [[ $key = $ESC[A ]]; then echo up; fi
if [[ $key = $ESC[B ]]; then echo down; fi
if [[ $key = "" ]]; then echo enter; fi; }
# initially print empty new lines (scroll down if at bottom of screen)
for opt; do printf "\n"; done
# determine current screen position for overwriting the options
local lastrow=`get_cursor_row`
local startrow=$(($lastrow - $#))
# ensure cursor and input echoing back on upon a ctrl+c during read -s
trap "cursor_blink_on; stty echo; printf '\n'; exit" 2
cursor_blink_off
local selected=0
while true; do
# print options by overwriting the last lines
local idx=0
for opt; do
cursor_to $(($startrow + $idx))
if [ $idx -eq $selected ]; then
print_selected "$opt"
else
print_option "$opt"
fi
((idx++))
done
# user key control
case `key_input` in
enter) break;;
up) ((selected--));
if [ $selected -lt 0 ]; then selected=$(($# - 1)); fi;;
down) ((selected++));
if [ $selected -ge $# ]; then selected=0; fi;;
esac
done
# cursor position back to normal
cursor_to $lastrow
printf "\n"
cursor_blink_on
return $selected
}
function select_opt {
select_option "$@" 1>&2
local result=$?
echo $result
return $result
}
echo "Welcome to PineLoader!"
echo "Copyright 2020 - Dreemurrs Embedded Labs / DanctNIX."
echo
echo "[VOLUME_UP/VOLUME_DOWN to select. POWER is OK.]"
echo
declare -a choices
for path in "${!config[@]}"; do
choices+=( "$path" )
done
i=$(select_opt "${choices[@]}")
key="${choices[$i]}"
value="${config[$key]}"
if [ -z "$value" ]; then
echo "ERROR: The selected boot variables are blank, please debug the issue by telnet to:"
echo "$IP"
else
mount -o ro $BOOTPART /mnt
echo "Loading kernel and ramdisk to memory..."
kexec -l --initrd="$INITRD" --command-line="$CMDLINE" $KERNEL
echo "Starting kernel..."
kexec -e
fi

BIN
initramfs/vol.bmap Normal file

Binary file not shown.

1191
src/busybox_config Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,2 @@
PLATFORM=pine64-pinebookpro
EMMC=/dev/mmcblk2

View File

@ -0,0 +1,6 @@
PLATFORM=pine64-pinephone
EMMC=/dev/mmcblk2
SD=/dev/mmcblk0
LED=red\:indicator
TRIGGER=mmc2
ERRORLINES=80

View File

@ -0,0 +1,3 @@
PLATFORM=pine64-pinetab
EMMC=/dev/mmcblk2
SD=/dev/mmcblk0

4894
src/linux_config_rockchip Normal file

File diff suppressed because it is too large Load Diff

3632
src/linux_config_sunxi Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
timeout 10
default POSTMARKETOS
menu title boot prev kernel
label POSTMARKETOS
kernel /Image.gz
fdt /rk3399-pinebook-pro.dtb
initrd /initramfs.gz
append console=tty0 console=ttyS2,1500000n8 panic=10 coherent_pool=1M video=HDMI-A-1:1920x1080@60 video=eDP-1:1920x1080@60 loglevel=5 mem_sleep_default=s2idle

16
src/pine64-pinephone.txt Normal file
View File

@ -0,0 +1,16 @@
setenv kernel_addr_z 0x44080000
setenv bootargs loglevel=0 silent console=tty0 vt.global_cursor_default=0
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} /initramfs.gz; then
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
else
booti ${kernel_addr_r} - ${fdt_addr_r};
fi;
fi;
fi

16
src/pine64-pinetab.txt Normal file
View File

@ -0,0 +1,16 @@
setenv kernel_addr_z 0x44080000
setenv bootargs loglevel=0 silent console=tty0 vt.global_cursor_default=0
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-pinetab.dtb; 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};
fi;
fi;
fi

395
src/u-boot-pinephone.patch Normal file
View File

@ -0,0 +1,395 @@
From 0cdfb424bbab2f58dc5491f966137714c38005ec Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sun, 15 Dec 2019 13:34:43 -0600
Subject: [PATCH] [DO NOT MERGE] sun50i: a64: Add PinePhone DTS and defconfig
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
arch/arm/dts/Makefile | 1 +
arch/arm/dts/sun50i-a64-pinephone.dts | 328 ++++++++++++++++++++++++++
configs/pinephone_defconfig | 25 ++
3 files changed, 354 insertions(+)
create mode 100644 arch/arm/dts/sun50i-a64-pinephone.dts
create mode 100644 configs/pinephone_defconfig
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index bb979550c44..4ffdae21c30 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -576,6 +576,7 @@ dtb-$(CONFIG_MACH_SUN50I) += \
sun50i-a64-pine64-plus.dtb \
sun50i-a64-pine64.dtb \
sun50i-a64-pinebook.dtb \
+ sun50i-a64-pinephone.dtb \
sun50i-a64-sopine-baseboard.dtb \
sun50i-a64-teres-i.dtb
dtb-$(CONFIG_MACH_SUN9I) += \
diff --git a/arch/arm/dts/sun50i-a64-pinephone.dts b/arch/arm/dts/sun50i-a64-pinephone.dts
new file mode 100644
index 00000000000..5cc7df71d73
--- /dev/null
+++ b/arch/arm/dts/sun50i-a64-pinephone.dts
@@ -0,0 +1,328 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (C) 2019 Icenowy Zheng <icenowy@aosc.xyz>
+ *
+ */
+
+/dts-v1/;
+
+#include "sun50i-a64.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/pwm/pwm.h>
+
+/ {
+ model = "PinePhone";
+ compatible = "pine64,pinephone", "allwinner,sun50i-a64";
+
+ aliases {
+ serial0 = &uart0;
+ ethernet0 = &rtl8723cs;
+ };
+
+ backlight: backlight {
+ compatible = "pwm-backlight";
+ pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;
+ brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
+ default-brightness-level = <8>;
+ enable-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 LCD-BL-EN */
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ blue {
+ label = "pinephone:blue:user";
+ gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */
+ };
+
+ green {
+ label = "pinephone:green:user";
+ gpios = <&pio 3 18 GPIO_ACTIVE_HIGH>; /* PD18 */
+ };
+
+ red {
+ label = "pinephone:red:user";
+ gpios = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */
+ };
+ };
+
+ reg_3v3_wifi: regulator-3v3-wifi{
+ compatible = "regulator-fixed";
+ regulator-name = "vcc-wifi";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ };
+
+ reg_vbat_4g: regulator-vbat-4g{
+ compatible = "regulator-fixed";
+ regulator-name = "vbat-4g";
+ regulator-min-microvolt = <3700000>;
+ regulator-max-microvolt = <3700000>;
+ gpio = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
+ enable-active-high;
+ };
+
+ reg_vcc5v0: regulator-vcc5v0 {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc5v0";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ gpio = <&pio 3 8 GPIO_ACTIVE_HIGH>; /* PD8 */
+ enable-active-high;
+ };
+
+ speaker_amp: audio-amplifier {
+ compatible = "simple-audio-amplifier";
+ enable-gpios = <&pio 2 7 GPIO_ACTIVE_HIGH>; /* PC7 */
+ sound-name-prefix = "Speaker Amp";
+ };
+
+ wifi_pwrseq: wifi_pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
+ };
+};
+
+&cpu0 {
+ cpu-supply = <&reg_dcdc2>;
+};
+
+&de {
+ status = "okay";
+};
+
+&ehci0 {
+ status = "okay";
+};
+
+&ehci1 {
+ status = "okay";
+};
+
+&mmc0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&mmc0_pins>;
+ vmmc-supply = <&reg_dcdc1>;
+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
+ disable-wp;
+ bus-width = <4>;
+ status = "okay";
+};
+
+&mmc1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&mmc1_pins>;
+ vmmc-supply = <&reg_3v3_wifi>;
+ vqmmc-supply = <&reg_dldo4>;
+ mmc-pwrseq = <&wifi_pwrseq>;
+ bus-width = <4>;
+ non-removable;
+ status = "okay";
+
+ rtl8723cs: wifi@1 {
+ reg = <1>;
+ };
+};
+
+&mmc2 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&mmc2_pins>;
+ vmmc-supply = <&reg_dcdc1>;
+ vqmmc-supply = <&reg_dcdc1>;
+ bus-width = <8>;
+ non-removable;
+ cap-mmc-hw-reset;
+ status = "okay";
+};
+
+&ohci0 {
+ status = "okay";
+};
+
+&ohci1 {
+ status = "okay";
+};
+
+&pio {
+ vcc-pe-supply = <&reg_aldo1>;
+ vcc-pg-supply = <&reg_dldo4>;
+};
+
+&r_pwm {
+ status = "okay";
+};
+
+&r_rsb {
+ status = "okay";
+
+ axp803: pmic@3a3 {
+ compatible = "x-powers,axp803";
+ reg = <0x3a3>;
+ interrupt-parent = <&r_intc>;
+ interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+ };
+};
+
+#include "axp803.dtsi"
+
+&reg_aldo1 {
+ regulator-min-microvolt = <2800000>;
+ regulator-max-microvolt = <2800000>;
+ regulator-name = "dovdd-csi";
+};
+
+&reg_aldo2 {
+ regulator-always-on;
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-name = "vcc-pl";
+};
+
+&reg_aldo3 {
+ regulator-always-on;
+ regulator-min-microvolt = <2700000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-name = "vcc-pll-avcc";
+};
+
+&reg_dc1sw {
+ regulator-always-on;
+ regulator-name = "dc1sw";
+};
+
+&reg_dcdc1 {
+ regulator-always-on;
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-name = "vcc-3v3";
+};
+
+&reg_dcdc2 {
+ regulator-always-on;
+ regulator-min-microvolt = <1000000>;
+ regulator-max-microvolt = <1300000>;
+ regulator-name = "vdd-cpux";
+};
+
+/* DCDC3 is polyphased with DCDC2 */
+
+&reg_dcdc5 {
+ regulator-always-on;
+ regulator-min-microvolt = <1200000>;
+ regulator-max-microvolt = <1200000>;
+ regulator-name = "vcc-dram";
+};
+
+&reg_dcdc6 {
+ regulator-always-on;
+ regulator-min-microvolt = <1100000>;
+ regulator-max-microvolt = <1100000>;
+ regulator-name = "vdd-sys";
+};
+
+&reg_dldo1 {
+ regulator-always-on;
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-name = "vcc-dsi-sensor";
+};
+
+&reg_dldo2 {
+ regulator-always-on;
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ regulator-name = "vcc-mipi-io";
+};
+
+&reg_dldo3 {
+ regulator-min-microvolt = <2800000>;
+ regulator-max-microvolt = <2800000>;
+ regulator-name = "avdd-csi";
+};
+
+&reg_dldo4 {
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-name = "vcc-wifi-io";
+};
+
+&reg_eldo1 {
+ regulator-always-on;
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ regulator-name = "vcc-lpddr";
+};
+
+&reg_eldo3 {
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ regulator-name = "dvdd-1v8-csi";
+};
+
+&reg_fldo1 {
+ regulator-min-microvolt = <1200000>;
+ regulator-max-microvolt = <1200000>;
+ regulator-name = "vcc-1v2-hsic";
+};
+
+&reg_fldo2 {
+ regulator-always-on;
+ regulator-min-microvolt = <1100000>;
+ regulator-max-microvolt = <1100000>;
+ regulator-name = "vdd-cpus";
+};
+
+&reg_ldo_io0 {
+ regulator-always-on;
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-name = "vcc-lcd";
+ status = "okay";
+};
+
+&reg_ldo_io1 {
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ regulator-name = "vcc-1v8-typec";
+ status = "okay";
+};
+
+&reg_rtc_ldo {
+ regulator-name = "vcc-rtc";
+};
+
+&uart0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart0_pb_pins>;
+ status = "okay";
+};
+
+&uart1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
+ status = "okay";
+
+ bluetooth {
+ compatible = "realtek,rtl8723cs-bt";
+ reset-gpios = <&r_pio 0 4 GPIO_ACTIVE_LOW>; /* PL4 */
+ device-wake-gpios = <&pio 7 6 GPIO_ACTIVE_LOW>; /* PH6 */
+ host-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */
+ firmware-postfix = "pinebook";
+ };
+};
+
+&usb_otg {
+ dr_mode = "peripheral";
+ status = "okay";
+};
+
+&usbphy {
+ usb1_vbus-supply = <&reg_vbat_4g>;
+ status = "okay";
+};
diff --git a/configs/pinephone_defconfig b/configs/pinephone_defconfig
new file mode 100644
index 00000000000..f4b9f6adaad
--- /dev/null
+++ b/configs/pinephone_defconfig
@@ -0,0 +1,26 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_SPL=y
+CONFIG_IDENT_STRING=""
+CONFIG_MACH_SUN50I=y
+CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y
+CONFIG_DRAM_CLK=552
+CONFIG_DRAM_ZQ=3881949
+CONFIG_MMC_SUNXI_SLOT_EXTRA=2
+# CONFIG_VIDEO_DE2 is not set
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+# CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_DISPLAY_BOARDINFO is not set
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
+# CONFIG_SPL_BANNER_PRINT is not set
+# CONFIG_SPL_POWER_SUPPORT is not set
+CONFIG_CMD_POWEROFF=y
+# CONFIG_SPL_DOS_PARTITION is not set
+# CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pinephone"
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+# CONFIG_NET is not set
+# CONFIG_EFI_LOADER is not set
+CONFIG_BOOTDELAY=0
--
2.26.2