Deploying and running a redpesk image for M3/H3 boards

It consists of copying raw image on an sdcard.

See Renesas specification for M3 and H3 on renesas website.

Download images

See Download Images section

Download Renesas Gen3 image from command line

Create a directory for downloading image:

mkdir ~/redpeskimage
cd ~/redpeskimage
wget -r -nd -nc --no-parent -A "redpesk*smack*" 'https://download.redpesk.bzh/redpesk-lts/arz-1.0-update/images/smack/minimal/aarch64/renesas-gen3/latest'

Copying the image on your sdcard

Plug in your sdcard and Find it (be sure it is unmounted)

Copy the correct device path thanks to the command below. It should be a hotplug device.

lsblk -dli -o PATH,VENDOR,TYPE,HOTPLUG,MODEL

DEVICE_TO_COPY='/dev/<hotplug_device>' #in the example it is /dev/sdc

Example:

$ lsblk -dli -o PATH,VENDOR,TYPE,HOTPLUG,MODEL
PATH         VENDOR   TYPE HOTPLUG MODEL
/dev/sda     ATA      disk       0 WDC_WD10SPZX-08Z10
/dev/sdc     TS-RDF5  disk       1 SD_Transcend #MYSDCARD
/dev/nvme0n1          disk       0 LITEON T11 512
DEVICE_TO_COPY=/dev/sdc

Or if only one device is hotpluggable on your computer:

# need jq
DEVICE_TO_COPY=$(lsblk -dlJ -o PATH,VENDOR,TYPE,HOTPLUG,MODEL | jq -r '.blockdevices[] | select(.hotplug == true).path')
echo $DEVICE_TO_COPY

Umount if needed

lsblk $DEVICE_TO_COPY
# need to umount each partition
sudo umount <part*>

Example:

$ lsblk /dev/sdc
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdc      8:32   1 14.6G  0 disk
├─sdc1   8:33   1  501M  0 part /run/media/iotbzh/0409-3A02
├─sdc2   8:34   1    1G  0 part /run/media/iotbzh/cd3c87ec-1011-4832-aef3-6be0ed3d3748
└─sdc3   8:35   1  2.5G  0 part /run/media/iotbzh/4e508264-8ce2-447f-a829-e4c31ea20047
$ sudo umount /run/media/iotbzh/*

Flash sdcard using dd

Prerequisites

  • device is plugged in, found, unmounted
unxz redpesk*.raw.xz
IMAGE=$(ls redpesk*.raw)
sudo dd if=$IMAGE of=$DEVICE_TO_COPY bs=4M status=progress

Power on m3/h3

Prerequisites

  • sdcard copied and plugged into Renesas board
  • keyboard, screen plugged into Renesas board (optional)
  • ethernet cable plugged (optional)
  • Micro USB-A cable for serial console plugged (optional: for uboot configuration)

Uboot configuration

If not already done, you’ll have to configure Uboot parameters.

  1. Connect your host to the serial port on the Renesas board using a USB cable and determine the device created for the serial link using dmesg on your host (usually it is /dev/ttyUSB0 but it may be different if other USB serial ports are connected to your host):

    $ dmesg | tail 9
    [893087.548231] usb 1-1.4: new full-speed USB device number 99 using xhci_hcd
    [893087.659494] usb 1-1.4: New USB device found, idVendor=0403, idProduct=6001,bcdDevice= 6.00
    [893087.659514] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [893087.659524] usb 1-1.4: Product: FT232R USB UART
    [893087.659533] usb 1-1.4: Manufacturer: FTDI
    [893087.659539] usb 1-1.4: SerialNumber: AK04WWFN
    [893087.670875] ftdi_sio 1-1.4:1.0: FTDI USB Serial Device converter detected
    [893087.670988] usb 1-1.4: Detected FT232RL
    [893087.671943] usb 1-1.4: FTDI USB Serial Device converter now attached to ttyUSB0
    
  2. Start a terminal emulator on the USB serial port:

    Here, we use ‘screen’ on device /dev/ttyUSB0 but you could use any terminal emulator able to open the serial port at 115200 bauds (minicom , picocom …)

    minicom -b 115200 -D /dev/ttyUSB0
    

    or

    picocom -b 115200 /dev/ttyUSB0
    

    or

    screen /dev/ttyUSB0 115200
    
  3. Power up the board : short press the power button on the board.

  4. Break at uboot prompt (press any key)

  5. Set the following uboot variables :

    WARNING: don’t make a big copy/paste or some garbage characters may be sent to the console (issue with usb/serial port buffering?). Instead, copy one or two lines at a time.

    1. Set the right dtb file for your board:

      • H3

         setenv dtbfile r8a77951-ulcb.dtb
        
      • H3 KINGFISHER

         setenv dtbfile r8a77951-ulcb-kf.dtb
        
      • M3

         setenv dtbfile r8a77960-ulcb.dtb
        
      • M3 KINGFISHER

         setenv dtbfile r8a77960-ulcb-kf.dtb
        
    2. Set common uboot config:

      # For KINGFISHER
      ROOTPART=/dev/mmcblk0p4
      # else
      ROOTPART=/dev/mmcblk1p4
      
      setenv bootmmc '0:1'; setenv bootkaddr 0x48080000; setenv bootdaddr 0x48000000; setenv bootargs console=ttySC0,115200 ignore_loglevel vmalloc=384M video=HDMI-A-1:1920x1080-32@60 root=$ROOTPART   rw rootfstype=ext4 rootwait rootdelay=2
      setenv bootcmd 'ext4load mmc ${bootmmc} ${bootkaddr} Image; ext4load mmc ${bootmmc} ${bootdaddr} ${dtbfile}; booti ${bootkaddr} - ${bootdaddr}'
      
    3. Save Uboot environment (optional):

    If you want you can save environment in NV flash:

       saveenv
    
  6. Boot the board

    At uboot prompt, type:

    run bootcmd
    

Alternatively, simply reset the board.

Note: default credentials of images are login root, password root.

Wait and keep calm, it is booting!

Connect to the board over SSH

It needs ethernet cable plugged into the board, and getting the ip.

  • User: root
  • Password: root

Getting the ip on target

# on board
ip a

On your computer:

# on computer
ssh root@<ip_found>

Qemu

Optionally the gen3 image can be booted with qemu. In this case, u-boot is not used to load the kernel and no graphics
and specific hardware will be available. It is like the aarch64 generic qemu boot explained here : here. You must at least do the prerequisites step here.

Extract the kernel for the image

Use virt-copy-out to extract kernel of the downloaded image after extracting the raw file. Example :

$ unxz redpesk*.raw.xz
$ sudo virt-copy-out -a redpesk-*.raw /boot/Image .
download: /boot/Image -> ./Image

Launch the Qemu

IMAGE_NAME="$(ls redpesk*.raw)"
KERNEL_IMAGE="Image"
PORT_SSH=3333

qemu-system-aarch64 \
        -hda $IMAGE_NAME \
        -kernel $KERNEL_IMAGE \
        -machine accel=tcg,type=virt \
        -m 2048 \
        -cpu cortex-a57 \
        -smp 4 \
        -append 'console=ttyAMA0,115200 root=/dev/vda4 security=smack' \
        -net nic -net user,hostfwd=tcp::$PORT_SSH-:22 \
        -display none \
        -nographic \
        -snapshot

Wait! It is booting…

Default root password is root.

Installing a package

See this section for installing and starting helloworld-binding: Install helloworld binding