Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build.sh #126

Open
wants to merge 4 commits into
base: readme
Choose a base branch
from
Open

Add build.sh #126

wants to merge 4 commits into from

Conversation

SydneyOwl
Copy link

Hello @hzyitc,
A few weeks ago, I wrote a script to speed up the compilation process after making changes to the source code. With this script, you no longer need to manually follow the steps in ci.yml. Recently, I made some modifications to the script to make it more accessible and user-friendly for everyone.

Now, you can specify the branch, distribution, and type of the image to create image by passing parameters to the script. It also supports compiling from modified source code. This is especially useful for people who want to modify the source code but don't want to manually perform the compilation steps. To use this feature, you can use the "-l" parameter to specify the modified source code location or "-s" to skip patching if it has already been done.The script will automatically package the image and output it to the specified directory as well.

Here are the usages:
image

For example, if you want to build a "jammy-current-minimal" image from source code, you can run: ./build.sh -b current -r jammy -t minimal. Here are some screenshots:
image
image
image
Here're the dists:image
Building an image on an Ubuntu system(16C,32G) without compilation cache typically takes around 30 minutes.
This script only supports Debian-based distributions and has been tested on Ubuntu 22.04 LTS ,a GNU/Linux 5.15.0-56-generic x86_64

Hope this script is helpful for those who wants to build images on their own :)

@SydneyOwl
Copy link
Author

Also there‘s a output sample of ./build.sh -b current -r jammy -t minimal
log.txt

@hzyitc
Copy link
Owner

hzyitc commented May 5, 2023

I don't think this is necessary. But I will keep this PR open for someone.

The part of building debs and image can just following the armbian build steps.

build.sh Outdated Show resolved Hide resolved
build.sh Outdated
Comment on lines 131 to 137
echo "Building dtb/headers/image debs..."
./compile.sh kernel \
ALLOW_ROOT=yes \
BOARD=onecloud \
BRANCH=$CHOOSED_BRANCH \
EXPERT=yes \
USE_CCACHE=no
Copy link
Owner

@hzyitc hzyitc May 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uncessary. Building image will also build these packages.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected.

Comment on lines +227 to +236
-b|--branch)
CHOOSED_BRANCH=$2
[[ ${BRANCH[@]/${CHOOSED_BRANCH}/} != ${BRANCH[@]} ]] && echo "Branch $CHOOSED_BRANCH is choosed." || (echo "You should choose from ${BRANCH[*]}." && exit 1)
shift
;;
-r|--release)
CHOOSED_RELEASE=$2
[[ ${RELEASE[@]/${CHOOSED_RELEASE}/} != ${RELEASE[@]} ]] && echo "Release $CHOOSED_RELEASE is choosed." || (echo "You should choose from ${RELEASE[*]}." && exit 1)
shift
;;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these arguments will be checked by the build framework. So we don't need to check them again.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is still necessary because users can immediately know that their parameters are incorrect at the beginning of executing the script, rather than being informed of the error only at compile time.

Comment on lines +146 to +153
BRANCH=$CHOOSED_BRANCH \
RELEASE=$CHOOSED_RELEASE \
KERNEL_CONFIGURE=no \
BUILD_MINIMAL=$([ "$CHOOSED_TYPE" == 'minimal' ] && echo 'yes' || echo 'no') \
BUILD_DESKTOP=$([ "$CHOOSED_TYPE" == 'desktop' ] && echo 'yes' || echo 'no') \
DESKTOP_ENVIRONMENT=$([ "$CHOOSED_TYPE" == 'desktop' ] && echo $DESKTOP_ENVIRONMENT || echo '') \
DESKTOP_ENVIRONMENT_CONFIG_NAME=$([ "$CHOOSED_TYPE" == 'desktop' ] && echo $DESKTOP_ENVIRONMENT_CONFIG_NAME || echo '') \
DESKTOP_APPGROUPS_SELECTED=$([ "$CHOOSED_TYPE" == 'desktop' ] && echo $DESKTOP_APPGROUPS_SELECTED || echo '') \
Copy link
Owner

@hzyitc hzyitc May 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these variables are undefined, the build framework will use dialog to ask. You can use the same way to ask some custom configs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still in process:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants