Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
I
initrd
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
SulinOS
initrd
Commits
58693f9a
Kaydet (Commit)
58693f9a
authored
Nis 04, 2020
tarafından
Your Name
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
tonla ayar çektim. efsane oldu moruq
üst
65f691b1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
140 additions
and
68 deletions
+140
-68
00-modules.sh
src/addons/00-modules.sh
+6
-9
01-extra-modules.sh
src/addons/01-extra-modules.sh
+1
-9
98-busybox.sh
src/addons/98-busybox.sh
+2
-0
99-config.sh
src/addons/99-config.sh
+1
-1
build-functions.sh
src/build-functions.sh
+92
-0
build.sh
src/build.sh
+8
-25
common.sh
src/common.sh
+27
-0
init.sh
src/init.sh
+2
-0
vars.sh
src/vars.sh
+1
-24
No files found.
src/addons/00-modules.sh
Dosyayı görüntüle @
58693f9a
#!/bin/bash
#!/bin/bash
[
!
-n
"
$KERNELVER
"
]
&&
KERNELVER
=
$(
uname
-r
)
[
!
-n
"
$KERNELVER
"
]
&&
KERNELVER
=
$(
uname
-r
)
[
!
-n
"
$MODDIR
"
]
&&
MODDIR
=
/lib/modules/
${
KERNELVER
}
[
!
-n
"
$MODDIR
"
]
&&
MODDIR
=
/lib/modules/
${
KERNELVER
}
if
[
!
-d
$MODDIR
]
;
then
[
-d
$MODDIR
]
||
err
"Module directory not found ->
$MODDIR
"
echo
-e
"
\0
33[31;1mModule directory not found"
echo
-e
" ->
$MODDIR
\0
33[;0m"
debug
"Kernel Version:
${
KERNELVER
}
"
exit
1
debug
"Module Directory:
${
MODDIR
}
"
fi
echo
-e
"
\0
33[34;1mKernel Version:
\0
33[;0m
${
KERNELVER
}
"
echo
-e
"
\0
33[34;1mModule Directory:
\0
33[;0m
${
MODDIR
}
"
mkdir
-p
${
WORKDIR
}
/
${
MODDIR
}
mkdir
-p
${
WORKDIR
}
/
${
MODDIR
}
echo
-e
"
\0
33[34;1mInstall:
\0
33[;0m
main modules"
debug
"Install:
main modules"
cp
-prf
${
MODDIR
}
/kernel/
{
crypto,fs,lib
}
${
WORKDIR
}
/
${
MODDIR
}
cp
-prf
${
MODDIR
}
/kernel/
{
crypto,fs,lib
}
${
WORKDIR
}
/
${
MODDIR
}
echo
-e
"
\0
33[34;1mInstall:
\0
33[;0m
drivers"
debug
"Install:
drivers"
cp
-prf
${
MODDIR
}
/kernel/drivers/
{
block,ata,md,firewire
}
${
WORKDIR
}
/
${
MODDIR
}
cp
-prf
${
MODDIR
}
/kernel/drivers/
{
block,ata,md,firewire
}
${
WORKDIR
}
/
${
MODDIR
}
cp
-prf
${
MODDIR
}
/kernel/drivers/
{
scsi,pcmcia,virtio
}
${
WORKDIR
}
/
${
MODDIR
}
cp
-prf
${
MODDIR
}
/kernel/drivers/
{
scsi,pcmcia,virtio
}
${
WORKDIR
}
/
${
MODDIR
}
cp
-prf
${
MODDIR
}
/kernel/drivers/usb/
{
host,storage
}
${
WORKDIR
}
/
${
MODDIR
}
cp
-prf
${
MODDIR
}
/kernel/drivers/usb/
{
host,storage
}
${
WORKDIR
}
/
${
MODDIR
}
src/addons/01-extra-modules.sh
Dosyayı görüntüle @
58693f9a
get_module_with_dep
(){
name
=
$1
modinfo
$name
|
grep
filename |
awk
'{print $2}'
for
i
in
$(
modinfo
$name
|
grep
depends |
awk
'{print $2}'
|
sed
"s/,/ /g"
)
do
modinfo
$i
|
grep
filename |
awk
'{print $2}'
done
}
add_extra_module
(){
add_extra_module
(){
while
read
line
while
read
line
do
do
name
=
$(
basename
$line
)
name
=
$(
basename
$line
)
echo
-e
"
\0
33[34;1mInstall:
\0
33[;0m
$name
"
debug
"Install:
$name
"
mkdir
-p
${
WORKDIR
}
/
$line
mkdir
-p
${
WORKDIR
}
/
$line
rmdir
${
WORKDIR
}
/
$line
rmdir
${
WORKDIR
}
/
$line
cat
$line
>
${
WORKDIR
}
/
$line
cat
$line
>
${
WORKDIR
}
/
$line
...
...
src/addons/98-busybox.sh
0 → 100644
Dosyayı görüntüle @
58693f9a
debug
"Install busybox:
$(
which busybox
)
"
install
$(
which busybox
)
$WORKDIR
/busybox
>
/dev/null
src/addons/99-config.sh
Dosyayı görüntüle @
58693f9a
[
"
$CONFIG
"
!=
""
]
||
CONFIG
=
/etc/initrd.conf
[
"
$CONFIG
"
!=
""
]
||
CONFIG
=
/etc/initrd.conf
echo
-e
"
\0
33[34;1mUsing config:
\0
33[;0m
$CONFIG
"
debug
"Using config:
$CONFIG
"
mkdir
-p
${
WORKDIR
}
/etc
mkdir
-p
${
WORKDIR
}
/etc
if
[
-f
$CONFIG
]
;
then
if
[
-f
$CONFIG
]
;
then
cat
${
CONFIG
}
>
${
WORKDIR
}
/etc/initrd.conf
cat
${
CONFIG
}
>
${
WORKDIR
}
/etc/initrd.conf
...
...
src/build-functions.sh
0 → 100644
Dosyayı görüntüle @
58693f9a
.
/lib/initrd/common.sh
help_msg
(){
cat
<<
EOF
Usage
$(
basename
$0
)
[OPTIONS]
Targeting options list:
OUPTUP Target initrd file output location.
WORKDIR Working directory. Created by mktemp command.
KERNELVER Target kernel version. Default is current kernel.
MODDIR Target module director. Default is current module directory.
CONFIG Used config file location. Default is /etc/initrd.conf
General option list:
-d / --debug Print debug log.
-k / --keep Do not remove working directory after building.
-h / --help Print this message.
-n / --no-color Disable colorized output.
-c / --no-cpio Do not generate initrd image.
-f / --fallback Generate fallback initrd image.
EOF
}
get_module_with_dep
(){
name
=
$1
modinfo
$name
|
grep
filename |
awk
'{print $2}'
for
i
in
$(
modinfo
$name
|
grep
depends |
awk
'{print $2}'
|
sed
"s/,/ /g"
)
do
modinfo
$i
|
grep
filename |
awk
'{print $2}'
done
}
parse_args
(){
export
src
=
/lib/initrd/
export
WORKDIR
=
$(
mktemp
)
export
OUTPUT
=
/boot/initrd.img-
$(
uname
-r
)
export
nocolor
=
false
for
i
in
$*
do
if
[
"
$i
"
==
"-h"
]
||
[
"
$i
"
==
"--help"
]
;
then
help_msg
exit
0
elif
[
"
$i
"
==
"-d"
]
||
[
"
$i
"
==
"--debug"
]
;
then
export
debug
=
true
elif
[
"
$i
"
==
"-k"
]
||
[
"
$i
"
==
"--keep"
]
;
then
export
keepwordkir
=
true
elif
[
"
$i
"
==
"-n"
]
||
[
"
$i
"
==
"--no-color"
]
;
then
nocolor
=
true
elif
[
"
$i
"
==
"-c"
]
||
[
"
$i
"
==
"--no-cpio"
]
;
then
nocpio
=
true
elif
[
"
$i
"
==
"-f"
]
||
[
"
$i
"
==
"--fallback"
]
;
then
fallback
=
true
else
export
$i
fi
done
}
generate_workdir
(){
msg
"Creating workdir
$WORKDIR
"
rm
-f
$WORKDIR
mkdir
-p
$WORKDIR
cp
-prf
$src
/scripts
$WORKDIR
/scripts
for
file
in
functions vars common init
do
install
$src
/
$file
.sh
$WORKDIR
/
$file
done
}
modules_install
(){
for
i
in
$(
ls
$src
/addons |
sort
)
do
inf
"Install modules:
$i
"
.
$src
/addons/
$i
done
}
generate_cpio
(){
msg
"Build:
$OUTPUT
"
cd
$WORKDIR
if
[
"
$nocpio
"
!=
"true"
]
;
then
echo
-ne
"
${
C_GREEN
}
*
${
C_CLEAR
}
Generating: "
find
.
| cpio
-R
root:root
-H
newc
-o
|
gzip
>
$OUTPUT
fi
if
[
"
$fallback
"
==
"true"
]
;
then
echo
-ne
"
${
C_GREEN
}
*
${
C_CLEAR
}
Generating fallback: "
find
.
| cpio
-R
root:root
-H
newc
-o
|
gzip
>
$OUTPUT
-fallback
fi
}
clean_directory
(){
if
[
"
$keepworkdir
"
==
"true"
]
;
then
rm
-rf
$WORKDIR
msg
"Clearing workdir."
else
inf
"Keeping workdir:
$WORKDIR
"
fi
}
src/build.sh
Dosyayı görüntüle @
58693f9a
#!/bin/bash
#!/bin/bash
export
src
=
/lib/initrd/
set
-e
export
WORKDIR
=
$(
mktemp
)
.
/lib/initrd/build-functions.sh
export
OUTPUT
=
/boot/initrd.img-
$(
uname
-r
)
parse_args
$*
for
i
in
$*
.
/lib/initrd/common.sh
do
generate_workdir
export
$i
modules_install
done
generate_cpio
rm
-f
$WORKDIR
clean_directory
mkdir
-p
$WORKDIR
echo
-e
"
\0
33[32;1mCreating workdir
\0
33[;0m
$WORKDIR
"
cp
-prf
$src
/scripts
$WORKDIR
/scripts
install
$src
/functions.sh
$WORKDIR
/functions
install
$src
/vars.sh
$WORKDIR
/vars
install
$src
/init.sh
$WORKDIR
/init
for
i
in
$(
ls
$src
/addons |
sort
)
do
echo
-e
"
\0
33[32;1mInstall modules:
\0
33[;0m
$i
"
.
$src
/addons/
$i
done
echo
-e
"
\0
33[32;1mInstall busybox:
\0
33[;0m
$(
which busybox
)
"
install
$(
which busybox
)
$WORKDIR
/busybox
>
/dev/null
cd
$WORKDIR
echo
-en
"
\0
33[32;1mBuild:
\0
33[;0m
$OUTPUT
"
find
.
| cpio
-R
root:root
-H
newc
-o
|
gzip
>
$OUTPUT
echo
-e
"
\0
33[32;1mDone
\0
33[;0m"
src/common.sh
0 → 100644
Dosyayı görüntüle @
58693f9a
if
[
-t
0
]
&&
[
"
$nocolor
"
==
"false"
]
;
then
C_BLACK
=
'\e[1;30m'
C_RED
=
'\e[1;31m'
C_GREEN
=
'\e[1;32m'
C_YELLOW
=
'\e[1;33m'
C_BLUE
=
'\e[1;34m'
C_PURPLE
=
'\e[1;35m'
C_CYAN
=
'\e[1;36m'
C_WHITE
=
'\e[1;37m'
C_CLEAR
=
'\e[m'
fi
msg
()
{
echo
-e
"
${
C_GREEN
}
*
${
C_CLEAR
}
${
@
}
"
}
inf
()
{
echo
-e
"
${
C_CYAN
}
*
${
C_CLEAR
}
${
@
}
"
}
debug
()
{
[
!
-n
"
$debug
"
]
||
echo
-e
"
${
C_BLUE
}
*
${
C_CLEAR
}
${
@
}
"
}
warn
()
{
echo
-e
"
${
C_YELLOW
}
*
${
C_CLEAR
}
${
@
}
"
}
err
()
{
echo
-e
"
${
C_RED
}
*
${
C_CLEAR
}
${
@
}
"
}
src/init.sh
Dosyayı görüntüle @
58693f9a
#!/busybox ash
#!/busybox ash
.
/vars
.
/vars
.
/etc/initrd.conf
.
/common
.
/functions
.
/functions
generate_rootfs
generate_rootfs
mount_handler
mount_handler
...
...
src/vars.sh
Dosyayı görüntüle @
58693f9a
PATH
=
/bin:/usr/bin:/usr/sbin:/sbin
PATH
=
/bin:/usr/bin:/usr/sbin:/sbin
TERM
=
linux
TERM
=
linux
rootfstype
=
ext4
rootfstype
=
ext4
if
[
-t
0
]
;
then
nocolor
=
false
C_BLACK
=
'\e[1;30m'
C_RED
=
'\e[1;31m'
C_GREEN
=
'\e[1;32m'
C_YELLOW
=
'\e[1;33m'
C_BLUE
=
'\e[1;34m'
C_PURPLE
=
'\e[1;35m'
C_CYAN
=
'\e[1;36m'
C_WHITE
=
'\e[1;37m'
C_CLEAR
=
'\e[m'
fi
msg
()
{
echo
-e
"
${
C_GREEN
}
*
${
C_CLEAR
}
${
@
}
"
}
debug
()
{
[
!
-n
"
$debug
"
]
||
echo
-e
"
${
C_BLUE
}
*
${
C_CLEAR
}
${
@
}
"
}
warn
()
{
echo
-e
"
${
C_YELLOW
}
*
${
C_CLEAR
}
${
@
}
"
}
err
()
{
echo
-e
"
${
C_RED
}
*
${
C_CLEAR
}
${
@
}
"
}
.
/etc/initrd.conf
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