Skip to content

Conversation

@j0zzy
Copy link
Contributor

@j0zzy j0zzy commented Apr 20, 2016

Small improvements to init script. This will allow to set root partition in uEnv.txt. Script waits 20 second for the partition, if it doesn't show up it tries to boot from sd card (/dev/mmcblk0p2).

Sample uEnv.txt

console=tty0 console=ttyS0,115200n8 no_console_suspend
kernel_filename=pine64/Image
initrd_filename=initrdwait.img 
root=/dev/sdb2
ethaddr=##:##:##:##:##:##

UART output

[  172.346109] Freeing unused kernel memory: 492K (ffffffc00097a000 - ffffffc0009f5000)
Kernel params: console=tty0 console=ttyS0,115200n8 no_console_suspend earlycon=uart,mmio32,0x01c28000 mac_addr=##:##:##:##:##:## root=/dev/sdb2 ro rootwait
Waiting for root system /dev/sdb2, countdown : 20
[  172.468887]
[  172.468887]
[.....]
[  172.976050] scene_lock_init name=ohci_standby
[  172.986656] host_chose finished 86!
Waiting for root system /dev/sdb2, countdown : 19
Waiting for root system /dev/sdb2, countdown : 18
Waiting for root system /dev/sdb2, countdown : 17
Waiting for root system /dev/sdb2, countdown : 16
Waiting for root system /dev/sdb2, countdown : 15
[  177.438461] scsi 1:0:0:0: Direct-Access     ATA      HGST HTS541010A9 A560 PQ: 0 ANSI: 6
[  177.454878] sd 1:0:0:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)
[  177.470117] sd 1:0:0:0: [sdb] Write Protect is off
[  177.482171] sd 1:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[  177.559890]  sdb: sdb1 sdb2 sdb3 sdb4 sdb5 sdb6
[  177.576276] sd 1:0:0:0: [sdb] Attached SCSI disk
Waiting for root system /dev/sdb2, countdown : 14
Rootfs: /dev/sdb2
Welcome to Ubuntu 16.04 LTS!

cd $TEMP
mkdir dev proc sys tmp sbin
mknod dev/console c 5 1
cat > $TEMP/init <<EOF
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why these single quotes? Looks strange.

Copy link
Contributor Author

@j0zzy j0zzy Apr 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without quotes interpreter tries to evaluate all $(...) inside <<EOF ... EOF.
Example:

cat > some.txt <<EOF
echo $(uname)
EOF

File content:
Linux
cat > some.txt <<'EOF'
echo $(uname)
EOF

File content:
echo $(uname)

@longsleep
Copy link
Owner

I made some comments. I like the overall idea - let me know if you want to handle my comments, else i will eventually change some things myself and merge then.

@j0zzy
Copy link
Contributor Author

j0zzy commented Apr 23, 2016

I fixed local variables.

@longsleep
Copy link
Owner

Squashed and merged in 5c7d199 - thanks!

@longsleep longsleep closed this Apr 23, 2016
@j0zzy j0zzy deleted the wip-rootfs-kernel-param branch April 24, 2016 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants