summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2014-07-28 13:25:35 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2014-07-28 13:25:58 +0200
commit577a317117f2e892312a548d8abb34df294698d0 (patch)
tree9218a9e6ff756cac37045b03fa3717e4c898dde3
parentc43854da4d87c25f54cce20ad188a6877dc15f71 (diff)
add support for pcengines-apu booting from ssd
-rw-r--r--package/adkinstall/Makefile3
-rw-r--r--package/adkinstall/src/adkinstall94
-rw-r--r--package/grub/Makefile14
3 files changed, 97 insertions, 14 deletions
diff --git a/package/adkinstall/Makefile b/package/adkinstall/Makefile
index bf47d76ff..a1edb9c11 100644
--- a/package/adkinstall/Makefile
+++ b/package/adkinstall/Makefile
@@ -10,7 +10,8 @@ PKG_DESCR:= adk disk/flash installer
PKG_SECTION:= base/misc
PKG_DEPENDS:= mke2fs parted sfdisk dosfstools mksh
-PKG_SYSTEM_DEPENDS:= mikrotik-rb532 lemote-yeelong
+PKG_SYSTEM_DEPENDS:= mikrotik-rb532 lemote-yeelong pcengines-apu
+PKG_DEPENDS_PCENGINES_APU:= grub grub-tools
NO_DISTFILES:= 1
include ${ADK_TOPDIR}/mk/package.mk
diff --git a/package/adkinstall/src/adkinstall b/package/adkinstall/src/adkinstall
index 162bfb7f0..19179a698 100644
--- a/package/adkinstall/src/adkinstall
+++ b/package/adkinstall/src/adkinstall
@@ -1,6 +1,6 @@
#!/bin/mksh
# This file is part of the OpenADK project.
-# install to ADK to a block/flash device
+# install OpenADK to a block/flash device
if [ $(id -u) -ne 0 ];then
print Installation is only possible as root
@@ -26,7 +26,45 @@ EOF
exit 1
}
+function pcengines-apu-help {
+ cat >&2 <<EOF
+Syntax: adkinstall -a <archive>
+ -a: archive
+ -f: filesystem (default ext4)
+ -h: help text
+EOF
+ exit 1
+}
+
+
case $target {
+(pcengines-apu)
+ cfgfssize=32768
+ fs=ext4
+ while getopts "ha:f:" ch; do
+ case $ch in
+ a)
+ archive=$OPTARG
+ ;;
+ f)
+ fs=$OPTARG
+ ;;
+ h)
+ pcengines-apu-help
+ exit 1
+ ;;
+ *)
+ pcengines-apu-help
+ exit 1
+ ;;
+ esac
+ done
+ shift $((OPTIND - 1))
+ if [ $OPTIND -eq 1 ];then
+ pcengines-apu-help
+ exit 1
+ fi
+ ;;
(mikrotik-rb532)
cfgfssize=32768
nand=0
@@ -59,6 +97,10 @@ case $target {
esac
done
shift $((OPTIND - 1))
+ if [ $OPTIND -eq 1 ];then
+ mikrotik-rb532-help
+ exit 1
+ fi
;;
(*)
print target $target not supported
@@ -66,17 +108,17 @@ case $target {
;;
}
-if [ $cf -eq 0 -a $nand -eq 0 ];then
- print "You either install on cf (-c) or nand (-n)"
- mikrotik-rb532-help
- exit 1
-fi
+
-tools="parted sfdisk"
-if [ $cf -eq 1 ];then
- tools="$tools mkfs.$fs"
+if [ "$target" = "mikrotik-rb532" ];then
+ if [ $cf -eq 0 -a $nand -eq 0 ];then
+ print "You either install on cf (-c) or nand (-n)"
+ mikrotik-rb532-help
+ fi
fi
+tools="parted sfdisk mkfs.$fs"
+
f=0
for tool in $tools;do
if ! which $tool >/dev/null; then
@@ -117,7 +159,7 @@ function change_part_type {
function create_filesystem {
print creating filesystem $2 on $1 partition $3
- mkfs.$2 -q ${1}${3}
+ mkfs.$2 -F -q ${1}${3}
}
function mount_fs {
@@ -130,13 +172,43 @@ function extract_archive {
tar -C $2 -xpf $1
}
+function grub_install {
+(
+ print set default=0
+ print set timeout=1
+ print serial --unit=0 --speed=$speed
+ print terminal_output serial
+ print terminal_input serial
+ consargs="console=ttyS0,$speed"
+ print
+ print 'menuentry "GNU/Linux (OpenADK)" {'
+ print "\tlinux /boot/kernel"
+ print '}'
+) >/mnt/boot/grub/grub.cfg
+ grub-install $1 --root-directory /mnt
+}
+
function fix_perm {
print fixing permissions
chmod 1777 ${1}/tmp
- chmod 4755 ${1}/bin/busybox
}
case $target {
+(pcengines-apu)
+ get_max_size /dev/sda
+ create_label /dev/sda
+ create_partition /dev/sda ext2 16385 $rootsize
+ create_partition /dev/sda ext2 $(($rootsize+1)) $(($maxsize-1))
+ set_boot_flag /dev/sda 1
+ change_part_type /dev/sda 2 88
+ create_filesystem /dev/sda $fs 1
+ mdev -s
+ mount_fs /dev/sda 1 $fs /mnt
+ extract_archive $archive /mnt
+ grub_install /dev/sda
+ fix_perm /mnt
+ umount /mnt
+ ;;
(mikrotik-rb532)
if (( cf )); then
get_max_size /dev/sda
diff --git a/package/grub/Makefile b/package/grub/Makefile
index da6863952..f360539ac 100644
--- a/package/grub/Makefile
+++ b/package/grub/Makefile
@@ -5,7 +5,7 @@ include $(ADK_TOPDIR)/rules.mk
PKG_NAME:= grub
PKG_VERSION:= 2.00
-PKG_RELEASE:= 5
+PKG_RELEASE:= 6
PKG_MD5SUM:= a1043102fbc7bcedbf53e7ee3d17ab91
PKG_DESCR:= multiboot boot loader
PKG_SECTION:= base/boot
@@ -59,12 +59,22 @@ grub-install:
$(IDIR_GRUB)/boot/grub/core.img
grub-tools-install:
- ${INSTALL_DIR} $(IDIR_GRUB_TOOLS)/usr/{sbin,bin}
+ ${INSTALL_DIR} $(IDIR_GRUB_TOOLS)/usr/{sbin,bin,share,lib}
${INSTALL_BIN} ${WRKINST}/usr/sbin/grub-install \
$(IDIR_GRUB_TOOLS)/usr/sbin
+ ${INSTALL_BIN} ${WRKINST}/usr/sbin/grub-probe \
+ $(IDIR_GRUB_TOOLS)/usr/sbin
${INSTALL_BIN} ${WRKINST}/usr/sbin/grub-bios-setup \
$(IDIR_GRUB_TOOLS)/usr/sbin
+ ${INSTALL_BIN} ${WRKINST}/usr/bin/grub-editenv \
+ $(IDIR_GRUB_TOOLS)/usr/bin
+ ${INSTALL_BIN} ${WRKINST}/usr/bin/grub-mkrelpath \
+ $(IDIR_GRUB_TOOLS)/usr/bin
${INSTALL_BIN} ${WRKINST}/usr/bin/grub-mkimage \
$(IDIR_GRUB_TOOLS)/usr/bin
+ ${CP} ${WRKINST}/usr/lib/grub \
+ $(IDIR_GRUB_TOOLS)/usr/lib
+ ${CP} ${WRKINST}/usr/share/grub \
+ $(IDIR_GRUB_TOOLS)/usr/share
include ${ADK_TOPDIR}/mk/pkg-bottom.mk