These scripts are used to create openEuler cloud image for AWS.
-
Install build dependencies and prepare.
- Ensure
make
,docker
,awscli
,jq
,qemu-utils
,partprobe
andfdisk
are installed. - Make sure AWS config file
~/.aws/config
is configured (generated by commandaws configure
).
- Ensure
-
Preparation
- Download openEuler qcow2 image and shrink its partition size to 8G, then convert qcow2 image to RAW format.
- Upload openEuler RAW image to AWS S3 bucket, then create snapshot from this bucket and create base AMI image from this snapshot.
AWS_BUCKET_NAME=<bucket_name> \ OPENEULER_ARCH=<arch_name> \ OPENEULER_VERSION=<version> \ make prep
- Environment variables:
AWS_BUCKET_NAME
: AWS S3 bucket name, requiredOPENEULER_ARCH
: openEuler arch, default is x86_64OPENEULER_VERSION
: openEuler version, default is22.03-LTS
-
Use packer to create AMI image from base AMI image.
OPENEULER_VERSION=<version> \ AWS_BASE_AMI=<base_ami_id> \ OPENEULER_ARCH=<arch> \ make build
- Environment variables:
OPENEULER_VERSION
: openEuler version, default is22.03-LTS
AWS_BASE_AMI
: base AMI id, required if not executedmake prep
OPENEULER_ARCH
: openEuler arch, default isx86_64
- Environment variables:
-
Finally packer will create a AMI image with its name format
openEuler-<VERSION>-<ARCH>-hvm-<NUMBER>
.
-
OPENEULER_VERSION
: (required) Version of openEuler, default is22.03-LTS
. -
OPENEULER_ARCH
: Architecture of openEuler image, can bex86_64
oraarch64
. -
AWS_BUCKET_NAME
: (required) The name of AWS S3 bucket. -
AWS_REGION
: The region of AWS, default isap-northeast-1
. -
AWS_BASE_AMI
: (required) Base AMI id used for packer.If you run
make build
aftermake prep
, the AWS snapshot and base AMI image is created successfully, the script will readAWS_BASE_AMI
from log files intmp
folder.
-
If
make prep
failed when trying to download/uncompressqcow.xz
archive file, runmake clean
before re-runmake prep
. -
If
make prep
failed when resizing partition size, and/dev/nbd0
is loaded on your system, run following command before re-runmake-prep
:sudo qemu-nbd -d /dev/nbd0
-
Currently openEuler aarch64 does not have ENA driver installed in kernel, this project use a workaround to download pre-build ENA kernel module from AWS s3 bucket (
s3://${AWS_BUCKET_NAME}/ena.ko
) and install into system when creating openEuler RAW image.Do not delete
/root/ena.ko
or the ec2 instance will failed to connect to the internet.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.