From e7f183fb81552370370d7b74fb41ab40aba4ff0b Mon Sep 17 00:00:00 2001 From: jsg Date: Tue, 2 Jun 2015 01:48:25 +0000 Subject: [PATCH] Rename the imx miniroot to nitrogen as it creates "6x_bootscript". Add a miniroot for the CuBox-i which needs u-boot at a particular offset in the sd image to boot. Based on changes made by Patrick Wildt in bitrig. --- distrib/armv7/miniroot/Makefile | 2 +- distrib/armv7/miniroot/Makefile.inc | 26 +++++++---- .../armv7/miniroot/{imx => cubox}/Makefile | 2 +- distrib/armv7/miniroot/nitrogen/Makefile | 7 +++ distrib/armv7/ramdisk/install.md | 46 +++++++++++++------ distrib/notes/armv7/contents | 18 +++++--- distrib/notes/armv7/prep | 7 ++- etc/etc.armv7/Makefile.inc | 6 +-- 8 files changed, 74 insertions(+), 40 deletions(-) rename distrib/armv7/miniroot/{imx => cubox}/Makefile (87%) create mode 100644 distrib/armv7/miniroot/nitrogen/Makefile diff --git a/distrib/armv7/miniroot/Makefile b/distrib/armv7/miniroot/Makefile index a27cf050f27..0b58312536f 100644 --- a/distrib/armv7/miniroot/Makefile +++ b/distrib/armv7/miniroot/Makefile @@ -1,3 +1,3 @@ -SUBDIR= am335x beagle panda imx cubie +SUBDIR= am335x beagle cubie cubox nitrogen panda .include diff --git a/distrib/armv7/miniroot/Makefile.inc b/distrib/armv7/miniroot/Makefile.inc index 850de04acd7..a638960c47e 100644 --- a/distrib/armv7/miniroot/Makefile.inc +++ b/distrib/armv7/miniroot/Makefile.inc @@ -46,16 +46,24 @@ do_files: mkdir ${MOUNT_POINT}/u-boots cp -r /usr/mdec/{am335x,beagle,panda} ${MOUNT_POINT}/u-boots .endif -.if ${PLATFORM} == "IMX" +.if ${BOARD} == "nitrogen" echo "; setenv loadaddr ${LOADADDR} ; setenv bootargs sd0i:/bsd.umg ; for dtype in sata mmc ; do for disk in 0 1 ; do \$${dtype} dev \$${disk} ; for fs in fat ext2 ; do if \$${fs}load \$${dtype} \$${disk}:1 \$${loadaddr} bsd.umg ; then bootm \$${loadaddr} ; fi ; done; done; done; echo; echo failed to load bsd.umg" > 6x_bootscript.cmd ${MKUBOOT} -t script -a arm -o linux 6x_bootscript.cmd 6x_bootscript.scr cp 6x_bootscript.scr ${MOUNT_POINT}/6x_bootscript - +.endif +.if ${BOARD} == "cubox" + echo "; setenv loadaddr ${LOADADDR} ; setenv bootargs sd0i:/bsd.umg ; for dtype in mmc usb ; do for disk in 0 1 ; do \$${dtype} dev \$${disk} ; for fs in fat ext2 ; do if \$${fs}load \$${dtype} \$${disk}:1 \$${loadaddr} bsd.umg ; then bootm \$${loadaddr} ; fi ; done; done; done; echo; echo failed to load bsd.umg" > boot.cmd + ${MKUBOOT} -t script -a arm -o linux boot.cmd boot.scr + cp boot.scr ${MOUNT_POINT}/boot.scr + dd if=/usr/mdec/cubox/SPL of=${VND_CDEV} bs=1024 seek=1 + dd if=/usr/mdec/cubox/u-boot.img of=${VND_CDEV} bs=1024 seek=42 .endif .if ${PLATFORM} == "SUNXI" echo 'bootargs=sd0a:/bsd' > ${MOUNT_POINT}/uEnv.tx echo 'mmcboot=mmc rescan ; fatload mmc 0 ${LOADADDR} bsd.umg && bootm ${LOADADDR};' >> ${MOUNT_POINT}/uEnv.txt echo 'uenvcmd=run mmcboot;' >> ${MOUNT_POINT}/uEnv.txt + dd if=/usr/mdec/${BOARD}/u-boot-sunxi-with-spl.bin \ + of=${VND_CDEV} bs=1024 seek=8 .endif cp ${.OBJDIR}/../../ramdisk/bsd.rd.${PLATFORM}.umg ${MOUNT_POINT}/bsd.umg @@ -64,9 +72,14 @@ rd_setup: vnconfig -c ${VND} ${IMAGE} fdisk -c 2 -h 255 -s 63 -yi ${VND} >/dev/null .if ${PLATFORM} == "SUNXI" - echo "u\ne 0\n${PART_ID}\ny\n0\n99\n1\n1\n254\n63\nf 0\nw\nq\n" | fdisk -c 2 -h 255 -s 63 -e ${VND} >/dev/null + echo "u\ne 0\n${PART_ID}\ny\n0\n99\n1\n1\n254\n63\nf 0\nw\nq\n" \ + | fdisk -c 2 -h 255 -s 63 -e ${VND} >/dev/null +.elif ${BOARD} == "cubox" + echo "u\ne 3\n0\ne 0\n${PART_ID}\ny\n0\n32\n33\n1\n254\n63\n63\nf 0\nw\nq" \ + | fdisk -c 2 -h 255 -s 63 -e ${VND} >/dev/null .else - echo "u\ne 0\n${PART_ID}\ny\n0\n1\n1\n1\n254\n63\nf 0\nw\nq\n" | fdisk -c 2 -h 255 -s 63 -e ${VND} >/dev/null + echo "u\ne 0\n${PART_ID}\ny\n0\n1\n1\n1\n254\n63\nf 0\nw\nq\n" \ + | fdisk -c 2 -h 255 -s 63 -e ${VND} >/dev/null .endif newfs_${FS} ${NEWFS_ARGS_${FS}} ${VND_RIDEV} >/dev/null mount ${VND_IDEV} ${MOUNT_POINT} @@ -74,13 +87,8 @@ rd_setup: rd_teardown: @df -i ${MOUNT_POINT} -umount ${MOUNT_POINT} -.if ${PLATFORM} == "SUNXI" - dd if=/usr/mdec/${BOARD}/u-boot-sunxi-with-spl.bin \ - of=${VND_CDEV} bs=1024 seek=8 -.endif -vnconfig -u ${VND} - unconfig: -umount -f ${MOUNT_POINT} -vnconfig -u ${VND} diff --git a/distrib/armv7/miniroot/imx/Makefile b/distrib/armv7/miniroot/cubox/Makefile similarity index 87% rename from distrib/armv7/miniroot/imx/Makefile rename to distrib/armv7/miniroot/cubox/Makefile index 8984070e9b1..41fa4126ab3 100644 --- a/distrib/armv7/miniroot/imx/Makefile +++ b/distrib/armv7/miniroot/cubox/Makefile @@ -1,4 +1,4 @@ -BOARD= imx +BOARD= cubox PLATFORM=IMX LOADADDR=0x18800000 FS=ext2fs diff --git a/distrib/armv7/miniroot/nitrogen/Makefile b/distrib/armv7/miniroot/nitrogen/Makefile new file mode 100644 index 00000000000..6238d8fe7cb --- /dev/null +++ b/distrib/armv7/miniroot/nitrogen/Makefile @@ -0,0 +1,7 @@ +BOARD= nitrogen +PLATFORM=IMX +LOADADDR=0x18800000 +FS=ext2fs +PART_ID=83 + +.include "${.CURDIR}/../Makefile.inc" diff --git a/distrib/armv7/ramdisk/install.md b/distrib/armv7/ramdisk/install.md index 2162348696c..a70e1c02d9b 100644 --- a/distrib/armv7/ramdisk/install.md +++ b/distrib/armv7/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.9 2015/05/31 19:40:10 rpe Exp $ +# $OpenBSD: install.md,v 1.10 2015/06/02 01:48:25 jsg Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -50,10 +50,15 @@ if [[ $? == 0 ]]; then MDPLAT=SUNXI LOADADDR=0x40200000 fi +BEAGLE=$(scan_dmesg '/^omap0 at mainbus0: TI OMAP3 \(BeagleBoard\).*/s//\1/p') +BEAGLEBONE=$(scan_dmesg '/^omap0 at mainbus0: TI AM335x \(BeagleBone\).*/s//\1/p') +PANDA=$(scan_dmesg '/^omap0 at mainbus0: TI OMAP4 \(PandaBoard\)/s//\1/p') +CUBOX=$(scan_dmesg '/^imx0 at mainbus0: \(SolidRun.*\)/s//CUBOX/p') +NITROGEN=$(scan_dmesg '/^imx0 at mainbus0: \(Freescale i.MX6 SABRE Lite.*\)/s//NITROGEN/p') -MDSETS="bsd.${MDPLAT} bsd.rd.${MDPLAT} bsd.${MDPLAT}.umg bsd.rd.${MDPLAT}.umg" -SANESETS="bsd.${MDPLAT}" -DEFAULTSETS=${MDSETS} +MDSETS="bsd.${MDPLAT}.umg bsd.rd.${MDPLAT}.umg" +SANESETS="bsd" +DEFAULTSETS="bsd bsd.rd ${MDSETS}" NEWFSARGS_msdos="-F 16 -L boot" NEWFSARGS_ext2fs="-v boot" @@ -62,10 +67,6 @@ md_installboot() { local _disk=$1 mount /dev/${_disk}i /mnt/mnt - BEAGLE=$(scan_dmesg '/^omap0 at mainbus0: TI OMAP3 \(BeagleBoard\).*/s//\1/p') - BEAGLEBONE=$(scan_dmesg '/^omap0 at mainbus0: TI AM335x \(BeagleBone\).*/s//\1/p') - PANDA=$(scan_dmesg '/^omap0 at mainbus0: TI OMAP4 \(PandaBoard\)/s//\1/p') - if [[ -f /mnt/bsd.${MDPLAT}.umg ]]; then mv /mnt/bsd.${MDPLAT}.umg /mnt/mnt/bsd.umg fi @@ -90,10 +91,18 @@ bootcmd=mmc rescan ; setenv loadaddr ${LOADADDR}; setenv bootargs sd0i:/bsd.umg uenvcmd=boot __EOT elif [[ ${MDPLAT} == "IMX" ]]; then - cat > /tmp/6x_bootscript.scr<<__EOT -; setenv loadaddr ${LOADADDR} ; setenv bootargs sd0i:/bsd.umg ; for dtype in sata mmc ; do for disk in 0 1 ; do \${dtype} dev \${disk} ; for fs in fat ext2 ; do if \${fs}load \${dtype} \${disk}:1 \${loadaddr} bsd.umg ; then bootm \${loadaddr} ; fi ; done; done; done; echo; echo failed to load bsd.umg -__EOT - mkuboot -t script -a arm -o linux /tmp/6x_bootscript.scr /mnt/mnt/6x_bootscript + if [[ -n $CUBOX ]]; then + cat > /tmp/boot.cmd<<__EOT +; setenv loadaddr ${LOADADDR} ; setenv bootargs sd0i:/bsd.umg ; for dtype in usb mmc ; do for disk in 0 1 ; do \${dtype} dev \${disk} ; for fs in fat ext2 ; do if \${fs}load \${dtype} \${disk}:1 \${loadaddr} bsd.umg ; then bootm \${loadaddr} ; fi ; done; done; done; echo; echo failed to load bsd.umg + mkuboot -t script -a arm -o linux /tmp/boot.cmd /mnt/mnt/boot.scr + dd if=/mnt/usr/mdec/cubox/SPL of=/dev/${_disk}c bs=1024 seek=1 + dd if=/mnt/usr/mdec/cubox/u-boot.img of=/dev/${_disk}c bs=1024 seek=42 + elif [[ -n $NITROGEN ]]; then + cat > /tmp/6x_bootscript.scr<<__EOT + ; setenv loadaddr ${LOADADDR} ; setenv bootargs sd0i:/bsd.umg ; for dtype in sata mmc ; do for disk in 0 1 ; do \${dtype} dev \${disk} ; for fs in fat ext2 ; do if \${fs}load \${dtype} \${disk}:1 \${loadaddr} bsd.umg ; then bootm \${loadaddr} ; fi ; done; done; done; echo; echo failed to load bsd.umg + __EOT + mkuboot -t script -a arm -o linux /tmp/6x_bootscript.scr /mnt/mnt/6x_bootscript + fi elif [[ ${MDPLAT} == "SUNXI" ]]; then cat > /mnt/mnt/uenv.txt<<__EOT bootargs=sd0i:/bsd @@ -108,6 +117,9 @@ md_prep_fdisk() { local _disk=$1 _q _d local bootparttype="C" + local bootsectorstart="64" + local bootsectorsize="32768" + local bootsectorend local bootfstype="msdos" local newfs_args=${NEWFSARGS_msdos} @@ -117,6 +129,10 @@ md_prep_fdisk() { bootfstype="ext2fs" newfs_args=${NEWFSARGS_ext2fs} fi + if [[ -n $CUBOX ]]; then + bootsectorstart="2048" + fi + bootsectorend=`expr $bootsectorstart + $bootsectorsize` while :; do _d=whole @@ -134,13 +150,13 @@ reinit e 0 ${bootparttype} n -64 -32768 +${bootsectorstart} +${bootsectorsize} f 0 e 3 A6 n -32832 +${bootsectorend} write quit diff --git a/distrib/notes/armv7/contents b/distrib/notes/armv7/contents index a9a81e9304f..a46f4dd4c79 100644 --- a/distrib/notes/armv7/contents +++ b/distrib/notes/armv7/contents @@ -1,4 +1,4 @@ -dnl $OpenBSD: contents,v 1.6 2015/01/26 01:55:55 jsg Exp $ +dnl $OpenBSD: contents,v 1.7 2015/06/02 01:48:25 jsg Exp $ TopPart miniroot-am335x-{:--:}OSrev.fs @@ -9,17 +9,21 @@ TopPart A miniroot filesystem to be used for installation; BeagleBoard version. - miniroot-imx-{:--:}OSrev.fs + miniroot-cubie-{:--:}OSrev.fs A miniroot filesystem to be used for - installation; i.MX6 version. + installation; Cubieboard1 version. - miniroot-panda-{:--:}OSrev.fs + miniroot-cubox--{:--:}OSrev.fs A miniroot filesystem to be used for - installation; PandaBoard (ES) version. + installation; CuBox-i version. - miniroot-cubie-{:--:}OSrev.fs + miniroot-nitrogen-{:--:}OSrev.fs A miniroot filesystem to be used for - installation; Cubieboard1 version. + installation; Nitrogen6x version. + + miniroot-panda-{:--:}OSrev.fs + A miniroot filesystem to be used for + installation; PandaBoard (ES) version. OpenBSDdistsets diff --git a/distrib/notes/armv7/prep b/distrib/notes/armv7/prep index c1e65067a80..de6dd86ebfd 100644 --- a/distrib/notes/armv7/prep +++ b/distrib/notes/armv7/prep @@ -1,11 +1,10 @@ -dnl $OpenBSD: prep,v 1.6 2015/01/26 01:55:55 jsg Exp $ +dnl $OpenBSD: prep,v 1.7 2015/06/02 01:48:25 jsg Exp $ Please be aware that OpenBSD support for this platform is far from complete. OpenBSD can be installed onto a disk by copying the miniroot for your -board "miniroot-{am335x,beagle,imx,panda,cubie}-{:--:}OSrev.fs" -image to an SD card or by booting the ramdisk kernel over the network -using a TFTP server. +board "miniroot-board-{:--:}OSrev.fs" image to an SD card or by booting +the ramdisk kernel over the network using a TFTP server. Booting from an SD card: diff --git a/etc/etc.armv7/Makefile.inc b/etc/etc.armv7/Makefile.inc index a2bda39f9ef..c9321bdb1b3 100644 --- a/etc/etc.armv7/Makefile.inc +++ b/etc/etc.armv7/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.8 2015/05/20 01:44:20 jsg Exp $ +# $OpenBSD: Makefile.inc,v 1.9 2015/06/02 01:48:25 jsg Exp $ ALLSOC=IMX OMAP SUNXI MDEXT= bsd.rd @@ -24,5 +24,5 @@ kernels: bootblocks ${ALL_KERNELS} .endfor MDEXT+= miniroot-am335x-${OSrev}.fs miniroot-beagle-${OSrev}.fs \ - miniroot-imx-${OSrev}.fs miniroot-panda-${OSrev}.fs \ - miniroot-cubie-${OSrev}.fs + miniroot-cubie-${OSrev}.fs miniroot-cubox-${OSrev}.fs \ + miniroot-nitrogen-${OSrev}.fs miniroot-panda-${OSrev}.fs -- 2.20.1