Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107356484
D48382.id149101.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D48382.id149101.diff
View Options
diff --git a/release/Makefile.oracle b/release/Makefile.oracle
new file mode 100644
--- /dev/null
+++ b/release/Makefile.oracle
@@ -0,0 +1,81 @@
+#
+# Makefile for preparing & uploading Oracle Cloud images from existing
+# .raw files created by cloudware-release.
+#
+
+# base name for the final image to be uploaded via pre-approved curl URI
+ORACLE_BASENAME= ${OSRELEASE}-${BUILDDATE}${GITREV:C/^(.+)/-\1/}
+ORACLE_PORTS_LIST= ftp/curl emulators/qemu@nox11
+CLEANFILES+= cw-oracle-portinstall
+
+cw-oracle-portinstall: .PHONY
+.if !exists(/usr/local/bin/curl) || !exists(/usr/local/bin/qemu-img)
+. if !exists(${PORTSDIR}/Makefile)
+. if !exists(/usr/local/sbin/pkg-static)
+ env ASSUME_ALWAYS_YES=yes pkg bootstrap -yf
+. endif
+ env ASSUME_ALWAYS_YES=yes pkg install -y ${ORACLE_PORTS_LIST}
+. else
+ env UNAME_r=${UNAME_r} make -C \
+ ${PORTSDIR}/ftp/curl \
+ BATCH=1 WRKDIRPREFIX=/tmp/ports DISTDIR=/tmp/distfiles \
+ all install clean
+ # TODO we only need qemu-img but tools flavor does not do zstd yet
+ env UNAME_r=${UNAME_r} FLAVOR=nox11 make -C \
+ ${PORTSDIR}/emulators/qemu \
+ BATCH=1 WRKDIRPREFIX=/tmp/ports DISTDIR=/tmp/distfiles \
+ all install clean
+. endif
+.endif
+
+.for _FS in ${ORACLE_FSLIST}
+ORACLE_OCI_LIST+= cw-oracle-${_FS}.oci
+ORACLE_UPLOAD_LIST+= cw-oracle-upload-${_FS}
+CLEANFILES+= cw-oracle-${_FS}.oci
+ORACLE_TMP= cw-oracle-${_FS}.oci.tmpdir
+CLEANDIRS+= ${ORACLE_TMP}
+ORACLE_METADATA= ${.CURDIR}/scripts/oracle
+.if ${TARGET} == "arm64"
+ORACLE_SHAPES_FILE= ${ORACLE_METADATA}/arm64_shape_compatibilities.json
+.else
+ORACLE_SHAPES_FILE= ${ORACLE_METADATA}/default_shape_compatibilities.json
+.endif
+
+cw-oracle-${_FS}.oci: cw-oracle-${_FS}-raw
+ mkdir -p ${ORACLE_TMP}
+ # create architecture-specific metadata
+ sed -e s/REPLACE_OPERATING_SYSTEM_TYPE/${TYPE}/ \
+ -e s/REPLACE_OPERATING_SYSTEM_VERSION/${OSRELEASE}/ \
+ -e '/REPLACE_IMAGE_CAPABILITY_DATA/{' \
+ -e 'r ${ORACLE_METADATA}/image_capability_data.raw' -e d -e '}' \
+ -e '/REPLACE_SHAPE_COMPATIBILITIES/{' \
+ -e 'r ${ORACLE_SHAPES_FILE}' -e d -e '}' \
+ < ${ORACLE_METADATA}/image_metadata.json \
+ > ${ORACLE_TMP}/image_metadata.json
+
+ # convert raw to native qcow2 for zstd compression, saves ~ 8GiB
+ qemu-img convert -S 512b -p -O qcow2 -c -o compression_type=zstd \
+ ${.OBJDIR}/${ORACLE${_FS:tu}RAWIMAGE} \
+ ${ORACLE_TMP}/output.QCOW2
+
+ # Create GNU-compatible tarball using BSD tar
+ tar --format=gnutar -cf ${.TARGET} -C ${ORACLE_TMP} \
+ image_metadata.json output.QCOW2
+
+ echo "Oracle image ${.TARGET} is ready for upload."
+
+cw-oracle-upload-${_FS}: cw-oracle-${_FS}.oci
+.if !defined(ORACLE_PAR_URL) || empty(ORACLE_PAR_URL)
+ @echo "--------------------------------------------------------------"
+ @echo ">>> ORACLE_PAR_URL must be set for Oracle image upload"
+ @echo "--------------------------------------------------------------"
+ @false
+.endif
+ echo "Please wait ... uploading cw-oracle-${_FS}.oci to ${ORACLE_BASENAME}-${_FS}.oci"
+ curl -s ${ORACLE_PAR_URL}/${ORACLE_BASENAME}-${_FS}.oci --upload-file cw-oracle-${_FS}.oci
+ echo "Uploaded cw-oracle-${_FS}.oci as ${ORACLE_BASENAME}-${_FS}.oci"
+ touch ${.TARGET}
+.endfor
+
+cw-oracle-prepare: ${ORACLE_OCI_LIST}
+cw-oracle-upload: cw-oracle-portinstall ${ORACLE_UPLOAD_LIST}
diff --git a/release/Makefile.vm b/release/Makefile.vm
--- a/release/Makefile.vm
+++ b/release/Makefile.vm
@@ -274,5 +274,6 @@
.include "${.CURDIR}/Makefile.ec2"
.include "${.CURDIR}/Makefile.firecracker"
.include "${.CURDIR}/Makefile.gce"
+.include "${.CURDIR}/Makefile.oracle"
.include "${.CURDIR}/Makefile.vagrant"
.include "${.CURDIR}/Makefile.inc1"
diff --git a/release/scripts/oracle/arm64_shape_compatibilities.json b/release/scripts/oracle/arm64_shape_compatibilities.json
new file mode 100644
--- /dev/null
+++ b/release/scripts/oracle/arm64_shape_compatibilities.json
@@ -0,0 +1,24 @@
+[
+ {
+ "internalShapeName": "VM.Standard.A1.Flex",
+ "ocpuConstraints": {
+ "min": 1,
+ "max": 80
+ },
+ "memoryConstraints": {
+ "minInGBs": 1,
+ "maxInGBs": 512
+ }
+ },
+ {
+ "internalShapeName": "VM.Standard.A2.Flex",
+ "ocpuConstraints": {
+ "min": 1,
+ "max": 78
+ },
+ "memoryConstraints": {
+ "minInGBs": 1,
+ "maxInGBs": 946
+ }
+ }
+]
diff --git a/release/scripts/oracle/default_shape_compatibilities.json b/release/scripts/oracle/default_shape_compatibilities.json
new file mode 100644
--- /dev/null
+++ b/release/scripts/oracle/default_shape_compatibilities.json
@@ -0,0 +1 @@
+[]
diff --git a/release/scripts/oracle/image_capability_data.raw b/release/scripts/oracle/image_capability_data.raw
new file mode 100644
--- /dev/null
+++ b/release/scripts/oracle/image_capability_data.raw
@@ -0,0 +1 @@
+"imageCapabilityData": "{\"capabilities\":{\"Compute.AMD_SecureEncryptedVirtualization\":{\"descriptorType\":\"boolean\",\"defaultValue\":false},\"Storage.BootVolumeType\":{\"descriptorType\":\"enumstring\",\"values\":[\"ISCSI\",\"PARAVIRTUALIZED\",\"SCSI\",\"IDE\",\"NVME\"],\"defaultValue\":\"PARAVIRTUALIZED\"},\"Storage.Iscsi.MultipathDeviceSupported\":{\"descriptorType\":\"boolean\",\"defaultValue\":false},\"Storage.ParaVirtualization.EncryptionInTransit\":{\"descriptorType\":\"boolean\",\"defaultValue\":true},\"Storage.ConsistentVolumeNaming\":{\"descriptorType\":\"boolean\",\"defaultValue\":true},\"Compute.SecureBoot\":{\"descriptorType\":\"boolean\",\"defaultValue\":false},\"Storage.ParaVirtualization.AttachmentVersion\":{\"descriptorType\":\"enuminteger\",\"values\":[1,2],\"defaultValue\":2},\"Storage.LocalDataVolumeType\":{\"descriptorType\":\"enumstring\",\"values\":[\"ISCSI\",\"PARAVIRTUALIZED\",\"SCSI\",\"IDE\",\"NVME\"],\"defaultValue\":\"PARAVIRTUALIZED\"},\"Network.AttachmentType\":{\"descriptorType\":\"enumstring\",\"values\":[\"PARAVIRTUALIZED\",\"VDPA\"],\"defaultValue\":\"PARAVIRTUALIZED\"},\"Storage.RemoteDataVolumeType\":{\"descriptorType\":\"enumstring\",\"values\":[\"ISCSI\",\"PARAVIRTUALIZED\",\"SCSI\",\"IDE\",\"NVME\"],\"defaultValue\":\"PARAVIRTUALIZED\"},\"Compute.LaunchMode\":{\"descriptorType\":\"enumstring\",\"values\":[\"NATIVE\",\"EMULATED\",\"VDPA\",\"PARAVIRTUALIZED\",\"CUSTOM\"],\"defaultValue\":\"PARAVIRTUALIZED\"},\"Network.IPv6Only\":{\"descriptorType\":\"boolean\",\"defaultValue\":false},\"Compute.Firmware\":{\"descriptorType\":\"enumstring\",\"values\":[\"BIOS\",\"UEFI_64\"],\"defaultValue\":\"UEFI_64\"}}}\n",
diff --git a/release/scripts/oracle/image_metadata.json b/release/scripts/oracle/image_metadata.json
new file mode 100644
--- /dev/null
+++ b/release/scripts/oracle/image_metadata.json
@@ -0,0 +1,22 @@
+{
+ "version": 2,
+ "externalLaunchOptions": {
+ "firmware": "UEFI_64",
+ "networkType": "PARAVIRTUALIZED",
+ "bootVolumeType": "PARAVIRTUALIZED",
+ "remoteDataVolumeType": "PARAVIRTUALIZED",
+ "localDataVolumeType": "PARAVIRTUALIZED",
+ "launchOptionsSource": "PARAVIRTUALIZED",
+ "pvAttachmentVersion": 2,
+ "pvEncryptionInTransitEnabled": false,
+ "consistentVolumeNamingEnabled": false
+ },
+ "imageCapabilityData": "REPLACE_IMAGE_CAPABILITY_DATA",
+ "imageCapsFormatVersion": "23cfd738-ad9c-4f56-9281-67be6c8cd14c",
+ "operatingSystem": "REPLACE_OPERATING_SYSTEM_TYPE",
+ "operatingSystemVersion": "REPLACE_OPERATING_SYSTEM_VERSION",
+ "additionalMetadata": {
+ "shapeCompatibilities":
+ "REPLACE_SHAPE_COMPATIBILITIES"
+ }
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 13, 11:45 PM (21 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15788799
Default Alt Text
D48382.id149101.diff (7 KB)
Attached To
Mode
D48382: release: add cloudware oracle targets to package and upload .oci files
Attached
Detach File
Event Timeline
Log In to Comment