From cd751cf8f4e16cfade023914f8a5e5936ab34d70 Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Thu, 27 Aug 2020 15:45:31 +0200 Subject: [PATCH 01/10] nit6sx: copy rpi3bplus as base --- nit6sx/debimage-rpi3.yaml | 111 ++++++++++++++++++ nit6sx/overlays/fw-config/config.txt | 3 + .../etc/systemd/network/wired.network | 6 + .../overlays/u-boot-menu/etc/default/u-boot | 14 +++ nit6sx/scripts/replace-u-boot-rpi.sh | 6 + nit6sx/scripts/setup-networking.sh | 10 ++ nit6sx/scripts/setup-user.sh | 8 ++ 7 files changed, 158 insertions(+) create mode 100644 nit6sx/debimage-rpi3.yaml create mode 100755 nit6sx/overlays/fw-config/config.txt create mode 100644 nit6sx/overlays/networkd/etc/systemd/network/wired.network create mode 100644 nit6sx/overlays/u-boot-menu/etc/default/u-boot create mode 100755 nit6sx/scripts/replace-u-boot-rpi.sh create mode 100755 nit6sx/scripts/setup-networking.sh create mode 100755 nit6sx/scripts/setup-user.sh diff --git a/nit6sx/debimage-rpi3.yaml b/nit6sx/debimage-rpi3.yaml new file mode 100644 index 0000000..c28e070 --- /dev/null +++ b/nit6sx/debimage-rpi3.yaml @@ -0,0 +1,111 @@ +{{- $firmware_version := or .firmware_version "1.20180919" -}} +{{- $image := or .image "debian-rpi3bplus.img" -}} + +architecture: arm64 + +actions: + # Download all needed proprietary stuff first + - action: download + description: Download latest version of the firmware from GitHub + url: https://github.com/raspberrypi/firmware/archive/{{ $firmware_version }}.tar.gz + unpack: true # Unpack downloaded file + name: firmware # name for usage directory with unpacked content in other actions + + - action: debootstrap + suite: buster + components: + - main + mirror: https://deb.debian.org/debian + variant: minbase + + - action: apt + description: Install extra packages + packages: + - sudo + - openssh-server + - adduser + - systemd-sysv + - linux-image-arm64 + - u-boot-rpi + - u-boot-menu + - wget + + - action: run + description: Set up user + chroot: true + script: scripts/setup-user.sh + + - action: run + description: Add hostname + chroot: true + command: echo rpi3 > /etc/hostname + + - action: overlay + source: overlays/networkd + + - action: run + chroot: true + script: scripts/setup-networking.sh + + # add firmware + - action: overlay + origin: firmware + source: firmware-{{ $firmware_version }}/boot + destination: /boot/firmware + + - action: run + chroot: true + command: rm -rf /boot/firmware/kernel*.img /boot/firmware/*.dtb /boot/firmware/overlays + + - action: run + chroot: true + command: cp /usr/lib/u-boot/rpi_3/* /boot/firmware/ + + - action: overlay + source: overlays/fw-config + destination: /boot/firmware + + - action: run + chroot: true + command: echo console=ttyS1,115200 > /etc/kernel/cmdline + + - action: overlay + source: overlays/u-boot-menu + + - action: run + chroot: true + command: u-boot-update + + - action: image-partition + imagename: {{ $image }} + imagesize: 1GB + partitiontype: msdos + mountpoints: + - mountpoint: / + partition: root + - mountpoint: /boot/firmware + partition: firmware + options: [ x-systemd.automount ] + partitions: + - name: firmware + fs: fat32 + start: 0% + end: 64MB + - name: root + fs: ext4 + start: 64MB + end: 100% + flags: [ boot ] + + - action: filesystem-deploy + description: Deploying filesystem onto image + + - action: run + description: Create block map file + postprocess: true + command: bmaptool create {{ $image }} > {{ $image }}.bmap + + - action: run + description: Compressing final image + postprocess: true + command: gzip -f {{ $image }} diff --git a/nit6sx/overlays/fw-config/config.txt b/nit6sx/overlays/fw-config/config.txt new file mode 100755 index 0000000..32f1208 --- /dev/null +++ b/nit6sx/overlays/fw-config/config.txt @@ -0,0 +1,3 @@ +arm_64bit=1 +enable_uart=1 +kernel=u-boot.bin diff --git a/nit6sx/overlays/networkd/etc/systemd/network/wired.network b/nit6sx/overlays/networkd/etc/systemd/network/wired.network new file mode 100644 index 0000000..181a1e8 --- /dev/null +++ b/nit6sx/overlays/networkd/etc/systemd/network/wired.network @@ -0,0 +1,6 @@ +[Match] +Name=e* + +[Network] +DHCP=yes + diff --git a/nit6sx/overlays/u-boot-menu/etc/default/u-boot b/nit6sx/overlays/u-boot-menu/etc/default/u-boot new file mode 100644 index 0000000..91235f7 --- /dev/null +++ b/nit6sx/overlays/u-boot-menu/etc/default/u-boot @@ -0,0 +1,14 @@ +## /etc/default/u-boot - configuration file for u-boot-update(8) + +U_BOOT_UPDATE="true" + +U_BOOT_ALTERNATIVES="default recovery" +U_BOOT_DEFAULT="l0" +U_BOOT_ENTRIES="all" +U_BOOT_MENU_LABEL="Debian GNU/Linux" +U_BOOT_PARAMETERS="root=/dev/mmcblk0p2 ro rootwait console=ttyS1,115200" +U_BOOT_ROOT="" +U_BOOT_TIMEOUT="50" +U_BOOT_FDT="broadcom/bcm2837-rpi-3-b-plus.dtb" +#U_BOOT_FDT_DIR="/boot/dtbs/" + diff --git a/nit6sx/scripts/replace-u-boot-rpi.sh b/nit6sx/scripts/replace-u-boot-rpi.sh new file mode 100755 index 0000000..71eabe5 --- /dev/null +++ b/nit6sx/scripts/replace-u-boot-rpi.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -e +wget http://ftp.us.debian.org/debian/pool/main/u/u-boot/u-boot-rpi_2018.09+dfsg-1_arm64.deb +dpkg -i u-boot-rpi_2018.09+dfsg-1_arm64.deb +rm u-boot-rpi_2018.09+dfsg-1_arm64.deb diff --git a/nit6sx/scripts/setup-networking.sh b/nit6sx/scripts/setup-networking.sh new file mode 100755 index 0000000..960428c --- /dev/null +++ b/nit6sx/scripts/setup-networking.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +# Network management +systemctl enable systemd-networkd +# DNS resolving +systemctl enable systemd-resolved +# NTP client +systemctl enable systemd-timesyncd diff --git a/nit6sx/scripts/setup-user.sh b/nit6sx/scripts/setup-user.sh new file mode 100755 index 0000000..5a27452 --- /dev/null +++ b/nit6sx/scripts/setup-user.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +adduser --gecos user \ + --disabled-password \ + --shell /bin/bash \ + user +adduser user sudo +echo "user:user" | chpasswd From 3f9ae4355aafee8a93cfa225a33d4655f3ad0862 Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Thu, 27 Aug 2020 15:54:32 +0200 Subject: [PATCH 02/10] nit6sx: initial adaptions for this board This drops the rpi specifics and adapts the basic stuff to the Boundary Devices Nitrogen6SoloX board. --- ...ebimage-rpi3.yaml => debimage-nit6sx.yaml} | 38 +++---------------- nit6sx/overlays/fw-config/config.txt | 3 -- .../overlays/u-boot-menu/etc/default/u-boot | 2 +- 3 files changed, 7 insertions(+), 36 deletions(-) rename nit6sx/{debimage-rpi3.yaml => debimage-nit6sx.yaml} (58%) delete mode 100755 nit6sx/overlays/fw-config/config.txt diff --git a/nit6sx/debimage-rpi3.yaml b/nit6sx/debimage-nit6sx.yaml similarity index 58% rename from nit6sx/debimage-rpi3.yaml rename to nit6sx/debimage-nit6sx.yaml index c28e070..6b0b2d6 100644 --- a/nit6sx/debimage-rpi3.yaml +++ b/nit6sx/debimage-nit6sx.yaml @@ -1,16 +1,8 @@ -{{- $firmware_version := or .firmware_version "1.20180919" -}} -{{- $image := or .image "debian-rpi3bplus.img" -}} +{{- $image := or .image "debian-nit6sx.img" -}} -architecture: arm64 +architecture: armhf actions: - # Download all needed proprietary stuff first - - action: download - description: Download latest version of the firmware from GitHub - url: https://github.com/raspberrypi/firmware/archive/{{ $firmware_version }}.tar.gz - unpack: true # Unpack downloaded file - name: firmware # name for usage directory with unpacked content in other actions - - action: debootstrap suite: buster components: @@ -25,8 +17,8 @@ actions: - openssh-server - adduser - systemd-sysv - - linux-image-arm64 - - u-boot-rpi + - linux-image-armmp + - u-boot-imx - u-boot-menu - wget @@ -38,7 +30,7 @@ actions: - action: run description: Add hostname chroot: true - command: echo rpi3 > /etc/hostname + command: echo nit6sx > /etc/hostname - action: overlay source: overlays/networkd @@ -47,27 +39,9 @@ actions: chroot: true script: scripts/setup-networking.sh - # add firmware - - action: overlay - origin: firmware - source: firmware-{{ $firmware_version }}/boot - destination: /boot/firmware - - - action: run - chroot: true - command: rm -rf /boot/firmware/kernel*.img /boot/firmware/*.dtb /boot/firmware/overlays - - - action: run - chroot: true - command: cp /usr/lib/u-boot/rpi_3/* /boot/firmware/ - - - action: overlay - source: overlays/fw-config - destination: /boot/firmware - - action: run chroot: true - command: echo console=ttyS1,115200 > /etc/kernel/cmdline + command: echo console=ttyS0,115200 > /etc/kernel/cmdline - action: overlay source: overlays/u-boot-menu diff --git a/nit6sx/overlays/fw-config/config.txt b/nit6sx/overlays/fw-config/config.txt deleted file mode 100755 index 32f1208..0000000 --- a/nit6sx/overlays/fw-config/config.txt +++ /dev/null @@ -1,3 +0,0 @@ -arm_64bit=1 -enable_uart=1 -kernel=u-boot.bin diff --git a/nit6sx/overlays/u-boot-menu/etc/default/u-boot b/nit6sx/overlays/u-boot-menu/etc/default/u-boot index 91235f7..b17dc08 100644 --- a/nit6sx/overlays/u-boot-menu/etc/default/u-boot +++ b/nit6sx/overlays/u-boot-menu/etc/default/u-boot @@ -9,6 +9,6 @@ U_BOOT_MENU_LABEL="Debian GNU/Linux" U_BOOT_PARAMETERS="root=/dev/mmcblk0p2 ro rootwait console=ttyS1,115200" U_BOOT_ROOT="" U_BOOT_TIMEOUT="50" -U_BOOT_FDT="broadcom/bcm2837-rpi-3-b-plus.dtb" +U_BOOT_FDT="imx6sx-nitrogen6sx.dtb" #U_BOOT_FDT_DIR="/boot/dtbs/" From 9ddb58bf314d508890ba9efb8656d7e676143725 Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Thu, 27 Aug 2020 15:57:29 +0200 Subject: [PATCH 03/10] nit6sx: console on ttymxc0 Use the imx-specific device node name for the console argument. --- nit6sx/debimage-nit6sx.yaml | 2 +- nit6sx/overlays/u-boot-menu/etc/default/u-boot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nit6sx/debimage-nit6sx.yaml b/nit6sx/debimage-nit6sx.yaml index 6b0b2d6..4e9be44 100644 --- a/nit6sx/debimage-nit6sx.yaml +++ b/nit6sx/debimage-nit6sx.yaml @@ -41,7 +41,7 @@ actions: - action: run chroot: true - command: echo console=ttyS0,115200 > /etc/kernel/cmdline + command: echo console=ttymxc0,115200 > /etc/kernel/cmdline - action: overlay source: overlays/u-boot-menu diff --git a/nit6sx/overlays/u-boot-menu/etc/default/u-boot b/nit6sx/overlays/u-boot-menu/etc/default/u-boot index b17dc08..128ce6f 100644 --- a/nit6sx/overlays/u-boot-menu/etc/default/u-boot +++ b/nit6sx/overlays/u-boot-menu/etc/default/u-boot @@ -6,7 +6,7 @@ U_BOOT_ALTERNATIVES="default recovery" U_BOOT_DEFAULT="l0" U_BOOT_ENTRIES="all" U_BOOT_MENU_LABEL="Debian GNU/Linux" -U_BOOT_PARAMETERS="root=/dev/mmcblk0p2 ro rootwait console=ttyS1,115200" +U_BOOT_PARAMETERS="root=/dev/mmcblk0p2 ro rootwait console=ttymxc0,115200" U_BOOT_ROOT="" U_BOOT_TIMEOUT="50" U_BOOT_FDT="imx6sx-nitrogen6sx.dtb" From dcb493caea61fe34a1999ed77dffcbcbb2088197 Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Thu, 27 Aug 2020 16:00:14 +0200 Subject: [PATCH 04/10] nit6sx: drop u-boot-menu We'll replace the extlinux specifics with something more similar to what flash-kernel does which seems more suitable. --- nit6sx/debimage-nit6sx.yaml | 8 -------- nit6sx/overlays/u-boot-menu/etc/default/u-boot | 14 -------------- 2 files changed, 22 deletions(-) delete mode 100644 nit6sx/overlays/u-boot-menu/etc/default/u-boot diff --git a/nit6sx/debimage-nit6sx.yaml b/nit6sx/debimage-nit6sx.yaml index 4e9be44..dc92c01 100644 --- a/nit6sx/debimage-nit6sx.yaml +++ b/nit6sx/debimage-nit6sx.yaml @@ -19,7 +19,6 @@ actions: - systemd-sysv - linux-image-armmp - u-boot-imx - - u-boot-menu - wget - action: run @@ -43,13 +42,6 @@ actions: chroot: true command: echo console=ttymxc0,115200 > /etc/kernel/cmdline - - action: overlay - source: overlays/u-boot-menu - - - action: run - chroot: true - command: u-boot-update - - action: image-partition imagename: {{ $image }} imagesize: 1GB diff --git a/nit6sx/overlays/u-boot-menu/etc/default/u-boot b/nit6sx/overlays/u-boot-menu/etc/default/u-boot deleted file mode 100644 index 128ce6f..0000000 --- a/nit6sx/overlays/u-boot-menu/etc/default/u-boot +++ /dev/null @@ -1,14 +0,0 @@ -## /etc/default/u-boot - configuration file for u-boot-update(8) - -U_BOOT_UPDATE="true" - -U_BOOT_ALTERNATIVES="default recovery" -U_BOOT_DEFAULT="l0" -U_BOOT_ENTRIES="all" -U_BOOT_MENU_LABEL="Debian GNU/Linux" -U_BOOT_PARAMETERS="root=/dev/mmcblk0p2 ro rootwait console=ttymxc0,115200" -U_BOOT_ROOT="" -U_BOOT_TIMEOUT="50" -U_BOOT_FDT="imx6sx-nitrogen6sx.dtb" -#U_BOOT_FDT_DIR="/boot/dtbs/" - From 61be31cb017e94df5d5f0414d105c340831ae5df Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Thu, 27 Aug 2020 16:40:14 +0200 Subject: [PATCH 05/10] nit6sx: initial bootloader adaptions The gen-bootscript.sh was copied verbatim from wandboard recipe. Note that nitrogen6sx is not part of debian u-boot-imx package and not even in upstream u-boot (yet). It will need to be built from the boundarydevices u-booti-imx6 fork. --- nit6sx/debimage-nit6sx.yaml | 33 ++++++++++++++++++++++++-------- nit6sx/scripts/gen-bootscript.sh | 26 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 8 deletions(-) create mode 100755 nit6sx/scripts/gen-bootscript.sh diff --git a/nit6sx/debimage-nit6sx.yaml b/nit6sx/debimage-nit6sx.yaml index dc92c01..5628e04 100644 --- a/nit6sx/debimage-nit6sx.yaml +++ b/nit6sx/debimage-nit6sx.yaml @@ -42,6 +42,15 @@ actions: chroot: true command: echo console=ttymxc0,115200 > /etc/kernel/cmdline + # Make dtb easy to find (normally flash-kernel does this for us) + - action: run + chroot: true + command: ln -rsf /usr/lib/linux-image-*-armmp/imx6sx-nitrogen6sx.dtb /boot/dtb + + - action: run + description: Generate boot-loader script + script: scripts/gen-bootscript.sh + - action: image-partition imagename: {{ $image }} imagesize: 1GB @@ -49,23 +58,31 @@ actions: mountpoints: - mountpoint: / partition: root - - mountpoint: /boot/firmware - partition: firmware - options: [ x-systemd.automount ] partitions: - - name: firmware - fs: fat32 - start: 0% - end: 64MB - name: root fs: ext4 - start: 64MB + start: 1MB end: 100% flags: [ boot ] - action: filesystem-deploy description: Deploying filesystem onto image + # The nitrogen6sx support is not yet in upstream u-boot, see: + # https://github.com/boundarydevices/u-boot-imx6/tree/boundary-v2018.07 + # (note: must be done after partition table writing or will be wiped!) + - action: raw + description: Write u-boot SPL + origin: filesystem + source: /usr/lib/u-boot/nitrogen6sx/SPL + offset: 1024 # bs=1k seek=1 + + - action: raw + description: Write u-boot full version + origin: filesystem + source: /usr/lib/u-boot/nitrogen6sx/u-boot.img + offset: 70656 # bs=1k seek=69 + - action: run description: Create block map file postprocess: true diff --git a/nit6sx/scripts/gen-bootscript.sh b/nit6sx/scripts/gen-bootscript.sh new file mode 100755 index 0000000..2a7e190 --- /dev/null +++ b/nit6sx/scripts/gen-bootscript.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# Puts below info in a script and generate boot.scr +# This script assumes it's executed from 'artifact directory' (/scratch) + +cat << 'EOF' > bootscr.txt +# debos wandboard boot script +# loadaddr=0x12000000 +# ramdiskaddr=0x13000000 +# fdt_addr=0x18000000 +# console=ttymxc0,115200 + +setenv prepbootargs 'if test -n "${console}"; then setenv bootargs "${bootargs} console=${console}" ; fi ; setenv bootargs ${bootargs} cma=256M ; setenv bootargs ${bootargs} root=LABEL=root' +#setenv bootargs ${bootargs} quiet + +setenv loadkernel 'load mmc 0 ${loadaddr} /vmlinuz' +setenv loadfdt 'load mmc 0 ${fdt_addr} /boot/dtb' +setenv loadrd 'load mmc 0 ${ramdiskaddr} /initrd.img && setenv rdsize $filesize' +setenv loadall 'run loadkernel; run loadfdt; run loadrd' + +setenv bootmmc 'mmc dev 0; run prepbootargs; run loadall; bootz ${loadaddr} ${ramdiskaddr}:${rdsize} ${fdt_addr}' + +run bootmmc + +EOF + +mkimage -A arm -T script -C none -n "Debos Wandboard script" -d bootscr.txt $ROOTDIR/boot/boot.scr From d9a198b8174b7abd985fb5eed030fe7ee2d32451 Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Wed, 2 Sep 2020 15:27:20 +0200 Subject: [PATCH 06/10] nit6sx: Use pre-built u-boot binary from boundarydevices.com The nit6sx support is not yet in upstream u-boot. We thus use boundarys official u-boot binary https://boundarydevices.com/wiki/u-boot/ says: > Where to get the latest binary for my platform? > > Our build server automatically generates and uploads all the latest binaries to this address: > > http://linode.boundarydevices.com/u-boot-images/ > > The README file contains the exact commit ID of this build images. The source for it is at https://github.com/boundarydevices/u-boot-imx6 --- nit6sx/debimage-nit6sx.yaml | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/nit6sx/debimage-nit6sx.yaml b/nit6sx/debimage-nit6sx.yaml index 5628e04..9cc4889 100644 --- a/nit6sx/debimage-nit6sx.yaml +++ b/nit6sx/debimage-nit6sx.yaml @@ -3,6 +3,11 @@ architecture: armhf actions: + - action: download + description: Download pre-built nit6sx u-boot binary + url: http://linode.boundarydevices.com/u-boot-images/u-boot.nitrogen6sx + name: bootloader + - action: debootstrap suite: buster components: @@ -71,17 +76,24 @@ actions: # The nitrogen6sx support is not yet in upstream u-boot, see: # https://github.com/boundarydevices/u-boot-imx6/tree/boundary-v2018.07 # (note: must be done after partition table writing or will be wiped!) - - action: raw - description: Write u-boot SPL - origin: filesystem - source: /usr/lib/u-boot/nitrogen6sx/SPL - offset: 1024 # bs=1k seek=1 - action: raw - description: Write u-boot full version - origin: filesystem - source: /usr/lib/u-boot/nitrogen6sx/u-boot.img - offset: 70656 # bs=1k seek=69 + description: Write u-boot binary to raw image load addr + origin: bootloader + source: . + offset: 1024 + + #- action: raw + # description: Write u-boot SPL + # origin: filesystem + # source: /usr/lib/u-boot/nitrogen6sx/SPL + # offset: 1024 # bs=1k seek=1 + + #- action: raw + # description: Write u-boot full version + # origin: filesystem + # source: /usr/lib/u-boot/nitrogen6sx/u-boot.img + # offset: 70656 # bs=1k seek=69 - action: run description: Create block map file From 6b7585c0272d22691f422f81f4e5bdd7f2e4cd81 Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Wed, 2 Sep 2020 15:29:44 +0200 Subject: [PATCH 07/10] nit6sx: Make sure ramdiskaddr is set in u-boot script The ramdiskaddr variable was not set in the built-in environment variables, so set it when needed. Also: - update comments to be in line with what's in the environment for this u-boot binary. - Replace mentions of wandboard with nit6sx. --- nit6sx/scripts/gen-bootscript.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/nit6sx/scripts/gen-bootscript.sh b/nit6sx/scripts/gen-bootscript.sh index 2a7e190..22f5264 100755 --- a/nit6sx/scripts/gen-bootscript.sh +++ b/nit6sx/scripts/gen-bootscript.sh @@ -3,11 +3,13 @@ # This script assumes it's executed from 'artifact directory' (/scratch) cat << 'EOF' > bootscr.txt -# debos wandboard boot script -# loadaddr=0x12000000 -# ramdiskaddr=0x13000000 -# fdt_addr=0x18000000 -# console=ttymxc0,115200 +# debos nit6sx boot script +# loadaddr=0x82000000 +env exists ramdiskaddr || setenv ramdiskaddr 84000000 +# fdt_addr=83000000 +# console=ttymxc0 +# baudrate=115200 + setenv prepbootargs 'if test -n "${console}"; then setenv bootargs "${bootargs} console=${console}" ; fi ; setenv bootargs ${bootargs} cma=256M ; setenv bootargs ${bootargs} root=LABEL=root' #setenv bootargs ${bootargs} quiet @@ -23,4 +25,4 @@ run bootmmc EOF -mkimage -A arm -T script -C none -n "Debos Wandboard script" -d bootscr.txt $ROOTDIR/boot/boot.scr +mkimage -A arm -T script -C none -n "Debos Nitrogen6SoloX script" -d bootscr.txt $ROOTDIR/boot/boot.scr From cfbe3f53e8815639617411f0914a8b946ad77dd5 Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Tue, 13 Apr 2021 12:08:54 +0000 Subject: [PATCH 08/10] nit6sx: Use template variable for mmc boot device This allows setting which mmc device u-boot should load kernel, dtb, initrd from when building the recipe. eg. debos -t mmcbootdev:1 nit6sx/debimage-nit6sx.yaml --- nit6sx/debimage-nit6sx.yaml | 3 ++- nit6sx/scripts/gen-bootscript.sh | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/nit6sx/debimage-nit6sx.yaml b/nit6sx/debimage-nit6sx.yaml index 9cc4889..4aa521c 100644 --- a/nit6sx/debimage-nit6sx.yaml +++ b/nit6sx/debimage-nit6sx.yaml @@ -1,4 +1,5 @@ {{- $image := or .image "debian-nit6sx.img" -}} +{{- $mmcbootdev := or .mmcbootdev "0" -}} architecture: armhf @@ -54,7 +55,7 @@ actions: - action: run description: Generate boot-loader script - script: scripts/gen-bootscript.sh + script: scripts/gen-bootscript.sh {{ $mmcbootdev }} - action: image-partition imagename: {{ $image }} diff --git a/nit6sx/scripts/gen-bootscript.sh b/nit6sx/scripts/gen-bootscript.sh index 22f5264..45f7a7b 100755 --- a/nit6sx/scripts/gen-bootscript.sh +++ b/nit6sx/scripts/gen-bootscript.sh @@ -2,7 +2,11 @@ # Puts below info in a script and generate boot.scr # This script assumes it's executed from 'artifact directory' (/scratch) -cat << 'EOF' > bootscr.txt +MMCBOOTDEV="${1:-0}" + +echo "Using 'mmc dev $MMCBOOTDEV' as boot device." + +cat << 'EOF' > bootscr.txt.in # debos nit6sx boot script # loadaddr=0x82000000 env exists ramdiskaddr || setenv ramdiskaddr 84000000 @@ -10,13 +14,14 @@ env exists ramdiskaddr || setenv ramdiskaddr 84000000 # console=ttymxc0 # baudrate=115200 +setenv mmcbootdev=@MMCBOOTDEV@ setenv prepbootargs 'if test -n "${console}"; then setenv bootargs "${bootargs} console=${console}" ; fi ; setenv bootargs ${bootargs} cma=256M ; setenv bootargs ${bootargs} root=LABEL=root' #setenv bootargs ${bootargs} quiet -setenv loadkernel 'load mmc 0 ${loadaddr} /vmlinuz' -setenv loadfdt 'load mmc 0 ${fdt_addr} /boot/dtb' -setenv loadrd 'load mmc 0 ${ramdiskaddr} /initrd.img && setenv rdsize $filesize' +setenv loadkernel 'load mmc ${mcbootdev} ${loadaddr} /vmlinuz' +setenv loadfdt 'load mmc ${mcbootdev} ${fdt_addr} /boot/dtb' +setenv loadrd 'load mmc ${mcbootdev} ${ramdiskaddr} /initrd.img && setenv rdsize $filesize' setenv loadall 'run loadkernel; run loadfdt; run loadrd' setenv bootmmc 'mmc dev 0; run prepbootargs; run loadall; bootz ${loadaddr} ${ramdiskaddr}:${rdsize} ${fdt_addr}' @@ -25,4 +30,6 @@ run bootmmc EOF +sed -e "s/@MMCBOOTDEV@/$MMCBOOTDEV/" < bootscr.txt.in > bootscr.txt + mkimage -A arm -T script -C none -n "Debos Nitrogen6SoloX script" -d bootscr.txt $ROOTDIR/boot/boot.scr From baf077b50335e9a09111d363215e331f7e5d0802 Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Tue, 13 Apr 2021 12:18:52 +0000 Subject: [PATCH 09/10] nit6sx: remove unused rpi script --- nit6sx/scripts/replace-u-boot-rpi.sh | 6 ------ 1 file changed, 6 deletions(-) delete mode 100755 nit6sx/scripts/replace-u-boot-rpi.sh diff --git a/nit6sx/scripts/replace-u-boot-rpi.sh b/nit6sx/scripts/replace-u-boot-rpi.sh deleted file mode 100755 index 71eabe5..0000000 --- a/nit6sx/scripts/replace-u-boot-rpi.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -set -e -wget http://ftp.us.debian.org/debian/pool/main/u/u-boot/u-boot-rpi_2018.09+dfsg-1_arm64.deb -dpkg -i u-boot-rpi_2018.09+dfsg-1_arm64.deb -rm u-boot-rpi_2018.09+dfsg-1_arm64.deb From 66cb210bc6b36031f9c491c7cd82a8feac6c94c7 Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Tue, 13 Apr 2021 21:05:19 +0000 Subject: [PATCH 10/10] nit6sx: fixes for 'Use template variable for mmc boot device' Use correct syntax with setenv and use correct variable name when reading the variable. --- nit6sx/scripts/gen-bootscript.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nit6sx/scripts/gen-bootscript.sh b/nit6sx/scripts/gen-bootscript.sh index 45f7a7b..984ca91 100755 --- a/nit6sx/scripts/gen-bootscript.sh +++ b/nit6sx/scripts/gen-bootscript.sh @@ -14,14 +14,14 @@ env exists ramdiskaddr || setenv ramdiskaddr 84000000 # console=ttymxc0 # baudrate=115200 -setenv mmcbootdev=@MMCBOOTDEV@ +setenv mmcbootdev '@MMCBOOTDEV@' setenv prepbootargs 'if test -n "${console}"; then setenv bootargs "${bootargs} console=${console}" ; fi ; setenv bootargs ${bootargs} cma=256M ; setenv bootargs ${bootargs} root=LABEL=root' #setenv bootargs ${bootargs} quiet -setenv loadkernel 'load mmc ${mcbootdev} ${loadaddr} /vmlinuz' -setenv loadfdt 'load mmc ${mcbootdev} ${fdt_addr} /boot/dtb' -setenv loadrd 'load mmc ${mcbootdev} ${ramdiskaddr} /initrd.img && setenv rdsize $filesize' +setenv loadkernel 'load mmc ${mmcbootdev} ${loadaddr} /vmlinuz' +setenv loadfdt 'load mmc ${mmcbootdev} ${fdt_addr} /boot/dtb' +setenv loadrd 'load mmc ${mmcbootdev} ${ramdiskaddr} /initrd.img && setenv rdsize $filesize' setenv loadall 'run loadkernel; run loadfdt; run loadrd' setenv bootmmc 'mmc dev 0; run prepbootargs; run loadall; bootz ${loadaddr} ${ramdiskaddr}:${rdsize} ${fdt_addr}'