Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
duo-buildroot-sdk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
duo-buildroot-sdk
Commits
529e8a50
Commit
529e8a50
authored
Jun 13, 2023
by
carbon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
milkv-duo use genimage to create sd card img
parent
db74adc7
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
73 additions
and
70 deletions
+73
-70
build_milkv.sh
build_milkv.sh
+16
-10
buildroot-2021.05/configs/milkv_duo_musl_riscv64_defconfig
buildroot-2021.05/configs/milkv_duo_musl_riscv64_defconfig
+2
-0
buildroot-2021.05/dl/genimage/.lock
buildroot-2021.05/dl/genimage/.lock
+0
-0
buildroot-2021.05/dl/genimage/genimage-14.tar.xz
buildroot-2021.05/dl/genimage/genimage-14.tar.xz
+0
-0
buildroot-2021.05/dl/libconfuse/.lock
buildroot-2021.05/dl/libconfuse/.lock
+0
-0
buildroot-2021.05/dl/libconfuse/confuse-3.3.tar.xz
buildroot-2021.05/dl/libconfuse/confuse-3.3.tar.xz
+0
-0
milkv/gen_burn_image_sd.sh
milkv/gen_burn_image_sd.sh
+22
-60
milkv/genimage-milkv-duo.cfg
milkv/genimage-milkv-duo.cfg
+33
-0
No files found.
build_milkv.sh
View file @
529e8a50
...
...
@@ -77,15 +77,16 @@ function prepare_env()
source
build/
${
MV_BUILD_ENV
}
>
/dev/null 2>&1
defconfig
${
MV_BOARD_LINK
}
>
/dev/null 2>&1
echo
"OUTPUT_DIR:
${
OUTPUT_DIR
}
"
# @build/milkvsetup.sh
}
function
milkv_duo_build
()
{
# clean old img
install_dir
=
"install/soc_
${
MV_BOARD_LINK
}
"
old_image_count
=
`
ls
${
install_dir
}
/
*
.img
*
|
wc
-l
`
old_image_count
=
`
ls
${
OUTPUT_DIR
}
/
*
.img
*
|
wc
-l
`
if
[
${
old_image_count
}
-ge
0
]
;
then
pushd
${
install_dir
}
pushd
${
OUTPUT_DIR
}
rm
-rf
*
.img
*
popd
fi
...
...
@@ -102,18 +103,23 @@ function milkv_duo_build()
function
milkv_duo_pack
()
{
if
[
"
$(
id
-u
)
"
-ne
0
]
;
then
print_info
"Creating sd card img requires root privileges"
sudo echo
"Running with root privileges now"
fi
pack_sd_image
[
!
-d
out
]
&&
mkdir
out
image_count
=
`
ls
${
install_dir
}
/
*
.img |
wc
-l
`
image_count
=
`
ls
${
OUTPUT_DIR
}
/
*
.img |
wc
-l
`
if
[
${
image_count
}
-ge
0
]
;
then
mv
${
install_dir
}
/
*
.img out/
mv
${
OUTPUT_DIR
}
/
*
.img out/
# rename milkv-duo.img file with time
pushd
out
for
img
in
*
.img
do
if
[
"
${
img
}
"
==
"
${
MILKV_BOARD
}
.img"
]
;
then
mv
$img
${
MILKV_BOARD
}
-
`
date
+%Y%m%d-%H%M
`
.img
fi
done
popd
# show latest img
latest_img
=
`
ls
-t
out/
*
.img |
head
-n1
`
...
...
buildroot-2021.05/configs/milkv_duo_musl_riscv64_defconfig
View file @
529e8a50
...
...
@@ -310,6 +310,8 @@ BR2_PACKAGE_E2FSPROGS=y
# BR2_PACKAGE_E2FSPROGS_DEBUGFS is not set
# BR2_PACKAGE_E2FSPROGS_E2IMAGE is not set
BR2_PACKAGE_HOST_GENIMAGE=y
#
# e2scrub needs bash, coreutils, lvm2, and util-linux
#
...
...
buildroot-2021.05/dl/genimage/.lock
0 → 100644
View file @
529e8a50
buildroot-2021.05/dl/genimage/genimage-14.tar.xz
0 → 100644
View file @
529e8a50
File added
buildroot-2021.05/dl/libconfuse/.lock
0 → 100644
View file @
529e8a50
buildroot-2021.05/dl/libconfuse/confuse-3.3.tar.xz
0 → 100644
View file @
529e8a50
File added
milkv/gen_burn_image_sd.sh
View file @
529e8a50
#!/bin/bash
# sd image generator
#
milkv
sd image generator
# usage
if
[
"$#"
-ne
"1"
]
;
then
echo
"usage:
sudo
${
0
}
OUTPUT_DIR"
echo
"usage:
${
0
}
OUTPUT_DIR"
echo
""
echo
" The script is used to create a sdcard image with two partitions, "
echo
" one is fat32 with 128MB, the other is ext4 with 256MB."
echo
" You can modify the capacities in this script as you wish!"
echo
" You can modify the capacities in genimage cfg as you wish!"
echo
" genimage cfg: milkv/genimage-milkv-duo.cfg"
echo
""
echo
"Note: Please backup you sdcard files before using this image!"
exit
fi
vfat_cap
=
128M
vfat_label
=
"boot"
ext4_cap
=
256M
ext4_label
=
"rootfs"
echo
"BR_DIR:
$BR_DIR
"
echo
"BR_BOARD:
$BR_BOARD
"
# genimage command in buildroot host bin
BR_HOST_BIN
=
"
${
BR_DIR
}
/output/
${
BR_BOARD
}
/host/bin"
if
[
!
-d
${
BR_HOST_BIN
}
]
;
then
echo
"host/bin not found, check buildroot output dir!"
exit
1
fi
export
PATH
=
${
BR_HOST_BIN
}
:
${
PATH
}
output_dir
=
$1
echo
${
output_dir
}
pushd
${
output_dir
}
# gen a empty image
image
=
${
MILKV_BOARD
}
-
`
date
+%Y%m%d-%H%M
`
.img
echo
${
image
}
dd
if
=
/dev/zero
of
=
./
${
image
}
bs
=
1M
count
=
512
################################
# Note: do not change this flow
################################
sudo
fdisk ./
${
image
}
<<
EOF
n
p
1
+
${
vfat_cap
}
n
p
2
+
${
ext4_cap
}
w
EOF
# Note end
################################
dev_name
=
`
sudo
losetup
-f
`
echo
${
dev_name
}
echo
""
[
-d
tmp
]
&&
rm
-rf
tmp
sudo
losetup
${
dev_name
}
./
${
image
}
sudo
partprobe
${
dev_name
}
sudo
mkfs.vfat
-F
32
-n
${
vfat_label
}
${
dev_name
}
p1
sudo
mkfs.ext4
-L
${
ext4_label
}
${
dev_name
}
p2
# mount partitions
rm
./tmp1 ./tmp2
-rf
mkdir
tmp1 tmp2
sudo
mount
-t
vfat
${
dev_name
}
p1 tmp1/
sudo
mount
-t
ext4
${
dev_name
}
p2 tmp2/
# copy boot file and rootfs
sudo cp
${
output_dir
}
/fip.bin ./tmp1/
sudo cp
${
output_dir
}
/rawimages/boot.sd ./tmp1/
sudo cp
-raf
${
output_dir
}
/fs/
*
./tmp2
sync
# umount
sudo
umount tmp1 tmp2
sudo
losetup
-d
${
dev_name
}
rmdir
tmp1 tmp2
echo
"Gen image successful:
${
image
}
"
echo
""
genimage
--config
${
TOP_DIR
}
/milkv/genimage-
${
MILKV_BOARD
}
.cfg
--rootpath
fs/
--inputpath
${
PWD
}
--outputpath
${
PWD
}
if
[
$?
-eq
0
]
;
then
echo
"gnimage for
${
MILKV_BOARD
}
success!"
else
echo
"gnimage for
${
MILKV_BOARD
}
failed!"
fi
popd
milkv/genimage-milkv-duo.cfg
0 → 100644
View file @
529e8a50
image boot.vfat {
vfat {
label = "boot"
files = {
"fip.bin",
"rawimages/boot.sd",
}
}
size = 128M
}
image rootfs.ext4 {
ext4 {
label = "rootfs"
}
size = 256M
}
image milkv-duo.img {
hdimage {
}
partition boot {
partition-type = 0xC
bootable = "true"
image = "boot.vfat"
}
partition rootfs {
partition-type = 0x83
image = "rootfs.ext4"
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment