Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Midysen authored Nov 6, 2019
1 parent 3855dd2 commit 35438b6
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 77 deletions.
152 changes: 76 additions & 76 deletions tools/build.sh
Original file line number Diff line number Diff line change
@@ -1,82 +1,82 @@
#!/bin/bash

unset LD_LIBRARY_PATH
dirname_path=$(cd `dirname $0`; pwd)

buildroot_path="$dirname_path/buildroot"
tmp_branch="$dirname_path/tmp_branch"

source $tmp_branch/envar
#linux_repo="/c/repo/linux"
#linux_repo="/media/vdb1/xly/common"
#linux_config="$linux_repo/arch/x86/configs/x86_64_defconfig"

#tmp_branch="/home/chy/xly/kernelci/ka/tmp_branch"
branch_name="$1"
commit_id="$2"

#buildroot_path="/home/chy/xly/kernelci/ka/buildroot"
buildroot_linux="$buildroot_path/output/build/linux-custom"
buildroot_mod="$buildroot_path/output/MOD"
buildroot_config="$buildroot_path/buildroot_config2"

linux_config="$buildroot_path/linux_config"

#web_path="/var/www/html/~lkp"

cd $linux_repo

#git checkout $branch_name

git checkout $commit_id

if [ $? -ne 0 ]; then
echo -e "git checkout $commit_id ERROR!"
exit
fi

#echo -e "Syncing from $linux_repo to $buildroot_linux"
#rsync -au --chmod=u=rwX,go=rX --exclude .svn --exclude .git --exclude .hg --exclude .bzr --exclude CVS --exclude .stamp_rsynced $linux_repo/ $buildroot_linux

rm -rf $buildroot_linux $buildroot_mod

cp $buildroot_config $buildroot_path/.config

echo -e "
WEB_PATH=\"$web_path\"
BRANCH_NAME=\"$branch_name\"
COMMIT_ID=\"$commit_id\"
BR2_DEFCONFIG=\"$buildroot_path/configs/qemu_x86_64_defconfig\"
BR2_LINUX_KERNEL_CUSTOM_LOCAL_PATH=\"$linux_repo\"
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE=\"$linux_config\"" >> $buildroot_path/.config

#exit

cd $buildroot_path
sec=$(date +%s)

make -j8

if [ $? -ne 0 ]; then
echo -e "make ERROR!"
exit
fi

cd $buildroot_path/output/images

declare -A file_time
for file_ in $(ls)
do
time_=$(stat -c %Y $file_)
if [ $time_ -gt $sec ]; then
file_time[$file_]=$time_

if [ "$file_"x = "bzImage"x ]; then
rm $tmp_branch/$commit_id
function init_env() {
dirname_path=$(cd `dirname $0`; pwd)
tmp_branch="$dirname_path/tmp_branch"

source $tmp_branch/envar
buildroot_linux=$linux_repo
}

function init_git(){
cd $buildroot_linux

git checkout $branch_name
git checkout $commit_id

if [ $? -ne 0 ]; then
echo -e "git checkout $commit_id ERROR!"
exit
fi

}

function init_kernel_config(){
cp $buildroot_linux/arch/x86/configs/x86_64_defconfig $buildroot_linux/.config
}

function build_kernel(){
make x86_64_defconfig
make

if [ $? -ne 0 ]; then
echo -e "make ERROR!"
exit
fi
}

function output_log(){
echo -e "$sec $branch_name $commit_id --> (${!file_time[@]})" >> $tmp_branch/build.log
echo -e "$branch_name \033[32m$commit_id\033[0m output files: (\033[32m${!file_time[@]} \033[0m) in $image_path"
}

function images_commit(){
cd $buildroot_linux/arch/x86_64/boot/
declare -A file_time
sec=$(date +%s)
for file_ in $(ls)
do
time_=$(stat -c %Y $file_)
if [ $time_ -gt $sec ]; then
file_time[$file_]=$time_

if [ "$file_"x == "bzImage"x ]; then
rm $tmp_branch/$commit_id
fi
fi
fi
done

echo -e "$sec $branch_name $commit_id --> (${!file_time[@]})" >> $tmp_branch/build.log
echo -e "$branch_name \033[32m$commit_id\033[0m output files: (\033[32m ${!file_time[@]} \033[0m) in $buildroot_path/output/images"

done
image_path=$dirname_path/buildroot/output/images
if [ ! -d $image_path ]
then
mkdir -p $image_path
fi
cp bzImage $image_path
output_log
}


function test_image() {
echo $dirname_path
cd $dirname_path
./test.sh $image_path/bzImage rootfs.ext2
}

init_env
init_git
init_kernel_config
build_kernel
images_commit
test_image
6 changes: 5 additions & 1 deletion tools/test.sh
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
echo test!!!
#!/bin/bash

#qemu-system-x86_64 -enable-kvm -m 1G -append "root=/dev/sda rdinit=/sbin/init" -serial stdio -kernel $1 -hda $2
echo "Test------------------------"
qemu-system-x86_64 -m 2G -append "root=/dev/sda rdinit=/sbin/init" -serial stdio -kernel $1 -hda $2

0 comments on commit 35438b6

Please sign in to comment.