Skip to content

Commit 675559a

Browse files
committed
impr: add *opt and **args to func mk_rootfs
So we can handle both ways of using func
1 parent 6e957ac commit 675559a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

image.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ def mk_uboot_scr(script, scr = nil, arch = "arm", comp = "none")
3232
# https://manpages.ubuntu.com/manpages/jammy/man8/mkfs.8.html
3333
# https://manpages.ubuntu.com/manpages/jammy/man8/mkfs.ext4.8.html
3434
# https://manpages.ubuntu.com/manpages/jammy/en/man8/sfdisk.8.html
35-
def mk_rootfs(img, block_count, block_size = nil, layout = nil, mkfs_cmd = nil)
35+
def mk_rootfs(img, block_count, *opt, **args)
36+
block_size = opt[0] || args[:block_size]
37+
layout = opt[1] || args[:layout]
38+
mkfs_cmd = opt[2] || args[:mkfs_cmd]
39+
3640
dd_bs = if block_size.nil? or block_size.empty?
3741
""
3842
else
@@ -68,8 +72,9 @@ def mk_rootfs(img, block_count, block_size = nil, layout = nil, mkfs_cmd = nil)
6872
# mk_rootfs "test-MB.img", 2100, "1MB"
6973
# mk_rootfs "test-MiB.img", 2001, "1MiB"
7074
# mk_rootfs "test-MB.img", 2100, "1MB", "vf2"
71-
mk_rootfs "test-MiB.img", 2001, "1MiB", "vf2"
75+
# mk_rootfs "test-MiB.img", 2001, "1MiB", "vf2"
7276
# mk_rootfs "test.img", 4096100, "" ,"vf2"
7377
# mk_rootfs "test.img", 4096100, nil, "vf2"
7478
# mk_rootfs "test.img", 4096100, nil, nil, "mkfs.ext4 -F"
79+
mk_rootfs "test.img", 4096100, layout: "vf2"
7580
end

0 commit comments

Comments
 (0)