Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
meta-nemo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NemoMobile
meta-nemo
Commits
e92aabce
Commit
e92aabce
authored
May 11, 2017
by
Florent Revest
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initramfs-boot-android: New generic init.sh that boots from /sdcard/asteroidos.ext4
parent
b05d082c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
0 deletions
+96
-0
init.sh
recipes-core/initrdscripts/initramfs-boot-android/init.sh
+96
-0
No files found.
recipes-core/initrdscripts/initramfs-boot-android/init.sh
0 → 100644
View file @
e92aabce
#! /bin/sh
# machine.conf should provide $sdcard_partition
.
/machine.conf
# Logging functions
info
()
{
echo
"
$1
"
>
/dev/ttyprintk
}
fail
()
{
echo
"Failed"
>
/dev/ttyprintk
echo
"
$1
"
>
/dev/ttyprintk
echo
"Waiting for 15 seconds before rebooting ..."
>
/dev/ttyprintk
sleep
15s
reboot
}
# Populates /dev (called for /dev and /rfs/dev)
setup_devtmpfs
()
{
mount
-t
devtmpfs
-o
mode
=
0755,nr_inodes
=
0 devtmpfs
$1
/dev
mkdir
$1
/dev/pts
mount
-t
devpts none
$1
/dev/pts/
test
-c
$1
/dev/fd
||
ln
-sf
/proc/self/fd
$1
/dev/fd
test
-c
$1
/dev/stdin
||
ln
-sf
fd/0
$1
/dev/stdin
test
-c
$1
/dev/stdout
||
ln
-sf
fd/1
$1
/dev/stdout
test
-c
$1
/dev/stderr
||
ln
-sf
fd/2
$1
/dev/stderr
test
-c
$1
/dev/socket
||
mkdir
-m
0755
$1
/dev/socket
}
echo
"Mounting relevant filesystems ..."
mkdir
-m
0755 /proc
mount
-t
proc proc /proc
mkdir
-m
0755 /sys
mount
-t
sysfs sys /sys
mkdir
-p
/dev
setup_devtmpfs
""
# Checks wether we need to start adbd for interactive debugging
cat
/proc/cmdline |
grep
debug-ramdisk
if
[
$?
-ne
1
]
;
then
mkdir
-p
/dev/usb-ffs/adb
mount
-t
functionfs adb /dev/usb-ffs/adb
echo
0
>
/sys/class/android_usb/android0/enable
echo
18d1
>
/sys/class/android_usb/android0/idVendor
echo
d002
>
/sys/class/android_usb/android0/idProduct
echo
adb
>
/sys/class/android_usb/android0/f_ffs/aliases
echo
ffs
>
/sys/class/android_usb/android0/functions
echo
AsteroidOS
>
/sys/class/android_usb/android0/iManufacturer
echo
InitRamDisk
>
/sys/class/android_usb/android0/iProduct
serial
=
"
$(
cat
/proc/cmdline |
sed
's/.*androidboot.serialno=//'
|
sed
's/ .*//'
)
"
echo
$serial
>
/sys/class/android_usb/android0/iSerial
echo
1
>
/sys/class/android_usb/android0/enable
/usr/bin/android-gadget-setup adb
/usr/bin/adbd
fi
# The sdcard partition may be the rootfs itself or contain a loop file
info
"Mounting sdcard..."
mkdir
-m
0777 /sdcard /loop
while
[
!
-e
/sys/block/mmcblk0
]
;
do
info
"Waiting for mmcblk0..."
sleep
1
done
mount
-t
auto
-o
rw,noatime,nodiratime /dev/
$sdcard_partition
/sdcard
[
$?
-eq
0
]
||
fail
"Failed to mount the sdcard. Cannot continue."
info
"Checking for loop rootfs image on the sdcard..."
ANDROID_MEDIA_DIR
=
"/sdcard/media/"
if
[
-d
/sdcard/media/0
]
;
then
ANDROID_MEDIA_DIR
=
"/sdcard/media/0"
fi
BOOT_DIR
=
"/sdcard"
if
[
-e
$ANDROID_MEDIA_DIR
/asteroidos.ext4
]
;
then
# Boots from a /sdcard/asteroidos.ext4 loop file
info
"Rootfs image found at
$ANDROID_MEDIA_DIR
/asteroidos.ext4; mounting it now ..."
mount
-o
noatime,nodiratime,sync,rw,loop
$ANDROID_MEDIA_DIR
/asteroidos.ext4 /loop
[
$?
-ne
0
]
||
BOOT_DIR
=
"/loop"
fi
setup_devtmpfs
$BOOT_DIR
info
"Move the /proc and /sys filesystems..."
umount
-l
/proc
umount
-l
/sys
mount
-t
proc proc
$BOOT_DIR
/proc
mount
-t
sysfs sys
$BOOT_DIR
/sys
info
"Switching to rootfs..."
exec
switch_root
-c
/dev/ttyprintk
$BOOT_DIR
/lib/systemd/systemd
>
/dev/ttyprintk
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