Skip to content

Commit

Permalink
nxp:ls1012a : Add support to build image for NXP board
Browse files Browse the repository at this point in the history
This changelist will create a compressed raw image as required
by NXP ls1012a ARM-64 based board.
This image can be flashed to a SD Card and boot the
NXP ls1012a board.

Change-Id: I0e24be7dbbb43428e70041aa00a0306101fd1c71
Signed-off-by: srinidhira0 <[email protected]>
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6393
Tested-by: gerrit-photon <[email protected]>
Reviewed-by: Alexey Makhalov <[email protected]>
  • Loading branch information
srinidhira0 authored and YustasSwamp committed Dec 21, 2018
1 parent 95c5933 commit b4ad9cb
Show file tree
Hide file tree
Showing 14 changed files with 442 additions and 18 deletions.
8 changes: 8 additions & 0 deletions SPECS/linux-firmware/generate-linux-firmware-tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ DST=linux-firmware-$DATE_TAG
mkdir $DST

git clone https://github.com/RPi-Distro/firmware-nonfree.git --depth=1
git clone https://github.com/NXP/qoriq-engine-pfe-bin.git --depth=1
git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git --depth=1

cp linux-firmware/WHENCE $DST/
Expand All @@ -27,4 +28,11 @@ cp firmware-nonfree/LICENCE.broadcom_bcm43xx $DST/
cp -a linux-firmware/rsi $DST/
cp linux-firmware/rsi_91x.fw $DST/

# NXP ls1012a FRWY requires:
mkdir $DST/ls1012a_ppe/
cp qoriq-engine-pfe-bin/ls1012a/slow_path/ppfe_class_ls1012a.elf $DST/ls1012a_ppe/
cp qoriq-engine-pfe-bin/ls1012a/slow_path/ppfe_tmu_ls1012a.elf $DST/ls1012a_ppe/
cp qoriq-engine-pfe-bin/NXP-Binary-EULA.txt $DST/ls1012a_ppe/


tar -czvf $DST.tar.gz $DST
14 changes: 10 additions & 4 deletions SPECS/linux-firmware/linux-firmware.spec
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
%global debug_package %{nil}
%global __os_install_post %{nil}
%global _firmwarepath /lib/firmware
%define _binaries_in_noarch_packages_terminate_build 0

Summary: Linux Firmware
Name: linux-firmware
Version: 20181010
Version: 20181129
Release: 1%{?dist}
License: GPL+ and GPLv2+ and MIT and Redistributable, no modification permitted
URL: http://www.kernel.org/
Group: System Environment/Kernel
Vendor: VMware, Inc.
Distribution: Photon
Source0: %{name}-%{version}.tar.gz
%define sha1 linux=b0ac86dbd7eac291a6ce6a53c2aaae4ca83e665e
%define sha1 linux=73b5cab414c26bac116d6c5d976287bfb913b68c
BuildArch: noarch

%description
Expand All @@ -26,12 +29,15 @@ mkdir -p %{buildroot}%{_firmwarepath}
cp -r brcm %{buildroot}%{_firmwarepath}
cp -r rsi %{buildroot}%{_firmwarepath}
cp rsi_91x.fw %{buildroot}%{_firmwarepath}

cp ls1012a_ppe/ppfe_class_ls1012a.elf %{buildroot}%{_firmwarepath}
cp ls1012a_ppe/ppfe_tmu_ls1012a.elf %{buildroot}%{_firmwarepath}
cp ls1012a_ppe/NXP-Binary-EULA.txt %{buildroot}%{_firmwarepath}
%files
%defattr(-,root,root)
%{_firmwarepath}/*

%changelog
* Thu Nov 29 2018 Srinidhi Rao <[email protected]> 20181129-1
- Updated pfe firmware files for NXP LS1012A FRWY board
* Wed Oct 10 2018 Ajay Kaher <[email protected]> 20181010-1
- Updated brcm firmwares for Rpi B and Rpi B+
* Thu Aug 23 2018 Alexey Makhalov <[email protected]> 20180823-1
Expand Down
26 changes: 17 additions & 9 deletions SPECS/linux/config_aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ CONFIG_PCI_HOST_THUNDER_ECAM=y
CONFIG_PCIE_DW=y
CONFIG_PCIE_DW_HOST=y
# CONFIG_PCIE_DW_PLAT_HOST is not set
# CONFIG_PCI_LAYERSCAPE is not set
CONFIG_PCI_LAYERSCAPE=y
CONFIG_PCI_HISI=y
CONFIG_PCIE_QCOM=y
CONFIG_PCIE_ARMADA_8K=y
Expand Down Expand Up @@ -441,7 +441,7 @@ CONFIG_SETEND_EMULATION=y
#
CONFIG_ARM64_HW_AFDBM=y
CONFIG_ARM64_PAN=y
# CONFIG_ARM64_LSE_ATOMICS is not set
CONFIG_ARM64_LSE_ATOMICS=y
CONFIG_ARM64_VHE=y

#
Expand Down Expand Up @@ -1725,7 +1725,7 @@ CONFIG_VEXPRESS_SYSCFG=y
# EEPROM support
#
# CONFIG_EEPROM_AT24 is not set
# CONFIG_EEPROM_AT25 is not set
CONFIG_EEPROM_AT25=y
# CONFIG_EEPROM_LEGACY is not set
# CONFIG_EEPROM_MAX6875 is not set
CONFIG_EEPROM_93CX6=m
Expand Down Expand Up @@ -2647,7 +2647,7 @@ CONFIG_SERIAL_8250_DW=y
# CONFIG_SERIAL_8250_RT288X is not set
# CONFIG_SERIAL_8250_MT6577 is not set
# CONFIG_SERIAL_8250_MOXA is not set
# CONFIG_SERIAL_OF_PLATFORM is not set
CONFIG_SERIAL_OF_PLATFORM=y

#
# Non-8250 serial port support
Expand Down Expand Up @@ -2836,7 +2836,7 @@ CONFIG_I2C_XGENE_SLIMPRO=m
CONFIG_SPI=y
# CONFIG_SPI_DEBUG is not set
CONFIG_SPI_MASTER=y
# CONFIG_SPI_MEM is not set
CONFIG_SPI_MEM=y

#
# SPI Master Controller Drivers
Expand Down Expand Up @@ -4626,7 +4626,8 @@ CONFIG_MMC_BLOCK_MINORS=16
# MMC/SD/SDIO Host Controller Drivers
#
# CONFIG_MMC_DEBUG is not set
# CONFIG_MMC_ARMMMCI is not set
CONFIG_MMC_ARMMMCI=y
CONFIG_MMC_QCOM_DML=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_IO_ACCESSORS=y
CONFIG_MMC_SDHCI_PCI=m
Expand All @@ -4635,7 +4636,7 @@ CONFIG_MMC_SDHCI_ACPI=m
CONFIG_MMC_SDHCI_PLTFM=y
# CONFIG_MMC_SDHCI_OF_ARASAN is not set
# CONFIG_MMC_SDHCI_OF_AT91 is not set
# CONFIG_MMC_SDHCI_OF_ESDHC is not set
CONFIG_MMC_SDHCI_OF_ESDHC=y
# CONFIG_MMC_SDHCI_OF_DWCMSHC is not set
# CONFIG_MMC_SDHCI_CADENCE is not set
# CONFIG_MMC_SDHCI_TEGRA is not set
Expand All @@ -4646,7 +4647,7 @@ CONFIG_MMC_SDHCI_IPROC=y
# CONFIG_MMC_MESON_MX_SDIO is not set
CONFIG_MMC_SDHCI_MSM=m
# CONFIG_MMC_TIFM_SD is not set
# CONFIG_MMC_SPI is not set
CONFIG_MMC_SPI=y
# CONFIG_MMC_CB710 is not set
# CONFIG_MMC_VIA_SDMMC is not set
# CONFIG_MMC_DW is not set
Expand Down Expand Up @@ -5289,7 +5290,14 @@ CONFIG_OF_PMEM=y
CONFIG_DAX_DRIVER=y
CONFIG_DAX=y
CONFIG_DEV_DAX=m
# CONFIG_NVMEM is not set
CONFIG_NVMEM=y
# CONFIG_MTK_EFUSE is not set
# CONFIG_QCOM_QFPROM is not set
# CONFIG_ROCKCHIP_EFUSE is not set
CONFIG_NVMEM_BCM_OCOTP=y
# CONFIG_NVMEM_SUNXI_SID is not set
# CONFIG_MESON_EFUSE is not set
# CONFIG_MESON_MX_EFUSE is not set

#
# HW tracing support
Expand Down
18 changes: 17 additions & 1 deletion SPECS/linux/linux.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Summary: Kernel
Name: linux
Version: 4.19.6
Release: 1%{?kat_build:.%kat_build}%{?dist}
Release: 2%{?kat_build:.%kat_build}%{?dist}
License: GPLv2
URL: http://www.kernel.org/
Group: System Environment/Kernel
Expand Down Expand Up @@ -122,6 +122,14 @@ Group: System Environment/Kernel
Requires: %{name} = %{version}-%{release}
%description dtb-rpi3
Kernel Device Tree Blob files for Raspberry Pi3

%package dtb-ls1012afrwy
Summary: Kernel Device Tree Blob files for NXP ls1012a FRWY board
Group: System Environment/Kernel
Requires: %{name} = %{version}-%{release}
%description dtb-ls1012afrwy
Kernel Device Tree Blob files for NXP ls1012a FRWY board

%endif


Expand Down Expand Up @@ -241,6 +249,7 @@ install -vm 644 arch/arm64/boot/Image %{buildroot}/boot/vmlinuz-%{uname_r}
# Install DTB files
install -vdm 755 %{buildroot}/boot/dtb
install -vm 640 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dtb %{buildroot}/boot/dtb/
install -vm 640 arch/arm64/boot/dts/freescale/fsl-ls1012a-frdm.dtb %{buildroot}/boot/dtb/
%endif

# Restrict the permission on System.map-X file
Expand Down Expand Up @@ -369,9 +378,16 @@ ln -sf %{name}-%{uname_r}.cfg /boot/photon.cfg
%files dtb-rpi3
%defattr(-,root,root)
/boot/dtb/bcm2837-rpi-3-b.dtb

%files dtb-ls1012afrwy
%defattr(-,root,root)
/boot/dtb/fsl-ls1012a-frdm.dtb

%endif

%changelog
* Wed Dec 19 2018 Srinidhi Rao <[email protected]> 4.19.6-2
- Add NXP LS1012A support.
* Mon Dec 10 2018 Srivatsa S. Bhat (VMware) <[email protected]> 4.19.6-1
- Update to version 4.19.6
* Fri Dec 07 2018 Alexey Makhalov <[email protected]> 4.19.1-3
Expand Down
14 changes: 14 additions & 0 deletions common/data/packages_ls1012afrwy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"packages":["glibc", "zlib", "filesystem",
"pkg-config", "bash", "bzip2", "shadow", "procps-ng",
"coreutils", "bc", "libtool", "net-tools", "findutils", "xz",
"iproute2", "util-linux", "kmod", "linux", "linux-dtb-ls1012afrwy",
"ca-certificates", "curl", "iptables", "Linux-PAM", "systemd",
"dbus", "file", "e2fsprogs", "rpm","gawk","gptfdisk",
"openssh", "gdbm", "parted", "linux-firmware",
"photon-release", "photon-repos",
"sed", "grep", "cpio", "gzip", "vim", "libdb", "tdnf",
"which", "tzdata", "motd", "gdbm" ]
}


21 changes: 17 additions & 4 deletions support/image-builder/imagegenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import re
import shutil
import tarfile
import lzma as xz
import fileinput
from argparse import ArgumentParser
import json
Expand Down Expand Up @@ -158,9 +159,18 @@ def createOutputArtifact(raw_image_path, config, src_root, tools_bin_path):
os.remove(raw_image)

def generateCompressedFile(inputfile, outputfile, formatstring):
tarout = tarfile.open(outputfile, formatstring)
tarout.add(inputfile, arcname=os.path.basename(inputfile))
tarout.close()
if formatstring == "w:xz":
in_file = open(inputfile, 'rb')
in_data = in_file.read()

out_file = open(inputfile+".xz", 'wb')
out_file.write(xz.compress(in_data))
in_file.close()
out_file.close()
else:
tarout = tarfile.open(outputfile, formatstring)
tarout.add(inputfile, arcname=os.path.basename(inputfile))
tarout.close()

def generateImage(raw_image_path, additional_rpms_path, tools_bin_path, src_root, config):
working_directory = os.path.dirname(raw_image_path)
Expand All @@ -176,8 +186,11 @@ def generateImage(raw_image_path, additional_rpms_path, tools_bin_path, src_root
device_name = disk_device.split('/')[2]
if not device_name:
raise Exception("Could not create loop device and partition")

loop_device_path = "/dev/mapper/{}p2".format(device_name)


print(loop_device_path)

try:
(uuidval, partuuidval) = generateUuid(loop_device_path)
# Prep the loop device
Expand Down
21 changes: 21 additions & 0 deletions support/image-builder/ls1012afrwy/config_ls1012afrwy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"image_type": "ls1012afrwy",
"hostname": "photon-machine",
"password":
{
"crypted": false,
"text": "PASSWORD"
},
"packagelist_file": "packages_ls1012afrwy.json",
"size": {"root": "1", "swap": "0"},
"boot":"bios",
"public_key":"<ssh-key-here>",
"postinstallscripts": ["ls1012afrwy-custom-patch.sh"],
"additionalfiles": [
{"resizefs.sh": "/usr/local/bin/resizefs.sh"},
{"resizefs.service": "/lib/systemd/system/resizefs.service"}
],
"artifacttype": "xz",
"keeprawdisk": "true"
}

Binary file not shown.
12 changes: 12 additions & 0 deletions support/image-builder/ls1012afrwy/ls1012afrwy-custom-patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

echo -e "changeme\nchangeme" | passwd root
chage -d 0 -M 999 root

echo "/dev/mmcblk0p3 swap swap defaults 0 0" >> /etc/fstab

chmod +x /usr/local/bin/resizefs.sh
ln -s /lib/systemd/system/resizefs.service /etc/systemd/system/multi-user.target.wants/resizefs.service
ln -s /lib/systemd/system/sshd-keygen.service /etc/systemd/system/multi-user.target.wants/sshd-keygen.service
ln -s /lib/systemd/system/sshd.service /etc/systemd/system/multi-user.target.wants/sshd.service

67 changes: 67 additions & 0 deletions support/image-builder/ls1012afrwy/mk-prepare-system.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash
#################################################
# Title: mk-prepare-system #
# Date: 2014-11-26 #
# Version: 1.0 #
# Author: [email protected] #
# Options: #
#################################################
# Overview
# Preparing the system to install photon
# End
#
set -o errexit # exit if error...insurance ;
set -o nounset # exit if variable not initalized
set +h # disable hashall
SCRIPT_PATH=$(dirname $(realpath -s $0))
INSTALLER_PATH=$SCRIPT_PATH/../../../installer
source ${INSTALLER_PATH}/config.inc # configuration parameters
source ${INSTALLER_PATH}/function.inc
PRGNAME=${0##*/} # script name minus the path

LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}" # set log file name
#LOGFILE=/dev/null # uncomment to disable log file

[ ${EUID} -eq 0 ] || fail "${PRGNAME}: Need to be root user: FAILURE"
[ -z ${BUILDROOT} ] && fail "${PRGNAME}: Build root not set: FAILURE"


mnt_nd=`mount -v -f -l`

echo $mnt_nd

cd ${BUILDROOT} || fail "${PRGNAME}: Change directory: ${BUILDROOT}: FAILURE"

#
# Setup the filesystem for chapter 06
#
if [[ $# -gt 0 ]] && [[ $1 == 'install' ]]; then
mkdir -p ${BUILDROOT}/var/lib/rpm
mkdir -p ${BUILDROOT}/cache/tdnf
rpm --root ${BUILDROOT} --initdb
tdnf install filesystem --installroot ${BUILDROOT} --nogpgcheck --assumeyes
else
RPMPKG="$(find RPMS -name 'filesystem-[0-9]*.rpm' -print)"
[ -z ${RPMPKG} ] && fail " Filesystem rpm package missing: Can not continue"
run_command " Installing filesystem" "rpm -Uvh --nodeps --root ${BUILDROOT} --dbpath /var/lib/rpm ${RPMPKG}" "${LOGFILE}"
fi

# Ommited in the filesystem.spec file - not needed for booting
[ -e ${BUILDROOT}/dev/console ] || mknod -m 600 ${BUILDROOT}/dev/console c 5 1
[ -e ${BUILDROOT}/dev/null ] || mknod -m 666 ${BUILDROOT}/dev/null c 1 3
[ -e ${BUILDROOT}/dev/random ] || mknod -m 444 ${BUILDROOT}/dev/random c 1 8
[ -e ${BUILDROOT}/dev/urandom ] || mknod -m 444 ${BUILDROOT}/dev/urandom c 1 9

if [[ $# -eq 0 ]] || [[ $1 != 'install' ]]; then
chown -R 0:0 ${BUILDROOT}/* || :
fi

#
# Mount kernel filesystem
#
#if ! mountpoint ${BUILDROOT}/dev >/dev/null 2>&1; then mount --rbind /dev ${BUILDROOT}/dev; mount --make-rslave ${BUILDROOT}/dev; fi
#if ! mountpoint ${BUILDROOT}/proc >/dev/null 2>&1; then mount -t proc proc ${BUILDROOT}/proc; fi
#if ! mountpoint ${BUILDROOT}/sys >/dev/null 2>&1; then mount -t sysfs sysfs ${BUILDROOT}/sys; fi
#if ! mountpoint ${BUILDROOT}/run >/dev/null 2>&1; then mount -t tmpfs tmpfs ${BUILDROOT}/run; fi
#if [ -h ${BUILDROOT}/dev/shm ]; then mkdir -pv ${BUILDROOT}/$(readlink ${BUILDROOT}/dev/shm); fi
exit 0
Loading

0 comments on commit b4ad9cb

Please sign in to comment.