ChanServ changed the topic of #radxa to: http://radxa.com/ - Logs: http://irclog.whitequark.org/radxa
hipboi_ has joined #radxa
hipboi has quit [Ping timeout: 264 seconds]
<hipboi_> naobsd, ping
<naobsd> pong
<hipboi_> how can i write command to misc partition under linux
<naobsd> dd if=misc.img of=/dev/mtd/mtdX bs=16384
<hipboi_> how is the misc.img generated
<naobsd> ah
<naobsd> well
<hipboi_> there is string in it
<naobsd> what command do you want to write?
<hipboi_> recovery
<naobsd> I think "boot-recovery" to boot recovery
<hipboi_> ok, i will try
<naobsd> you want just a misc.img? or you want to make some command to do it?
<hipboi_> i want a misc.img with command
<hipboi_> this is a misc.img in the repo by rockchip
<naobsd> please try
<hipboi_> naobsd, it's empty..
<hipboi_> i open with ghex, all zero
<naobsd> no
<hipboi_> oh, i see boot-recovery.
<naobsd> yes
<hipboi_> i was just scrolling too fast
<hipboi_> how was it generated
<naobsd> misc.img in RK repo (and update.img for most RK products) has command and argument "recovery" and "--wipe_all"
<hipboi_> yes
<naobsd> there are several ways, probably I used echo and dd command on shell
<hipboi_> i see that the string was at offset 0x3ffc
<naobsd> it should be 0x4000
<naobsd> (dd if=/dev/zero bs=16384 count=1; echo -n boot-recovery | dd bs=16384 conv=sync; dd if=/dev/zero bs=16384 count=1) > misc.img
<naobsd> there may be more smart way ;)
<naobsd> bs=16384 is important to write mtd device
<naobsd> and don't use standard tools for mtd such as flash_image, erase_image, nandwrite etc
<naobsd> standard tool calls some ioctl() to erase NAND before writing, but RK mtd driver doesn't accept it
<naobsd> block size(16384) should be get from some another ioctl() as erasesize and writesize, but probably 16384 should be ok
<naobsd> RK's recovery may not work well if size of image is larger than 2or4GB
<hipboi_> 2GB?
<naobsd> but I think you just want to boot another OS in recovery, right?
<hipboi_> yes
<naobsd> ah, "RK's recovery" = /sbin/recovery in recovery.img of Android image
<hipboi_> :O
<hipboi_> /sbin/recovery
<hipboi_> the first time i heard it
<hipboi_> let me check
<naobsd> it should not be a problem unless you want to write large image file via /sbin/recovery
<naobsd> well
<hipboi_> i don't want to run the recovery
<naobsd> yes
<naobsd> so you can ignore problem
<hipboi_> i just want to include the linux and android in a single update.img
<hipboi_> recovery.img for the linux kernel
<hipboi_> i need to switch between two oses
<hipboi_> so under linux, i need to write something to misc to boot to android or linux
<hipboi_> same in android
<naobsd> (btw, /sbin/recovery is standard recovery/update/factory reset tool in Android world.)
<hipboi_> oh, i need to have a look at it
<naobsd> (RK's /sbin/recovery has some additional features)
<naobsd> /sbin/recovery runs on target device, it's not host tool
<naobsd> do you know CWM recovery?
<hipboi_> yes
<naobsd> /sbin/recovery is the simple recovery program which is replaced by CWM by many people ;)
<hipboi_> /sbin/recovery is from ASOP, right?
<naobsd> RK's /sbin/recovery can handle RK's update.img in addition to update.zip
<naobsd> yes, AOSP is original
<hipboi_> RK's sbin/recovery can handle update.img, that's good
<naobsd> radxa_rock_android/bootable/recovery/
<hipboi_> naobsd, thanks
<hipboi_> i did not know that was a single binary
<naobsd> probabmy --update_rkimage=PATH
<naobsd> probably
<naobsd> you can put update.img on root of internal storage or external SD
<naobsd> then Android ask "install?"
<hipboi_> and also u disk
<hipboi_> but it doesn't work in recent build
<naobsd> actually I don't try it on RR with self built android from radxa sdk
<naobsd> oops
<naobsd> really? :(
<naobsd> I'm sure it worked on another RK devices with their stock rom
<hipboi_> yes
<naobsd> "it doesn't work" means "Android doesn't ask about install" or "asked, rebooted, but failed" ?
<hipboi_> android doesn't ask
<naobsd> system/app/RKUpdateService.apk should do it...
<hipboi_> i did not find what the recovery do the first time boot after flashing update.img
<naobsd> oh, well, it may be update.zip, not update.img...
<naobsd> well
<naobsd> after flashing update.img by RKXXXTool.exe?
<hipboi_> yes
<hipboi_> after bootloader read misc.img
<hipboi_> with wip-all
<hipboi_> because i don't have recovery, i need to do the same linux
<naobsd> you can skip recovery after flashing by removing misc.img from update.img or replacing misc.img with empty(zero filled) misc.img
<hipboi_> after flashing, there is no data and cache partition
<hipboi_> need to create the file system, i think
<naobsd> only if partition layout is changed. data can be kept if partition layout is not changed and any image is written to these partitions
<naobsd> ah, RKXXXTool.exe restore function may format whole NAND area...
<naobsd> RKAndroidTool.exe shouldn't erase NAND, it just write images to specified partition(s)...
<naobsd> recovery with wipe argument makes file system on data/cache
<naobsd> you need to do it with recovery.img for Linux boot
<naobsd> there should be several ways
<naobsd> 1. check misc partition on Linux, if it contains "boot-recovery" and "--wipe_all", run mkfs.ext4 on Linux
<hipboi_> yes
<naobsd> if you want to make Linux system persistent, you need to keep "boot-recovery" in misc partition
<hipboi_> yes, that's what we hope to see
<hipboi_> if we want to boot to android, just write to misc
<naobsd> misc partition need to be erased explicitly
<naobsd> yes
<naobsd> but you should erase "--wipe_all" after you run mkfs.ext4 on Linux side
<hipboi_> so, under android, if we run adb reboot-recovery on host
<hipboi_> the /sbin/recovery will be called, right?
<naobsd> sorry, /sbin/recovery is not called even on stock RK rom. /init in recovery.img call /sbin/recovery.
<naobsd> "boot-recovery" is command for bootloader to boot recovery partition
<naobsd> if recovery is Android recovery.img, it calls /sbin/recovery
<hipboi_> how is the command passed to bootloader?
<naobsd> but in your case, it's not Android recovery.img, no one calls /sbin/recovery
<hipboi_> i see
<naobsd> I don't know detail in bootloader, but I'm sure "boot-recovery" misc.img changes bootloader's behaviour
<naobsd> as same as recovery switch
<naobsd> "boot-recovery" misc.img is necessary if there is no recovery switch(button)
<naobsd> and misc.img can be used to run recovery after flashing
<hipboi_> i think, when host do adb reboot recovery, android write "boot-recovery" into misc?
<hipboi_> is that the normal routine?
<naobsd> probably no, it doesn't write misc
<hipboi_> :O
<naobsd> on Linux
<naobsd> reboot reason can be passed
<naobsd> to next boot
<hipboi_> how it is implemented
<naobsd> that information is kept while rebooting if power is kept
<naobsd> system/core/libcutils/android_reboot.c
<naobsd> and run "man 2 reboot" on Linux
<hipboi_> but the information is for bootloader
<naobsd> I think it works on RK, then no need to write misc by "reboot recovery" command
<hipboi_> it need to boot a different kernel
<naobsd> I may be wrong
<naobsd> bootloader can check that information
<naobsd> s/bootloader/any software which runs after reboot/
<naobsd> of course you can write "boot-recovery" into misc and just run "reboot" w/o argument
<hipboi_> yes, that's how we implemented at sunxi...
<naobsd> it should work too
<naobsd> ah
<naobsd> yes
<naobsd> there are other systems which uses misc partition to pass information
<naobsd> probably some system assert hard reset while soft reboot
<naobsd> reboot information will be erased on that system
<naobsd> behavior can be differ by implementation for soft reset in kernel
<naobsd> using misc partition, it can survive unwanted interrupt in restore/update process
<naobsd> it can restart on next boot
<hipboi_> yes
<naobsd> then
<naobsd> if "adb reboot recovery" and "reboot" command in RK Android doesn't write "boot-recovery" into misc
<naobsd> you can boot Linux only once.
<hipboi_> we can write a app or widget to do that
<hipboi_> boot2linux
<naobsd> it seems there is no modification in system/core/libcutils/android_reboot.c, so I think misc will not be changed
<hipboi_> so the information is passed to the rk bootloader somewhere else
<naobsd> I think standard Linux/Android way is used
<naobsd> case ANDROID_RB_RESTART2: ret = __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, arg);
<naobsd> in android_reboot
<naobsd> checking adbd reboot function...
<naobsd> it should be android_reboot(ANDROID_RB_RESTART2, 0, "recovery") for adb reboot recovery
<naobsd> "adb reboot bootloader" goes into bootloader mode, so "bootloader" can be specified too.
<hipboi_> so when we run adb reboot recovery, the bootloader did not run, right?
<hipboi_> it's soft reboot
<naobsd> bootloader should run on any (re)boot
<naobsd> it should check information passed by __reboot() ,or string in misc, or GPIO/ADC for physical buttons
<naobsd> I don't know order/priority
<naobsd> sorry, I'm not sure for many things, but it can be confirmed with real device soon :)
<naobsd> I hope my memory is still correct :)
<naobsd> btw
<naobsd> by reading update-script under rockdev
<naobsd> it should be possible to do self update bootloader by device
<naobsd> probably, write "update-bootloader" to 0x4000 on misc, put bootloader .bin to 0xc000 on misc, then reboot
<naobsd> of course it can be used only when bootloader is fine.
<hipboi_> good
<naobsd> (sorry, I can try myself only when I'm at home AND my kids are in bed...)
<hipboi_> :D
<hipboi_> i can totally understand...
<hipboi_> i have one kid
<naobsd> :)
<naobsd> now my kids playing Angry Birds with my spare smartphone
<naobsd> oh I remembered
<ganbold__> in my case one is on PC, another one is watching some cartoon on TV
<naobsd> I wanted to backport multitouch driver from linux 3.8+ kernel
<naobsd> ah, TV shows cartoon network, but kids are not watching it...
<naobsd> I have to say turn on TV...
<naobsd> turn off
<naobsd> well
<naobsd> backport multitouch driver
<naobsd> there are Win8-ready LCD monitors and Win8-ready USB touchscreen panel for LCD
<naobsd> it doesn't work with Android 3.0 kernel
<naobsd> I have USB touch panel for 21.5" monitor
<morfoh> good morning dads + the rest of the world :)
<hipboi_> :)
<morfoh> (:
<hipboi_> naobsd, is the init in boot.img and recovery.img the same?
<naobsd> hipboi: same
<hipboi_> so just init.rc differs
<naobsd> yes
fnchn has joined #radxa
fnchn has quit [Client Quit]
<Emeryth> is there any prebuilt rootfs for radxa?
<Emeryth> I mean Linux of course
<naobsd> Emeryth: I think it will be available from Radxa, but you can run(or make) any Linux rootfs
naobsd has quit [Quit: Page closed]